pico-mcp2515 icon indicating copy to clipboard operation
pico-mcp2515 copied to clipboard

Adding information what IO-pins to use

Open StefanL38 opened this issue 1 year ago • 4 comments
trafficstars

Hi Adam,

I have looked for but did not find any information about which IO-pins are used for the SPI-interface. I am even more confused as the Pin-outs that can be found for the RP2040 pico show four sets of IO-pins that are named SPI-0.

Huh ? Now which IO-pins do I use? I guess the pico can not autodetect them.

StefanL38 avatar Feb 10 '24 12:02 StefanL38

void setup() { // put your setup code here, to run once: Serial.begin(115200); Serial.print("MOSI: "); Serial.println(MOSI); Serial.print("MISO: "); Serial.println(MISO); Serial.print("SCK: "); Serial.println(SCK); Serial.print("SS: "); Serial.println(SS);
}

void loop() { // put your main code here, to run repeatedly: } You can use this sketch to find out in arduino ide.

RefreshMyMind-I avatar Feb 15 '24 13:02 RefreshMyMind-I

Hi! I believe there are no limitations in terms of which SPI_TX / SPI_RX pins you can use as long as they belong to the same SPI bus. So if you are using SPI0 you can use any of GP0 / GP4 / GP16 for RX and GP3 / GP7 / GP19 for TX.

Just to clarify things, TX in this context is MISO, RX = MOSI

https://www.raspberrypi.com/documentation/microcontrollers/images/pico-pinout.svg

adamczykpiotr avatar Feb 15 '24 13:02 adamczykpiotr

By default i am using what RPI Foundation suggest as default (defined here), so SPI0, SCK=18, TX = 19, RX = 16, CS = 17.

adamczykpiotr avatar Feb 15 '24 13:02 adamczykpiotr

It would be great if you could create a PR with updated repo or perhaps additional examples. I am currently quite time constrained in terms of my open source contributions but I'm glad to handle any PRs and help anyone creating them

adamczykpiotr avatar Feb 15 '24 13:02 adamczykpiotr