2017-02-25 02:02 PM
Everybody,
Why isn't my f_open working properly ?
I tried the example from UM1718 but stack on f_open.
Is SDIO initialized properly ?
here's the code :
/TEST SDIO begin
if(retSD == 0) { printf('inside if retSD \n'); HAL_GPIO_WritePin(GPIOE, GPIO_PIN_6, GPIO_PIN_RESET); HAL_Delay(1000); /*♯♯-2- Register the file system object to the FatFs module ♯♯♯*/ if(f_mount(&SDFatFs, (TCHAR const*)SD_Path, 0) != FR_OK) { /* FatFs Initialization Error : set the red LED on */ HAL_GPIO_WritePin(GPIOE, GPIO_PIN_5, GPIO_PIN_SET); HAL_Delay(100); HAL_GPIO_WritePin(GPIOE, GPIO_PIN_5, GPIO_PIN_RESET); printf('FMOUNT FAIL! \n'); while(1); } else { printf('inside else on f_mount \n'); printf('f_mount OK! \n'); HAL_GPIO_WritePin(GPIOE, GPIO_PIN_5, GPIO_PIN_SET); HAL_Delay(1000); HAL_GPIO_WritePin(GPIOE, GPIO_PIN_5, GPIO_PIN_RESET); // it's stopped here res = f_open(&MyFile, 'hello.txt', FA_CREATE_ALWAYS | FA_WRITE); printf('after res command!');I diagnosed from serial :
inside if retSD
inside else on f_mount f_mount OK!Anyone can help please ?
Thanks
#fatfs-sdio #sdio #stm32f1032017-02-25 02:03 PM
The code is based from UM1718 page 194
2017-03-01 03:10 AM
Hi,
You may refer and get inspired from one of the provided FatFS applications with STM32CubeF1 firmware package. Compare your generated code with working example as this one: STM32Cube_FW_F1_V1.4.0\Projects\STM3210C_EVAL\Applications\FatFs
May this
can helps you.Imen
2017-03-01 02:29 PM
I got it work already,
changing the SDIO init speed will fix it.