-
Notifications
You must be signed in to change notification settings - Fork 384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SPI not working Raspberry Pico #417
Comments
SPI most assuredly does work, at least well enough for myself and lots of other folks to interface displays and related stuff. There is a debug SPI mode setting, enable it and set the debug port itself to Serial and re-run your tests to collect some information on what's being done in the core. Off the bat, I think the 0 Hz max clock is causing your grief. Set it to 100000 or something (whatever the max SPI rate is for your devices) and retry. |
In fact, we take the max speed you pass in and send it directly to the SDK which is probably only able to give a 50hz SPI clock as its lowest speed. arduino-pico/libraries/SPI/SPI.cpp Line 191 in 1fdc0ab
So, I do think changing 0 to the proper max speed of your devices will get things rolling. |
Ok the issue with this library seems to be the CS line. In the code below I'm using software CS and it works.if I use hardware the line does nothing. `#include <SPI.h> const uint8_t SPI_MISO = 16; SPISettings parSPI(10000, MSBFIRST, SPI_MODE1); void setup() { //setup pot registers void loop() { void digitalPotWrite(unsigned int val) { |
The Adafruit graphics libraries and even the included SD card libraries use SPI, so you can look there. The WizNet W5100S-Pico also uses SPI to connect to the onboard TCP chip. |
Got a colleague to try running SPI on a Pico and they got the same result. |
Have used SPI.h with Arduino and similar boards (Mostly Teensy 3.2/4) with various digital pots, swipes EEProms and all my code works fine.
Nothing appears to work using SPI on RPI Pico. :(
The code below controls a digital pot - works perfectly on every board I have tried. On Pico SPI signals appear to do nothing
Software defined CS line seems to be a square wave at 50Hz!!!.
I've tried setting the pins before initing the library( SPI.setTX(SPI_MOSI_PIN). etc but that seems to produce some signals
but they are just wrong, or not there.
The text was updated successfully, but these errors were encountered: