Read/Write to an attached SD card reader using a Nano RP2040 Connect

I am trying to get a SD card reader to work from an Arduino Nano RP2040 Connect. The code keeps failing.

The process actually fails here, and I am now using

const int= 10;

Fails here :-

Serial.print("Initializing SD card...");

if(!SD.begin(10))
{
Serial.println("initialization failed!");
while(1);
}
Serial.println("initialization done.");

SD.begin(10) never completes, so the 'if condition' is then true with 'while(1);' preventing the code from progressing any further.

The issue arises in 'SD.begin(cs_pin)' , where I have set cs_pin as follows :

const int cs_pin= 10;

Can you help me ?

Do I have to look inside the 'SD' library code ?

how is it wired?
is SD card inserted?

HI @anon68427626,

welcome to the arduino-forum.
You read the "how to get the best out of this forum" posting

The most important thing is to post your complete sketch as a code-section
inside the arduino-IDE:
press ctrl-t for autoformatting your code.
press ctrl-shift-C to copy the complete sketch into the clipboard
including the code-section formatting
change from IDE to browser and press ctrl-v

The reference to the RP2040 shows what IO-pins are used for the SPI-bus

best regards Stefan

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