cancel
Showing results for 
Search instead for 
Did you mean: 

FATFS + RTOS + touchgfx

EthanMankins
Senior

I have a working project that simply writes to a a file on an SD card (Using STM32H7B3I-DK, Not Using RTOS).

When I add it to a touchgfx project, f_mount() and f_open() return NO_FILE_SYSTEM. This happens even after f_mkfs() returns FR_OK. I have the following parameters:

  • Freertos - task : stack 512 (words)  Priority : osPriorityRealtime
  • Project manage - linker settings Minimum Heap Size : 0x1000
  • Project manage - linker settings Maximum Heap Size  : 0x1000
  • FATFS - SDMMC instance : SDMMC1 Use DMA template - Enabled
  • SDMMC1 - Use clock divide factor : 2

There is no DMA Settings tab in SDMMC1, is this an issue?

EDIT: I have tried it with just RTOS and FATFS and It works... The issue occurs when touchgfx is in the project

1 ACCEPTED SOLUTION

Accepted Solutions
EthanMankins
Senior

@GaetanGodart , @Andrew Neil 

I discovered that the issue was occurred only when touchGFX was part of the project. I found another post and copied in their solution and It works:

 MPU_InitStruct.Number = MPU_REGION_NUMBER3;
  MPU_InitStruct.BaseAddress = 0x24000000;
  MPU_InitStruct.Size = MPU_REGION_SIZE_512KB;
  MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
  MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE;
  MPU_InitStruct.IsBufferable = MPU_ACCESS_BUFFERABLE;

 Why this is the issue? I don't know.

Could you explain how this was causing a NO_FILE_SYSTEM error in FATFS?

View solution in original post

6 REPLIES 6

Don't forget to mark the solution on your previous thread:

https://community.st.com/t5/stm32-mcus-embedded-software/fatfs-failure-with-freertos/td-p/750161

 


@EthanMankins wrote:

f_mount() and f_open() return NO_FILE_SYSTEM. 


So step into those functions and see why they do that.

Compare & contrast with your working version ...

@Andrew Neil , sorry forgot to mark prev thread...

The code I put in regard SD card is the same, the only difference is the new one has RTOS.

I have found  a very weird behavior. If I place a breakpoint on the following line in find_volume() and then click resume once it hits it, f_mount() works fine:

(line 3060) fmt = bsect ? check_fs(fs, bsect) : 3;	/* Check the partition */

This makes me think there's some sort of timing issue... not sure how to fix it though since I have already given this task Realtime priority


@EthanMankins wrote:

This makes me think there's some sort of timing issue... 


Indeed.

 


@EthanMankins wrote:

not sure how to fix it though since I have already given this task Realtime priority


But the fact that a breakpoint "fixes" it suggests that the problem is with going too fast - not too slow.

Instrument the code so that you what's happening - in both cases.

Do you have a logic analyser to see what's actually happening on the wires?

 

Hello @EthanMankins ,

 

If you have a delay issue, you could try to fix it by introduce a small delay before calling the file system initialization functions to allow sufficient time for the system to stabilize.

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)
EthanMankins
Senior

@GaetanGodart , @Andrew Neil 

I discovered that the issue was occurred only when touchGFX was part of the project. I found another post and copied in their solution and It works:

 MPU_InitStruct.Number = MPU_REGION_NUMBER3;
  MPU_InitStruct.BaseAddress = 0x24000000;
  MPU_InitStruct.Size = MPU_REGION_SIZE_512KB;
  MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
  MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE;
  MPU_InitStruct.IsBufferable = MPU_ACCESS_BUFFERABLE;

 Why this is the issue? I don't know.

Could you explain how this was causing a NO_FILE_SYSTEM error in FATFS?

Hello @EthanMankins ,

 

I am glad you found a solution!

I am not an expert at FATFS but I assume that TouchGFX changes the MPU settings and that FATFS require specific MPU settings that got changed by the TouchGFX TBS setup.

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)