SPI communication from propeller (master) to arduino (slave)
Sneakyean
Posts: 6
Howdy,
I am trying to establish communication between an arduino and my propeller board. I have tried the object BS2 Functions with the shiftin and shiftout commands to no avail.
Has anyone ever established SPI communications between these two boards successfully. If so, any help would be appreciated.
I using the usual connections,
chip select
master out, slave in MOSI
master in, slave out MISO
clock
power
ground
Thanks
sneakyean
I am trying to establish communication between an arduino and my propeller board. I have tried the object BS2 Functions with the shiftin and shiftout commands to no avail.
Has anyone ever established SPI communications between these two boards successfully. If so, any help would be appreciated.
I using the usual connections,
chip select
master out, slave in MOSI
master in, slave out MISO
clock
power
ground
Thanks
sneakyean
Comments
If you want to use SPI, I assume you want the Prop to be the slave? I tried something like this recently. I was surprised at how much harder writing a slave SPI driver was then writing a master driver.
I don't know off the top of my head of any SPI slave driver object (that wasn't supposed to sound as bad as it did).
On the other hand, an asynchronous serial connection would be pretty easy.
BTW, I really don't think BS2 Functions' shiftin and shiftout would work for this application. They both assume the Prop's the SPI master.
We have migrated to propeller and we are trying to do the same thing. We, unfortunately, have to use this arduino since it has the program on it that communicates with this beacon. It is set up to use SPI communication so we didn't have a choice in this matter. The arduino code is written assuming it is the slave and the other board is master. The prop board does set the clock.
So given that, I was confused why the BS2 Functions code wasn't working since my prop board is the master.
pb
Could you provide more information about the rotating beacon? Do you have the Arduino code you use?
The code for the Basic stamp is at the bottom.
The beacon is rotating, finds the robot, figures out the angle to that robot (based on a compass heading of north), then sends that angle to the arduino who is supposed to communicate with the attached program to the master.
The arduino receiving program is attached as is my spin program that is supposed to do the same thing.
Here is the website for info about the beacon if that is helpful
http://spacegrant.colorado.edu/index.php/rcbeaconinfo
Thanks for your help!!!
CS PIN 8 ' Chip Select
DATAfromBS PIN 9 ' Data from BS to Arduino
DATAtoBS PIN 10 ' Data from Arduino to BS
Clock PIN 11 ' Clock
'
[ Init Setup ]
results VAR Byte ' Results
'
[ Program Code ]
DO
LOW CS
SHIFTIN DATAtoBS, Clock, MSBPRE, [results] 'request the BR value
SHIFTOUT DATAfromBS, Clock, MSBFIRST, [ 202] 'write 202 to the Arduino as a staleness indicator
HIGH CS
DEBUG "Shifted In Value = ", DEC results, CR
PAUSE 3000
LOOP
That's were I'd start.
This looks like a very interesting project.
XGamestation sells a Propeller/AVR board that does exactly that, AVR (Arduino compatible) that has the Prop configured as a SPI Master. http://www.xgamestation.com/view_product.php?id=51.
The idea is to leverage the Propeller for it's graphics, keyboard, etc. Very slick idea as GUI on microcontrollers is a pain, but the Propeller really shines here. They offer a 16-bit Pic 24Hxx version also. Complete s/w h/w info including source code for both can be found here: http://www.chameleon-dev.com/pmwiki.php