2018-04-02 08:35 PM
Hi.
At the first time, SDIO works well but 10~20 minutes later, when i try to open a file(FA_CREATE_NEW | FA_WRITE options), there is no answer for 30 seconds and then SDIO does not work anymore after being shown FR_DISK_ERR.
Through debugging, I found that SDIO doesn't work as soon as the osMessageGet called on SD-Write function (osMessageGet result is osEventTimeout).
This problem disappears when the SDIO clock speed is lowered (ClockDiv is 8 or more). However, the Read/Write speed get very slow too much than i want.
STM32F429 use
CubeMX 4.25.0
STM32CubeF4 Firmware Package v1.21.0
FreeRTOS 9.0.0 (CMSIS 1.02)
FatFS R0.12c
SDIO Settings (DMA used)
2019-03-24 11:38 AM
Standard board or something custom? USART and pins usable for diagnostic output? Which?
2019-03-24 11:48 AM
USART2 with DMA and a lot of circular buffering - no delays for waiting flushing through USART ... flushing buffers from main cycle ...
standard boards mostly include debug support ... and i didn't use any standard board all the time i'm working with STM32F1/F4
and on my board i'm using HSE 12MHz
2019-03-24 02:52 PM
after additional investigation and testing i found that there is register DTIMER, and for each transfer is initialized with constant : SDMMC_DATATIMEOUT , value: 0xFFFFFFFFU
which means (2^32 - 1) / 48MHz = 89.5 -> 89.5 * 2 = 179seconds = 3 minutes ...
after deducting DTIMER register to zero SDIO is raising interrupt DTIMEOUT ... and this interrupt is processed as "Data Transfer abort" in IRQ Handler ... even if there is no transfer in progress ...
so probably developers in ST forgot to handle DTIMER register after successful transfer ... which cause Aborting transfer that already finished before 179seconds ...
if this message is read by ST's develpers , then please fix the bug in HAL ...
Kind regards,
2019-06-21 08:17 AM
@Kim KyungTack, I am facing exactly the same problem as you describe in start of this post, I am getting lost on how to solve it. Did you solve it during this period (I see that you wrote this question more than a year ago). If there is any solution with it - please let me know. Thank you.
2019-06-23 05:10 PM
@Evgeniy Vasyliev . I do not know exactly why, but it does not appear after updating "CubeMX" and "packages". I'm sorry I can not help you much.
2019-09-30 04:50 PM
I had a similar issue (doesn't quite seem the same though).
The fix in this post solved my problem. (see the post near the bottom by Hockuba.Krzysztof October 12, 2018 at 8:06 AM)
https://community.st.com/s/question/0D50X00009XkeZ4SAJ/stm32l4-sdmmc-command-timeout?t=1569885552908
2020-04-30 11:47 PM
Sir
Can you share config in stmcubemx and source code, please...
I can mount the sd card, but can't create a file
my code like this
if(f_mount(&SDFatFS, SDPath, 0) != FR_OK){
printf("Failed to mount sd card\n");
}else{
printf("mounting sd card successfully\n");
if(f_open(&SDFile, "test.txt", FA_CREATE_ALWAYS | FA_WRITE) == FR_OK){
printf("File has created\n");
}else{
printf("Failed to create file\n");
}
}
thanks sir
2020-05-01 03:37 AM
Sorry not using CubeMX
Probably not an issue with top level code, need to review interface level code.
2020-10-01 04:44 AM
Hi @developer2 !
Have you managed to make any workaround?