-
Notifications
You must be signed in to change notification settings - Fork 157
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 Data End Interrupt sometimes does not occur #94
Comments
Hello @by-gnome, Thank you for the report. Regarding the issue, I tested an application with STM32L496G-Disco and work just fine, it's under However, I will share your proposal to our team in order to analyze it. In the meanwhile, I will try to investigate more and test an example using your config, especially as you mentioned Just a few questions, if you may:
With regards, |
The project runs on a custom board. |
To localize the problem I modified the SD_DMATransmitCplt() and SD_write() as follows:
When timeout, the variables contain the following values:
It might be a hardware issue with SDMMC_MASK register. |
ST Internal Reference: 196054 |
Hello @by-gnome, The issue is reported internally. Just if you may, we want to know the type and specification of the SD card used in your project. With regards, |
Hello @KRASTM 32GB ADATA Premier microSDHC UHS-I Class10 (AUSDH32GUICL10-R) |
Describe the set-up
The device based on STM32L496VG with high load application. ICCARM v8.32, STM32Cube_FW_L4_V1.18.1.
Describe the bug
Writing to an SD memory card using SDMMC+DMA sometimes times out in the SD_write() function. This happens because the DATAEND interrupt does not occur.
After some debugging I found that the SD_DMATransmitCplt() function enables the DATAEND interrupt by setting the DATAENDIE bit, but interrupt does not occur, and after the timeout in the SD_write() function the DATAEND bit is set and the DATAENDIE bit is not set.
How To Reproduce
SDMMC parameters:
The application writes data to the SD card for 12-24 hours, with a data rate of 128 kB/s. After writing several gigabytes of data, a timeout occurs in the SD_write() function.
Additional context
Let's consider the SD_DMATransmitCplt() function:
In case of abnormal operation, before setting DATAENDIE, the SDMMC_STA register has the state 0x00105400:
TXDAVL = 1, TXFIFOHE = 1, TXACT = 1, DBCKEND = 1 or 0 (doesn't matter)
and SDMMC_MASK register has the state 0x00000000 !!!
After setting DATAENDIE, the SDMMC_STA register has the state 0x00105400:
TXDAVL = 1, TXFIFOHE = 1, TXACT = 1, DBCKEND = 1 or 0 (doesn't matter)
and SDMMC_MASK register has the state 0x00000100:
DATAENDIE = 1
After timeout in SD_write the SDMMC_STA register has the state 0x00000500:
DBCKEND = 1, DATAEND = 1
and SDMMC_MASK register has the state 0x0000001A:
TXUNDERRIE = 1, DTIMEOUTIE = 1, DCRCFAILIE = 1
The correct values in the SDMMC_MASK register are 0x0000001A and 0x0000011A. Therefore, it can be assumed that in the SD_DMATransmitCplt() function, reading/writing the SDMMC_MASK register is sometimes disrupted.
Possible solution
If I set the DATAENDIE bit in the HAL_SD_WriteBlocks_DMA() function, the problem does not occur.
The text was updated successfully, but these errors were encountered: