Issue with ESP32 SD communications using SPI for frequencies other than 20/40MHz.

Hugo_NV
Posts: 3
Joined: Thu Aug 19, 2021 6:03 am

Issue with ESP32 SD communications using SPI for frequencies other than 20/40MHz.

Postby Hugo_NV » Fri Oct 15, 2021 1:16 am

Hi,

I am using ESP-WROVER-IE to communicate with an SD card using the VSPI interface. I am basically using the SD card example code from Github, with pins modified to use the default VSPI pins required for my application:

[Codebox]
#define PIN_NUM_MISO 19
#define PIN_NUM_MOSI 23
#define PIN_NUM_CLK 18
#define PIN_NUM_CS 5
[/Codebox]

When I try to adjust the frequency of the SPI communications to the SD card it seems that the ESP will only accept 20 and 40MHz. For other frequencies I configure the SPI frequency is set to 400kHz, no matter what value I feed it (apart from 20/40MHz). I configure the frequency as follows:

[Codebox]
sdmmc_host_t host = SDSPI_HOST_DEFAULT();
host.max_freq_khz = SPI_FREQ; // Overwrite default frequency from SDSPI_HOST_DEFAULT
host.slot = SD_SPI_HOST; // Overwrite default SPI host slot from HSPI to VSPI.
host.set_card_clk(host.slot, SPI_FREQ);
[/Codebox]

My sdkconfig file is attached. Any suggestions? It seems I have lost control of the clock frequency.
Attachments
sdkconfig.zip
sdk config for SD SPI application
(8.46 KiB) Downloaded 328 times

Who is online

Users browsing this forum: No registered users and 23 guests