Skip to main content
tau
Associate III
June 27, 2016
Question

CubeMX 4.1.5 + F7 1.4.0 + FatFS SD

  • June 27, 2016
  • 1 reply
  • 653 views
Posted on June 27, 2016 at 11:18

Trying to get a project with the subject line working in SW4STM32.

However, if I try the fmount function with 0 (mount later), then fopen on a file, I get a not ready error. The same if I specify fmount with 1 (mount now)

I've read the app note for FatFS on ST parts and implemented as directed, but I've got various errors including command response timeout when initialising the card. I've tried different cards too - a 4GB and a 64GB uSD card.

Can anyone suggest any errors in the following CubeMX generated code I've modified:

  /* Initialize all configured peripherals */

  MX_GPIO_Init();

  MX_SDMMC1_SD_Init();

  /* USER CODE BEGIN 2 */

  BSP_SD_Init();

// Fatfs sanity check code

  /* Register work area to the default drive */

  fr = f_mount(&FatFs, SD_Path, 1); // Mount immediately

  /* Open a text file */

  fr = f_open(&fil, ''message.txt'', FA_READ);
    This topic has been closed for replies.

    1 reply

    Walid FTITI_O
    Visitor II
    June 28, 2016
    Posted on June 28, 2016 at 15:52

    Hi Turboman,

    Try to do like the following implimentation example

    char SDPath[4]; 
    f_mount(&SDFatFs, (TCHAR const*)SDPath, 0)

    I recommend that you take a look to the ''FatFs_uSD'' example in

    http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubef7.html

    package at this path: STM32Cube_FW_F7_V1.4.0\Projects\STM32F769I_EVAL\Applications\FatFs\FatFs_uSD -Hannibal-