Rapidest coding of SPI with RPi Pico W

Using Arduino IDE and c++ b/c I'm porting the project from Arduino boards to my new RPi Pico W. The microcontroller attaches to my custom-designed board that has some SPI devices on it (MCP4262 digi-pots) which worked fine with an UNO. My question:

which SPI library should I use for most rapid coding path [to proof-of-concept of my project]. I was hoping the stock Arduino SPI is what the answer will be, but I'd like to learn thoughts from others of you. My project is a few hundred lines of c++ code, so I want to keep c++ for fastest code. A quick compile and upload tells me I didn't succeed with SPI in my most simple attempt, but before I troubleshoot it, I want to make sure I am selecting a SPI library that will be easiest to find code snippets for, etc. Thank you for your ideas from experience!

Yes, the stock Arduino SPI library should work fine, so post your code, schematic and links to major components used. Describe exactly what you mean by "didn't succeed", that's not a helpful phrase. Describe what you expected to happen and what actually happened.

1 Like

The rapidest way of coding SPI with the Pico is using a in-code PIO machine. See the RPi PIO examples in GitHub - raspberrypi/pico-examples

1 Like

I think he meant "rapidest" as in "least time commitment from the software author", not "fastest hardware."

Does PIO really go faster than the built-in SPI peripheral with DMA?

2 Likes

Pio itself can use DMA too.
But you are right, I did not make exact comparisons.
Not sure about SPI, it's a serial protocol that's well established at the hardware level. However, I tried parallel access to multiple outputs and it will definitely be noticeably faster on PIO than a simple output from the code using GPIO.

1 Like

Thank you. I'll use the stock library exclusively for now and post details if I need more help. Lord bless the three of you!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.