Enabling Wifi breaks SD Card ability to read

jeeper1974
Posts: 11
Joined: Thu Aug 13, 2020 5:47 am

Enabling Wifi breaks SD Card ability to read

Postby jeeper1974 » Thu Mar 16, 2023 7:23 am

ESP-IDF: 4.4.2
When I initialize the wifi and try to read from a SD card I get the following error.

Code: Select all

diskio_sdmmc: sdmmc_read_blocks failed (257)
Without wifi it reads from the sdcard just fine.

The SD card will still initialize fine.

Code: Select all

I (1274) SD_CARD: Initializing SD card
I (1278) SD_CARD: Using SDMMC peripheral
I (1283) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
Name: SC32G
Type: SDHC/SDXC
Speed: 20 MHz
Size: 30436MB
And wifi works without any issues. It is only when I go to access the SD card that this error comes up. Anyone have an issues like this before?

Roger

ESP_Sprite
Posts: 9905
Joined: Thu Nov 26, 2015 4:08 am

Re: Enabling Wifi breaks SD Card ability to read

Postby ESP_Sprite » Fri Mar 17, 2023 12:53 am

Potentially a power supply issue; can your 3.3V line supply enough power to run both the ESP32 as well as the SD card?

jeeper1974
Posts: 11
Joined: Thu Aug 13, 2020 5:47 am

Re: Enabling Wifi breaks SD Card ability to read

Postby jeeper1974 » Tue Mar 21, 2023 3:14 pm

The power supply is ok. I found today that I can stream data over wifi and save to the SD card over a non-secure HTTP connection. As soon as I switch to a secure HTTPS connection the SD card write fails.

My SD card is connected to GPIO2, GPIO4, GPIO12, GPIO13, and GPIO15.

Now these are also ADC2 pins and I read that wifi and ADC2 cannot be used together. It looks like they can be used if those pins are not configured for ADC mode. Is it possible that WiFi uses those ADC2 GPIO pins for HTTPS connections? I don't know why that would be, but I can write to the SD card without a SSL connection, and cannot with a SSL connection.

felixcollins
Posts: 125
Joined: Fri May 24, 2019 2:02 am

Re: Enabling Wifi breaks SD Card ability to read

Postby felixcollins » Thu Mar 23, 2023 9:19 pm

Are you using pure IDF or are you using ADF as well? What board are you using?

gudbrand
Posts: 1
Joined: Fri Apr 13, 2018 8:32 am

Re: Enabling Wifi breaks SD Card ability to read

Postby gudbrand » Fri Jan 10, 2025 9:45 am

I have the same problem.

With WiFi running, SD_MMC readings is working with small files but with larger files (or after a while with smaller)
I get the error message "E (634939) diskio_sdmmc: sdmmc_read_blocks failed (257)"

When WiFi disabled, SD_MMC works fine.

This is consistent behavior.

Reading from Internal Flash-disc is fine with wifi running, same for ram-disc

I use Arduino with PlatformIO.

Regards.

MicroController
Posts: 1991
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Enabling Wifi breaks SD Card ability to read

Postby MicroController » Fri Jan 10, 2025 11:29 am

Memory leak maybe.

Who is online

Users browsing this forum: derveroonibo and 91 guests