cancel
Showing results for 
Search instead for 
Did you mean: 

SD(FATFS) cannot work with STemwin

pinxian wu
Associate
Posted on April 29, 2017 at 07:40

Hi , all:

I use STM32CubeMx to generate MDK V5 project for my stm32f746g-discovery board.

I found I can't use the SD  with FATFS after add STemwin Lib to my project , but it works fine only if  i just use SD and  LTDC without STemwin.

I've already set my stack size to 0x2000,and it still dont work!!

Does anyone have the same problem? or can someone  help me to build a project ?

#stemwin-stm32f746discovery
6 REPLIES 6
Posted on April 30, 2017 at 22:44

The stack size is not the answer to most problems, review the IRQ and DMA utilization, that the appropriate vectors are correctly named and bound, that the priority/preempt levels are suitable, and HAL doesn't block unnecessarily.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 02, 2017 at 06:48

HI Clive One :

Thank you for your reply!! i'll try SD DMA approach later.

Posted on May 05, 2018 at 02:19

Hi Pinxian wu, do you found what is the problem? I also faced the same problem at the moment and i couldnt figure out what could be the cause?

I use STemWin with the USB FATFS (demofile as template) then I change the FATFS to use SDMMC as storage. But, it does not work out. It either the FATFS working STemWin failed to works or SD FATFS failed and STemWin failed. I was so curious why ST example library file nvr includes the SDMMC and STemWin under single project? Could it be resource constrain in order to combine SDMMC with STemWin together? 

Overnature
Associate II

I encountered a similar problem on the STM32F746G-Discovery. CubeMX 4.27.0 / 1.12.0. FatFs started working only if the GRAPHICS_Init () function was removed.

The problem disappeared when I turned off the data cache

SCB_DisableDCache ();

at the beginning. It is not clear how this is related, but everything works now.

FATFS/SDMMC will work well if the buffers are held in the DTCMRAM, otherwise you'd need to manage cache coherency is actively, or via MPU configuration.

Turning off the cache for everything seems like a good way to limit system performance.

See ENABLE_SD_DMA_CACHE_MAINTENANCE in sd_disk_io_dma_template.c

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thank you! With this option everything works well.

Data and instructions caches and MPU are enabled.

STemwin and FatFs tasks stack size are 1024 words both, heap_4.