smartpin SPI (bidirectional) sample code?
Mark_T
Posts: 1,981
in Propeller 2
Had a bit of a search but didn't find anything obvious, I'm sure someone has some examples of this to avoid re-inventing the wheel?
Comments
Chips booter which accesses the FLASH. He uses separate send and receive routines.
My SD booter which uses a combine send/receive routine with various entry points depending on what you are needing to do. Easiest way, search for the label SENDFF.
Peters TAQOZ. YOu will have to ask Peter.
But bit bashing is useful too
Smart pins are used in the UART side, because highest baud rate helps there, and the buffering buys time to allow SPI bit-bash.
I think one reason to KISS on SPI was to keep the boot silicon minimal, and so lower the risk of smart pin flaws causing dead-in-water outcomes...
Things like SPI and I2C and serial are so slow compared to P2 clock speed, seems very doable...
That speed also outruns my Scope, so no pictures...
Enjoy!
Mike
180Mbaud = 180bps = 18MB/s
We can write to hub at 4Bytes/clock for a block using wrlong and setq (plus setup), so 4B @ say 180MHz = 720MB/s
Well there are some pretty high SPI clock rates out there, 40MHz and up...
Yes, I tried and failed. I have the data in longs in the LUT but failed over days to get my buffers running with long transfers to/from HUB.
Finally I gave up, just transfer Bytes from HUB to LUT and vice versa, shortend everything up and made space to include decimal, hex output and string input into the COG.
I need to check the new printf stuff in spin2gui/fastspin to maybe include that also to be compatible with them existing drivers.
Weekend is coming...
Enjoy!
Mike
final code in TAQOZ thread
***UPDATED***
Here is some TAQOZ smartpin SPI code (only output for now)
input working, tested with MISO looped back with MOSI with a jumper
and MISO looped back internally with MOSI via 'a' input selector relative pin -1 (see commented out code)
Sample