SPI library for RP2350

Hi all,

I am pretty new to implementing SPI communication but I seem to have the code working on an Arduino UNO - yay! However, my project requires me to use a Raspberry Pi PICO 2350 as the microcontroller. I have downloaded the appropriate board manager from Earlephilhower and selected Raspberry Pi Pico for the board. I verified that I am able to see the serial monitor and upload code to the Pico with a simple print statement - yay! Next, the problem comes when trying to reconfigure the hardware to the appropriate pins on the PICO so that they match defaults in the built-in SPI library. I can't seem to get any data from my code when connected to the default SPI pins of the RP Pico (Pins 21, 22, 24 & 25). Is there a way to explicitly define these pins in the code?

I used this code to try to get the defaults:
CODE:

  Serial.print("Default SPI0 MOSI: ");                   
  Serial.println(PIN_SPI0_MOSI);
  Serial.print("Default SPI0 MISO: "); 
  Serial.println(PIN_SPI0_MISO);
  Serial.print("Default SPI0 SCK:  "); 
  Serial.println(PIN_SPI0_SCK);

OUTPUT:
Default SPI0 MOSI: 23
Default SPI0 MISO: 20
Default SPI0 SCK: 22

This doesn't make sense to me since pin 23 on the RP Pico is ground. Any guidance would be super helpful. Thanks! :slight_smile:

TLDR: What are the default pin numbers on RP Pico 2350 to use with SPI library?

Are you using a Raspberry PI Pico 2? If so, you need to select that as your board in the IDE.

The SPI pins are defined as:

// SPI
#define PIN_SPI0_MISO  (16u)
#define PIN_SPI0_MOSI  (19u)
#define PIN_SPI0_SCK   (18u)
#define PIN_SPI0_SS    (17u)

#define PIN_SPI1_MISO  (12u)
#define PIN_SPI1_MOSI  (15u)
#define PIN_SPI1_SCK   (14u)
#define PIN_SPI1_SS    (13u)

https://www.raspberrypi.com/documentation/microcontrollers/pico-series.html

Has nice pinout diagrams

This worked! Thank you!