Skip to main content
antonius
Associate III
February 25, 2017
Question

FATFs f_open ?

  • February 25, 2017
  • 3 replies
  • 659 views
Posted on February 25, 2017 at 23:02

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 #stm32f103
This topic has been closed for replies.

3 replies

antonius
antoniusAuthor
Associate III
February 25, 2017
Posted on February 25, 2017 at 23:03

The code is based from UM1718 page 194

ST Technical Moderator
March 1, 2017
Posted on March 01, 2017 at 12:10

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

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
antonius
antoniusAuthor
Associate III
March 1, 2017
Posted on March 01, 2017 at 22:29

I got it work already,

changing the SDIO init speed will fix it.