Shop Learn
SPI driver capability — Parallax Forums

SPI driver capability

RS_JimRS_Jim Posts: 1,570
edited 2022-01-06 00:17 in PASM2/Spin2 (P2)

@Avisa242, Jessie,
In your P2 library is a smart pin Spi driverwith many different read and write options. If I do a 16 bit word read,is that going to be 16 contiguous bits? I think it will be but I need to know for sure.


  • Jim,

    For code re-usability purposes, any of the long/word/byte-variant methods just call the block methods with a parameter to transact 4, 2 or 1 bytes at a time (the block methods themselves can be set up with any arbitrary number of whole bytes to transact). So yes, 16 contiguous bits, although maybe not seamless between bytes (at least at 20MHz bus speed, 250MHz sys clock. In between bytes at this speed is about 700ns time.). Just note that the object does not control CS - this has to be done from your parent object.

    Here's a capture from my LA writing the word $1234, MSByte-first:

  • RS_JimRS_Jim Posts: 1,570

    Thanks for the input Jessie. I may have to do something a little different than the standard SPI read. Jon showed me a method where I can toggle the CS and generate both the CS out and the 16 clocks. Just have to put the input data in its place when it comes in.

Sign In or Register to comment.