2024-09-02 12:58 AM
Hello, I have a question to ask regarding a problem with the STM32H7S78-DK card and using FatFS for an SD card, using RTOS.
I try to describe the problem in as much detail as possible.
I have my own application which includes TouchGFX among other things.
For managing the SD I used the files provided by ST for precisely my Discovery called ‘FatFs_uSD_RTOS’.
I took the part concerning SD management (SD card supplied in the purchase kit with the DK. SanDisk Ultra 32 GB formatted with FAT32) and adapted it to my code. It compiles without errors and so far so smooth.
However, the result I get is not what I wanted, as the file I wanted is not written to the SD. Debugging the code, the SD is recognised correctly, the f_mount in the fatfs.c code returns FR_OK, but when I execute the f_mkfs and then the f_open, I get the error FR_DISK_ERROR.
Analysing the call to ff.c even further I realise that the problem seems to be the disk_write. Everything else runs without any particular problems.
Do you have any idea what the problem might be and the possible solution?
I've also tried to visualise it on an oscilloscope to find out more about it, and I've noticed that the CLK on the SD goes, the CMD signal goes (when I plug and unplug the SD) while the data unfortunately is stationary.
I have read several other posts on the subject, even tried their solutions, but nothing (reducing speed, deinitialize SD, changing to another SD card)
Thank you.
2024-09-06 09:53 AM
Hello,
See this thread.
It could be related to the 1-bit / 4-bit initialization that you need to start with 1-bit mode then switch to 4-bit mode.
2024-09-11 07:48 AM
Hello,
Thank you for your time. That doesn't work. I have the same problem. It is related with the call of HAL_SD_init. In this HAL there is a call for HAL_Delay that cause an infinite loop since SysTick is defined by RTOS.
RTOS according to ioc file is initilized after MX_SDMMC1.
This cause the problem