Hi. I'm unable to communicate with the microSD on a PLC ESP32 21. Calling SD.begin() always returns false. Is there anything I'm forgetting?
- 14GB uSD, formatted in FAT32. I've safely ejected it from the PC.
- uSD inserted into the PLC with tweezers, in the correct orientation and depth (like shown in your video "Conceptos básicos: Tarjeta SD en Arduino PLC"), while the PLC is off.
- Just in case the SD board doesn't get power via USB, I make sure to supply 24V to the PLC when testing the SD.
- Tested with multiple unmodified examples (the one on the product's page and the ones that come with "ESP32 PLC Family").
- No other devices or cables connected that could interfere with the SPI communication.
- Tested on two identical PLCs in case the first was defective.
- In the specific examples for ESP32 you always call SD.begin() without any parameters, so the ssPin parameter uses by default the value 5 (SS constant). Is this the pin that is physically being used as SlaveSelect of the SD board for SPI communication?
Thanks for any help.
Ok, with some help from IndustrialShields I made it work.
The actual Chip Select AKA Slave Select pin is not the default one (pin 5), but rather pin 13 in this PLC. In fact, you can use the constant PIN_SD_CS:
SD.begin(PIN_SD_CS);
The microSD card brand matters. Many models refused to work:
- Sandisk Ultra 16GB --> Not working
- Sandisk Ultra 32GB --> Not working
- Sandisk Extreme 256GB --> Not working
- Intenso 4GB --> Not working
- Verbatim 16GB --> Not working
- Kingston Industrial 16GB --> OK
- ATP 8GB --> OK
- Hama 16GB --> OK