Hi everyone, I actually work with the Arduino nano 33 BLE with the SD reader from AZ-Delevery but I can't do the communication between us. The code is correctly uploaded on the card but I have no answer in the monitor or just the message for telling me "initialization failed".
My code is :
/**
* Exemple de code de base pour initialiser une carte SD
*/
#include <SPI.h>
#include <SD.h>
/* Broche CS de la carte SD */
const byte SDCARD_CS_PIN = 10;
/** Fonction setup() */
void setup() {
/* Initialisation du port série (debug) */
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
pinMode(SDCARD_CS_PIN, OUTPUT);
digitalWrite(SDCARD_CS_PIN, HIGH);
Serial.println("Initializing SD card...");
if (!SD.begin(SDCARD_CS_PIN)) {
Serial.println("initialization failed!");
while (1);
}
Serial.println("initialization done.");
// TODO Votre code
}
/** Fonction loop() */
void loop()
{
if(SD.exists("/LOG/toto.txt"))
{
Serial.println("Suppression du fichier");
if(!SD.remove("/LOG/toto.txt"))
{
Serial.println(F("Fichier supprimer"));
}
}
SD.mkdir("LOG");
File fp = SD.open("/LOG/toto.txt", FILE_WRITE);
if(!fp)
{
Serial.println("ERROR SD CARD");
}
fp.println("Hello world");
fp.close();
fp = SD.open("/LOG/toto.txt", FILE_READ);
while (fp.available() > 0)
{
Serial.write(fp.read());
}
fp.close();
//while(1);
}
I'm using the 5V and GND by an Arduino UNO, the Arduino nano is connected to the SD reader by 4 wires. D12 for MISO, D11 for MOSI, D10 for the SS (Slave Select) and for the clock, it's connected to the pin A5 (SCL).
I did a GND common between the Arduino Uno, Nano and the SD reader.
I don't alimented the Nano with Arduino Uno 5V. He is alimented with the USB.
To note : In the Arduino IDE, #include <SPI.h> isn't in orange like the other.
So, do you know if there is a particularity for the SPI with this Nano 33 BLE, or maybe, my connection to the SD reader is wrong ?
Thanks for your help ![]()
MicroSD_SPI_Englisch.pdf (459 KB)
Pinout-UNOrev3_latest.pdf (312 KB)
Pinout-NANOble_latest.pdf (187 KB)