2022-03-17 02:19 AM
I am trying to write in the SD card in polling mode and it works successfully first two time and when i try to open the same file and write to it is fails and stuck at function " HAL_SD_ReadBlocks " at file stm32h7xx_hal_sd.c at the following condition:
if(((HAL_GetTick()-tickstart) >= Timeout) || (Timeout == 0U))
2022-04-05 04:52 AM
Hello @KhalieAli ,
Welcome to our ST Community :smiling_face_with_smiling_eyes:
In order to allow a better analysis of your problem, could you please share the project file to reproduce this issue, so that we can give you an answer.
Thanks in advance.
BeST Regards,
Walid
2022-04-05 11:43 PM
Hello @Walid ZRELLI
using generated APIs at "sdmmc.h" and "fatfs.h" i call MX_SDMMC1_SD_Init(); MX_FATFS_Init(); in the initialization
if(f_mount(&FatFsSystem, (TCHAR const *)SYSTEM_PARTITION, 0) == FR_OK)
{
// Open file HelloWorld
if(f_open(&elffile, "LogFile.txt", (FA_CREATE_ALWAYS | FA_WRITE )) == FR_OK)
{
char myData[] = "Hello Bent, It is Workking now \nthanks, it is me khalid";
f_puts(myData,&elffile);
f_close(&elffile);
}
}
it success first time but when i call this code at the second time it stuck waiting time out which is very large number and when i decreased it the SD card read write operation never worked
thanks in advance
2022-04-06 01:25 AM
Hello @KhalieAli ,
You can refer to the following example provided in the H7 firmware package:
This may help you.
BeST Regards,
Walid