FatFS f_write does not work
Function f_write doesn't work correctly to write on SD card. Actually it calls a series of other function and one of them is HAL_SD_WriteBlocks which puts the mcu into
Default_Handler:
Infinite_Loop: b Infinite_LoopThis is the code I have used to write a test string into a file:
FATFS fs;
FIL file;
uint8_t string[]='string';
UINT counter;
if(f_mount(&fs,SD_Path,1)==FR_OK){
if(f_open(&file,'root_f1',FA_WRITE|FA_CREATE_ALWAYS)==FR_OK){
f_write(&file,string,(UINT)sizeof(string),&counter);
}
}
f_close(&file);
f_mount(NULL,'0:',1);�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?
I have tried enabling and disabling every interrupts or DMA, changing sd clock, bus width. Does not make difference.
This is while reading from the SD Card works.
CubeMX ver: 4.0
CubeF7 ver: 1.7.0
MCU: STM32F746
#bug #stm32 #f