Skip to content

Extend SD card select timeout #6107

Closed
@NomAnor

Description

@NomAnor

Board

DOIT ESP32 DEVKIT V1

Device Description

I'm using a common Arduino SD Card PCB that is connected with 14cm wires to the ESP32

Hardware Configuration

I'm using the VSPI Pins 18, 19, 23 and 5

Version

other

IDE Name

Arduino IDE

Operating System

Arch Linux

Flash frequency

80 MHz

PSRAM enabled

no

Upload speed

921600

Description

Updating to arduino-esp32 v2.0.2 caused the SD-Card to not work anymore (previously I used 1.0.6). The solutions in the other issues didn't work.

Reverting all changes in the file sd_diskio.cpp gave me the same functionality as in 1.0.6.

Looking at the code I suspected the sdWait timeout in the sdSelectCard function, because in 1.0.6 a timeout was just ignored but this is now fixed. In other places (sdWriteBytes) a timeout of 500ms is used so I changed the value to that and now my card is recognized.

For me just chaning the timeout in v2.0.2 fixed the issue.

Sketch

Example SD_Test sketch

Debug Message

Before changing the timeout:

[   313][W][sd_diskio.cpp:104] sdWait(): Wait Failed
[   313][E][sd_diskio.cpp:126] sdSelectCard(): Select Failed
[   313][W][sd_diskio.cpp:510] ff_sd_initialize(): GO_IDLE_STATE failed
[   318][E][sd_diskio.cpp:795] sdcard_mount(): f_mount failed: (3) The physical drive cannot work
[   627][W][sd_diskio.cpp:104] sdWait(): Wait Failed
[   627][E][sd_diskio.cpp:126] sdSelectCard(): Select Failed
Card Mount Failed

After changing the timeout:

[    14][W][sd_diskio.cpp:186] sdCommand(): token error [59] 0x5
SD Card Type: SDSC
SD Card Size: 1947MB

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions