Shop OBEX P1 Docs P2 Docs Learn Events
raspberry pi and propellor - Page 2 — Parallax Forums

raspberry pi and propellor

2»

Comments

  • Patrick222122Patrick222122 Posts: 30
    edited 2013-01-19 05:44
    no luck with that. I entered /dev/ttyUSB0 as the parameter and only got to the first print statement. MAybe the problem is that I have mutiple other devices connected at the same time as my robot? I need at least a keyboard to start the program. What do you think?
  • MagIO2MagIO2 Posts: 2,243
    edited 2013-01-19 06:05
    You don't need a keyboard for the raspberry. Simply attach it to your internet-router and you can use any computer to Login via SSH. (You can also use an X-client to see the whole raspberry desktop).
    That's my setup.
  • Patrick222122Patrick222122 Posts: 30
    edited 2013-01-19 07:01
    but is it the problem.
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2013-01-19 07:44
    What is the exact code you are trying to use? If you are using the example C program from the 2nd post then the value for the port is hard coded into the program. It really doesn't mater what is entered as the port on the command line since that is just echoed to the terminal screen and isn't actually used. With a few tweaks to the program it COULD use the parameter from the command line. As it sits now all those initial lines that deal with argc, argv, etc can just be removed. They aren't needed.

    The command that heater mentioned should show you a list of what USB devices are found. Your Propeller board may be 0 or it could be a different # depending upon what else you have plugged in. When you say things didn't work it would help if you replied with the command you used and the output so we could try and figure out why. Without seeing the output we don't know if you just had a typo or something else is going on.

    There were some know USB issues with the Raspberry Pi but a lot of them were fixed in the latest kernel releases so make sure you run the update commands so you have the latest code on your system.
  • Patrick222122Patrick222122 Posts: 30
    edited 2013-01-19 09:04
    I just retried the program and I think I may have found the problem. For some reason the open("dev/ttyUSB0") command is not opening the connection to the usb port and I know USb0 is the right path. When the program runs it pauses at the open command as if it is trying to open the port but cannot. I have waited for two minutes yet the program seems not to want to open it.
  • jazzedjazzed Posts: 11,803
    edited 2013-01-19 09:22
    I just retried the program and I think I may have found the problem. For some reason the open("dev/ttyUSB0") command is not opening the connection to the usb port and I know USb0 is the right path. When the program runs it pauses at the open command as if it is trying to open the port but cannot. I have waited for two minutes yet the program seems not to want to open it.

    Don't forget to use a full file name open("/dev/ttyUSB0") ... maybe you did it right though. What do you see if you say $ ls /dev/ttyU* ?

    Is it possible that another program is using the port with exclusive access? Use $ ps -ef "name" to look for programs of name that might have access.
  • dgatelydgately Posts: 1,630
    edited 2013-01-19 10:31
    didn't know that, most of programming with c I have has been done via Visual C++ for windows. I only started gcc and linux program about a month ago. Well that kind of rise another problem. I want the program to start immeideatly after start up. Could this be acheived?


    Not to be a nag but, you should check out:

    http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=Brian+W.+Kernighan%2C+Dennis+M.+Ritchie+The+C+Programming+Language+&rh=i%3Aaps%2Ck%3ABrian+W.+Kernighan\c+Dennis+M.+Ritchie+The+C+Programming+Language+

    The Kerninghan/Ritchie text is by far the best resource for C...

    It could help in your future programming endeavors using standard ANSII C variants like gcc on Linux or Unix boxes. Your questions about "&" and using command-line arguments are well-answered along with in-depth descriptions of all ANSII C features. It will be a great reference, that should help in honing-down your forum queries to get even more helpful results.


    On starting programs immediately after start up (on the Raspberry Pi)... There are several forum threads at raspberrypi.org forum. Here's one:

    http://www.raspberrypi.org/phpBB3/viewtopic.php?f=27&t=10154&p=114987&hilit=launch+program+on+startup#p114987

    The RaspberryPi forum as well as the Debian.org Wiki (The recommended RaspberyPi OS, Raspian is a form of Debian Linux!) are full of threads explaining solutions for common queries concerning the RaspberryPi operating system. I found a great example of how to run my temperature probe Python script, using crontab to "automagically" kick it off throughout the day. /etc/rc.local and /etc/init.d provide several methods for auto-launching scripts, compiled code and apps, at will!

    I hope this helps!

    dgately
  • Patrick222122Patrick222122 Posts: 30
    edited 2013-01-19 11:25
    I just thought of something. In an earlier post RobotWorkshop stated that there was some know issues with the pi when it came to usb. Perhaps this could be the problem. I aquired my pi in december and it runs debian 6. Has there been inssues with Usb on that operating system. if so what updates should I use to fix them.
  • Patrick222122Patrick222122 Posts: 30
    edited 2013-01-19 11:29
    responding to your post Jazzed, what should I look for to see if a program is using the usb port
  • MagIO2MagIO2 Posts: 2,243
    edited 2013-01-19 11:54
    Got my Pi earlier than you and the code I posted is written because of that USB problem. As I said my setup is a little different from your's -> no other devices on the USB port.
    In my setup with the early Debian I had Problems as well. Not as massive as your problems, because the programs worked but from time to time there were transfer errors and after a while USB totally hung and it was also killing the Network Interface. (If I remember right the same chip is responsible for USB and Network)

    Do you have a chance to test the code with the actual Debian version?
  • Patrick222122Patrick222122 Posts: 30
    edited 2013-01-19 12:15
    I have no other debian other than what running on the pi
  • dgatelydgately Posts: 1,630
    edited 2013-01-19 15:51
    I have no other debian other than what running on the pi

    The latest Raspian version is dated 12/12/2012... You can update the OS by doing the following on the command line:
    sudo apt-get update
    sudo apt-get upgrade
    

    For firmware updates, you can use "rpi-update". See this page: Hexxeh/rpi-update · GitHub



    dgately
  • Heater.Heater. Posts: 21,230
    edited 2013-01-20 00:41
    Are you actually running raspian or the old debian?
    Better to use the latest raspian.

    You mentioned having other things connected to your Pi. For these experiments I would start with only the USB serial, keyboard and mouse.
  • Patrick222122Patrick222122 Posts: 30
    edited 2013-01-20 09:01
    something very strange happened when I ran the code after doing the updates. Code is returning the port failed to open message even though I have the right path entered in both the code and the parameters. Is there any reason for this
  • Patrick222122Patrick222122 Posts: 30
    edited 2013-01-20 11:58
    I am thinking about retrying libusb. I think what was throwing me off was That I did not know what DEV the prop plug I was using was. But that raise a problem. I don't know the device type for propplug which how they identified the dev in most of the example I have seen. If it is posible to do using the device id or device number, please tell me how. I got most of the program finish save that
Sign In or Register to comment.