-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sdmmc_write_sectors
and sdmmc_read_sectors
will cause failure with 0x109 for all successive calls if it was called with n_sectors
=0 (IDFGH-9203)
#10593
Comments
sdmmc_write_sectors
and sdmmc_read_sectors
will fail with 0x109 for all calls it it was called with n_sectors
=0sdmmc_write_sectors
and sdmmc_read_sectors
will cause failure with 0x109 for successive all calls if it was called with n_sectors
=0
sdmmc_write_sectors
and sdmmc_read_sectors
will cause failure with 0x109 for successive all calls if it was called with n_sectors
=0sdmmc_write_sectors
and sdmmc_read_sectors
will cause failure with 0x109 for successive all calls if it was called with n_sectors
=0 (IDFGH-9203)
Can you show some example code of what you have in mind? IMO usually you want to fail fast or succeed. |
@chipweinberger Yes, I would expect exception or assertion if |
Hi! Thanks for the report. We are discussing |
Hi @adokitkat. Thanks for your response! Actually, the return value when
|
Since the Would you be able to post your whole log output and sdkconfig file here please? Here is a part of code which could be responsible. I suspect a wrong/corrupt SD command is being sent when sdmmc_command_t cmd = {
.flags = SCF_CMD_ADTC | SCF_CMD_READ | SCF_RSP_R1,
.blklen = block_size,
.data = (void*) dst,
.datalen = block_count * block_size
};
if (block_count == 1) {
cmd.opcode = MMC_READ_BLOCK_SINGLE;
} else {
cmd.opcode = MMC_READ_BLOCK_MULTIPLE;
}
if (card->ocr & SD_OCR_SDHC_CAP) {
cmd.arg = start_block;
} else {
cmd.arg = start_block * block_size;
}
esp_err_t err = sdmmc_send_cmd(card, &cmd); |
@adokitkat It has been a while since I have workarounded this issue. I need some time to reproduce the problematic project. I will provide it these days. By the way, is the problem reproducible on your test board? I am not quite sure if this problem is common for different SD Cards. |
sdmmc_write_sectors
and sdmmc_read_sectors
will cause failure with 0x109 for successive all calls if it was called with n_sectors
=0 (IDFGH-9203)sdmmc_write_sectors
and sdmmc_read_sectors
will cause failure with 0x109 for all successive calls if it was called with n_sectors
=0 (IDFGH-9203)
Answers checklist.
IDF version.
v5.1-dev-2669-gd152d007c6
Operating System used.
Windows
How did you build your project?
Command line with idf.py
If you are using Windows, please specify command line type.
PowerShell
Development Kit.
ESP32-S3-WROOM-1-N16R2
Power Supply used.
USB
What is the expected behavior?
If sdmmc_write_sectors and sdmmc_read_sectors do not support the argument
n_sectors=0
, it should be asserted or return error instead of making all successive call mysteriously broken.What is the actual behavior?
When sdmmc_write_sectors and sdmmc_read_sectors are called with n_sectors=0 all successive to these call will result in error 0x109 (CRC error) or 0x107 (Timeout). These are very misleading error and caused very difficult debugging process.
Steps to reproduce.
Write or read SD card with n_sectors=0 when invoking sdmmc_write_sectors or sdmmc_read_sectors
Debug Logs.
No response
More Information.
No response
The text was updated successfully, but these errors were encountered: