Shop OBEX P1 Docs P2 Docs Learn Events
Propeller on Raspberry Pi :-: Soup to nuts... — Parallax Forums

Propeller on Raspberry Pi :-: Soup to nuts...

Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
edited 2013-11-07 14:13 in Propeller 1
Thanks to Rick, Dennis, Jazzed, Roy, and Heater I'm making good headway on getting the Propeller to be friendly with the Raspberry Pi.

I thought I'd bring the bits and pieces into a single thread for others to follow along, as some of the resources in other threads assumed one has more knowledge of Linux/Raspberry Pi than others.

Here's what is working here [so far] -- I'll update this as we refine the process even more.

Testing Hardware Configuration Used: A Raspberry Pi (Model B) with a Parallax Quickstart plugged into the top USB port.
Testing Software Configuration; Raspbian NOOBS Install V1.3.2 with single adjustment to config.txt to overclock at 950mhz.

OpenSpin (Obtain and compile)
$ wget -r http://open-source-spin-compiler.googlecode.com/svn/
$ cd open-source-spin-compiler.googlecode.com
$ cd svn
$ make clean
$ make all

Finally, run the binary with the following...
$ ./openspin

There's probably a good linux admin reason not to do this, but it's handy anyway...
$ sudo cp openspin /usr/bin





Propeller-load (Obtain and unzip - Tested with GPIO UART & USB connections) Thanks Heater

Note: (If using propeller-load with the GPIO UART)
First, following the instructions at this link for disabling console's use of the GPIO pins.
For use with the Raspberry Pi's GPIO pins, connect the Propeller to Raspberry Pi's RX,TX, and GPIO as indicated by the attached graphic.
Propeller_2_Raspberrypi_GPIO.png

$ wget http://www.orrtech.us/propeller-load-rpi-3.zip
$ unzip propeller-load-rpi-3.zip
$ ./propeller-load -p /dev/ttyAMA0 <filename.binary> -r

Propeller Version 1 on /dev/ttyAMA0
Downloading 52 bytes of 'test.binary'
Loading test.binary to hub memory
52 bytes sent
Verifying RAM ... OK


There's probably a good linux admin reason not to do this, but it's handy anyway...
$ sudo cp propeller-load /usr/bin

Alternatively, propeller-load can be used to upload to /dev/ttyUSBx as well. Use dmesg to determine the attached port after plugging in the Propeller.




SimpleIDE (Obtain and install) Updated 11/8/13 - Thanks to Heater

Note: You'll need to have at least 1GB of free space to extract and install this.
$ wget https://dl.dropboxusercontent.com/u/81267937/SimpleIDE-0-9-43.armv6l.raspberrypi-linux.tar.bz2
$ bunzip2 SimpleIDE-0-9-43.armv6l.raspberrypi-linux.tar.bz2
$ tar -xvf SimpleIDE-0-9-43.armv6l.raspberrypi-linux.tar
$ cd SimpleIDE-0-9-43
$ sudo ./setup.sh $USER

Once finished compiling, startx and ./SimpleIDE from SimpleIDE-0-9-43
Still having trouble with propeller-load included in this package.



.....To be continued...



Referenced threads:


Heater's thread on SimpleIDE: http://forums.parallax.com/showthread.php/150441-SimpIeIDE-for-Debian-%28x86%29-and-Raspbian-%28Raspberry-Pi%29

Mindrobots thread on OpenSpin: http://forums.parallax.com/showthread.php/151162-OpenSpin-build-on-Raspberry-Pi-Errors-BOOM

Question regarding Open Source propeller tools: http://forums.parallax.com/showthread.php/150777-Question-regarding-Open-Source-propeller-tools.

Thread with Heater's fixed propeller-load: http://forums.parallax.com/showthread.php/141469-SimpleIDE-for-Raspberry-Pi-Raspian/page2

