Shop OBEX P1 Docs P2 Docs Learn Events
Propeller SPI Object? — Parallax Forums

Propeller SPI Object?

Ray_DRay_D Posts: 8
edited 2015-05-08 08:55 in Propeller 1
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

  • Duane DegnDuane Degn Posts: 10,588
    edited 2015-05-07 18:58
    Ray_D wrote: »
    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.

    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.
  • Ray_DRay_D Posts: 8
    edited 2015-05-07 19:01
    Sorry Duane, I didn't specify. I need the propeller to act as an SPI slave not master. I did see the SPI_ASM.spin object but I need it to act as a slave.
  • jmgjmg Posts: 15,173
    edited 2015-05-07 19:08
    Ray_D wrote: »
    Sorry Duane, I didn't specify. I need the propeller to act as an SPI slave not master. I did see the SPI_ASM.spin object but I need it to act as a slave.

    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 ?
  • Ray_DRay_D Posts: 8
    edited 2015-05-07 19:15
    I'm using the ChipKIT to try to communicate with propeller. The SPI library I'm using does give me control over the bit rate, and shift mode. I would like byte size packets. It doesn't need to be full duplex, I just need to receive the data with the propeller that is sent from the ChipKIT.

    Thanks.
  • John AbshierJohn Abshier Posts: 1,116
    edited 2015-05-08 07:33
    Andr
  • DavidZemonDavidZemon Posts: 2,973
    edited 2015-05-08 08:55
    Ray,

    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.
Sign In or Register to comment.