Propeller SPI Object?
Ray_D
Posts: 8
I'm trying to communicate with the propeller through an SPI protocol for a school project. I know spin and can write a SPI object in spin but I was hoping someone had done some work on a PASM (I don't know PASM) object but I couldn't find anything on OBEX. Is there a PASM object out there? Your help will be GREATLY appreciated. Thanks.
Comments
The Propeller library included with the Propeller Tool has "SPI_ASM.spin" as one of the objects.
Do you want the Propeller to act as a slave device to some other controller? What is the Propeller communicating with? There are lots of variations of the SPI protocol.
Besides the object I just mentioned there are lots of other objects with communicate with SPI devices. The ADC chip MCP3208 uses SPI protocol so any object to communicate with this device would be an example of using SPI with the Propeller.
I posted a driver for some small OLED displays here:
http://forums.parallax.com/showthread.php/157136-Interesting-little-4-digit-LCD-TINY-display!?p=1290092&viewfull=1#post1290092
The above linked post includes a link to the original OLED object in the OBEX. I sped up the SPI code a bit in my version. I'm pretty sure the original object used "SPI_ASM" as a starting point.
There are many other examples of PASM SPI code on the Propeller but all the examples I know of are to interface with slave devices. I'm not aware of any examples which treat the Propeller as the slave device.
SPI slave can get tricky, especially high speed full duplex.
What is your master ? Do you have control of that code ?
What Data rate and packet sizes and is it full duplex ?
Thanks.
I once thought about creating a school project that used a Propeller as an SPI slave. It made the most sense from a high-level perspective. Unfortunately.... it just became too much of a pain and I ended up switching the control so that the Propeller could be master. It wasn't ideal, but it was much better than trying make a Propeller listen as an SPI slave. You might want to take a second (or third?) look at the design and decide if you really need the Prop to be a slave. If you do, then you may want to take a look at using a different protocol - one of the buffered UART implementations would likely be better.
I have not seen an SPI slave driver for the Propeller (Andre's idea sure sounds intriguing) and I think it's because everyone that might want such a driver has found a better/easier (for the Propeller) alternative - such as UART.