Comments

  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2013-11-06 17:27
    Replicating Dennis' (@dgately) example of compiling Spincode using WebIDE (Requires openspin & pload from previous post)
    Thank you Dennis for showing a great example of this in the mutated iPad thread....

    1) Install WebIDE using these instructions on adafruit.com
    2) Once logged in, go to my-web-projects in WebIDE.
    3) Click on terminal and do the following..
    $ touch test.spin
    $ touch proploader.py
    $ chmod +x proploader.py
    

    4) Refresh the my-web-projects list.
    5) Add the following lines to proploader.py
    #!/usr/bin/python
    import os
    
    print ("OpenSpin compiler running...")
    os.system("/usr/bin/openspin test.spin")
    
    print ("Uploading to the Propeller...")
    os.system("/usr/bin/propeller-load -p /dev/ttyUSB0 test.binary -r")
    

    6) Add the following code to test.spin
    CON
    
      _xinfreq = 5_000_000
      _clkmode = xtal1 + pll16x
    
    
    PUB LedOnOff
       dira[23] := 1
    
       repeat
         outa[23] := 1
         waitcnt(clkfreq/10 + cnt)
         outa[23] := 0
         waitcnt(clkfreq/10 + cnt)
    

    7) Click on proploader.py file and click on Run. -Enjoy!
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2013-11-06 17:27
    ..Reserved for Python module which calls Spin objects from Python...
  • jmgjmg Posts: 15,173
    edited 2013-11-06 18:03
    Is it easy to add numbers for the memory footprint requirements of these ?
    eg Flash.Ram to compile and Flash.Ram to run and maybe some example times ?
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2013-11-06 18:29
    jmg wrote: »
    Is it easy to add numbers for the memory footprint requirements of these ?
    eg Flash.Ram to compile and Flash.Ram to run and maybe some example times ?

    I'm using a Raspberry Pi B with standard NOOBS Rasbian install. The only configuration change I've made to mine is to push it to 950mhz.
    Added a note about the compile time on the SimpeIDE.
  • jazzedjazzed Posts: 11,803
    edited 2013-11-06 18:34
    This is a good exercise :)

    Unfortunately, I expect you will hit a few bumps along the way.

    1) The latest SimpleIDE is on the "spinside" branch. I.E. to get the current code use $ hg update spinside
    2) Some of the build procedures may need updating.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2013-11-06 18:39
    jazzed wrote: »
    This is a good exercise :)

    Unfortunately, I expect you will hit a few bumps along the way.

    1) The latest SimpleIDE is on the "spinside" branch. I.E. to get the current code use $ hg update spinside
    2) Some of the build procedures may need updating.

    Actually, I'm posted the "exact" methods that are working here tonight. I'll test with the new "spinside" branch and edit.. Thanks!

    Jeff
  • prof_brainoprof_braino Posts: 4,313
    edited 2013-11-06 18:47
    You ROCK

    oops message too short. potatohead, help me out here...


    You ROCK DUDE!
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2013-11-06 19:34
    Thanks @prof_braino, but I'm just pulling all the bits together, adding a few missing items (probably assumed knowledge), and testing it to make sure it all works.

    Enough toys to keep everyone happy for tonight. I'll start working on my Python module idea more tommorow.
    I've spent the last couple weeks getting from newbie to semi-dangrous level in Python. I *think* I'm ready to put what I've learned into practice. :)

    I've tried to list every resource and contributor's name in the top of the messages. If I've missed someone, please let me know!

    Jeff
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2013-11-07 11:20
    Final edit: Thanks Bill for your indication that Heater had already blazed a trail here. Working now. Adding the correct entry to the top of the thread.


    So I'm still fooling with the method of uploading code from the Raspberry Pi to the Propeller using the GPIO UART pins...

    I have unhooked the Quickstart board from my USB port and have it connected to Raspberry Pi's GPIO using Gnd, 3.3v, TX, and RX pins.

    I *thought* if I recalled correctly, it would be possible to hit the reset switch on the Quickstart in time with the data transmittion from propeller-load.

    While I'm making some sort of connection, it isn't working as I previously thought. Time to tie in some control to the RES pin?

    pi_propload_GPIO_pins_test1.png

    If you are attempting this, you'll need to disable the console's use of /dev/ttyAMA0 first.



    Edit: (A few minutes later...)

    I'm getting a little closer: Tied GPIO 7 to RES and using this Python program..

    #!/usr/bin/python
    import os
    import RPi.GPIO as GPIO
    
    GPIO.setmode(GPIO.BOARD)
    GPIO.setup(7,GPIO.OUT)
    GPIO.setwarnings(False)
    
    print ("OpenSpin compiler running...")
    os.system("/usr/bin/openspin test.spin")
    
    GPIO.output(7,False)
    GPIO.output(7,True)
    print ("Uploading to the Propeller...")
    os.system("/usr/bin/pload /dev/ttyAMA0 test.binary")
    


    pi_propload_GPIO_pins_test2.png
  • Bill HenningBill Henning Posts: 6,445
    edited 2013-11-07 12:02
    Jeff,

    Please use GPIO #17 to reset the Prop, that is what Heater was using for his modified propeller_load, and #7 is one of the two SPI chip selects on the Pi.

    Thanks for documenting this for people; I got SimpleIDE, PropGCC, OpenSpin etc running on one of my pies a few weeks ago, but other work took me away from it before I got the Prop on the connected RoboProp programmed by the Pie connected to it ... I plan on getting back to this ASAP.
    So I'm still fooling with the method of uploading code from the Raspberry Pi to the Propeller using the GPIO UART pins...

    I have unhooked the Quickstart board from my USB port and have it connected to Raspberry Pi's GPIO using Gnd, 3.3v, TX, and RX pins.

    I *thought* if I recalled correctly, it would be possible to hit the reset switch on the Quickstart in time with the data transmittion from propeller-load.

    While I'm making some sort of connection, it isn't working as I previously thought. Time to tie in some control to the RES pin?

    pi_propload_GPIO_pins_test1.png


    If you are attempting this, you'll need to disable the console's use of /dev/ttyAMA0 first.



    Edit: (A few minutes later...)

    I'm getting a little closer: Tied GPIO 7 to RES and using this Python program..
    #!/usr/bin/python
    import os
    import RPi.GPIO as GPIO
    
    GPIO.setmode(GPIO.BOARD)
    GPIO.setup(7,GPIO.OUT)
    GPIO.setwarnings(False)
    
    print ("OpenSpin compiler running...")
    os.system("/usr/bin/openspin test.spin")
    
    GPIO.output(7,False)
    GPIO.output(7,True)
    print ("Uploading to the Propeller...")
    os.system("/usr/bin/pload /dev/ttyAMA0 test.binary")
    

    pi_propload_GPIO_pins_test2.png
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2013-11-07 12:15
    While it won't solve the issue I'm having right now, it's an easy adjustment. I'll move to GPIO 17 in the document when I figure out why it isn't loading yet. :)

    Keff
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2013-11-07 12:57
    Added Heater's fixed propeller-load to the list, and listed a pinout for GPIO 17 as requested.

    Jeff
  • Bill HenningBill Henning Posts: 6,445
    edited 2013-11-07 13:25
    Thank You!
  • mindrobotsmindrobots Posts: 6,506
    edited 2013-11-07 14:13
    Thanks, Jeff for pulling all this together and documenting and testing it. I'm trying to follow along as fast as I can!
Sign In or Register to comment.