Skip to main content
William F
Associate
March 22, 2022
Solved

[SOLVED] After the instruction MX_TouchGFX_Init(), FATFS methods do not work as wanted (STM32F469I-DISCO)

  • March 22, 2022
  • 1 reply
  • 1356 views

When I'm using TOUCHGFX and FATFS together, I can create/write/read a file in my SD only if I do it before "MX_TouchGFX_Init();"

f_mount(&SDFatFS, (TCHAR const*)SDPath, 0);

f_open(&SDFile, "DIO.TXT", FA_CREATE_ALWAYS | FA_WRITE); //with TGFX this one gets FR_DISK_ERR

f_write(&SDFile, wtext, sizeof(wtext), (void *)&byteswritten);

f_close(&SDFile);

f_mount(NULL, (TCHAR const*)SDPath, 0);

Not sure if this can be helpfull but the only difference I notice it's that when I debugging:

  • If there is MX_TouchGFX_Init();, after f_mount(), FatFs gets the value : 0x2000a6a4 <SDFatFs>
  • In other case, FatFs is equal to the value : 0x2000a2fc <SDFatFs>

 0693W00000KdYSvQAN.png0693W00000KdYSgQAN.pngDo you know if there is something I can do to make them working well after with the graphic application?

Thank you

EDIT: I resolve it. I suppose because MX_TouchGFX_Init() is written in C++ inside that the FATFS methods could not be read in C so I put it inside a task and it works!!!

0693W00000KdaPPQAZ.png 

This topic has been closed for replies.
Best answer by Amel NASRI

See Edit section for the solution, thanks @William F​ for sharing it.

-Amel

1 reply

Amel NASRI
Amel NASRIBest answer
ST Technical Moderator
March 31, 2022

See Edit section for the solution, thanks @William F​ for sharing it.

-Amel

To give better visibility on the answered topics, please click on "Best Answer" on the reply which solved your issue or answered your question.