Autres articles / Other articles

Mount an SD card reader

published: 28 January 2024 / updated 28 January 2024

Lire cette page en français

 


Feeling cramped with the SPIFFS file system? So mount an SD card reader and benefit from storage space measured in gigagbytes!

The SD card reader

The choice fell on an SD card reader model with SPI interface. This model allows you to take out the SD card to read it on your computer.

All other models of SPI card readers may be suitable, provided they have the SPI interface.

Connecting the SPI card reader

The first operation consists of locating the four pins of the SPI port of your ESP3 card. These pins must be marked by the indication VSPI_ followed by the use of the pin: VPSI_MOSI, VSPI_MISO, VSPI_CLK and VSPI_CSI.

On the ESP32-Wroom-32 card, correspondence of these pins:

--- ESP 32 ---         --- SD Card ---
G23  VSPI_MOSI   <-->  MOSI
G19  VSPI_MISO         MISO
G18  VSPI_CLK          SCK
G05  VSPI_CS0          CS

The position of the pins may differ depending on the ESP32 card model.

This SD card reader is powered by 5V. It incorporates a regulator which reduces the voltage used at 3.3V.

Access to SD card contents

The first operation is to mount the SD card:

SD          \ access SD vocabulary 
SD.begin    \ mount SD card. Stack 1 if success, 0 if error 

And that's it!

Finally. Almost...

Let's see a simple example. Let's start by seeing the files present on this SD card:

ls /sd    \ display: 
System Volume Information 
oledTest.jpg 
regSensSar.jpg 
techRef01.jpg 

Here, we find the three files previously recorded from a computer on this SD card.

Let's save a new file:

RECORDFILE /sd/config.fs 
\ define numbers of 74HC595 shift registers 
3 constant NB_SHIFT_REGS 
 

This saves a new file to our SD card, named config.fs.

In conclusion, this SD card reader opens up extraordinary development prospects.


Legal: site web personnel sans commerce / personal site without seling