cancel
Showing results for 
Search instead for 
Did you mean: 

sd card not working with touchgfx

JNova.0
Associate III

Hi, I tried the example on formatting the sdcard and it works (https://www.youtube.com/watch?v=I9KDN1o6924).

How do I implement this with TouchGFX? I set everything the same and mount the SD card (f_mount), but the next command is no longer executed (f_mkfs) and the system stops working. I tried to compare the settings and everything is the same. Can anyone think of anything? Thank you

4 REPLIES 4

What's the actual error returned, by either FATFS or the DISKIO layer?

Getting some overrun? Caching Issue? Polled? DMA? IRQ Handler?

I'm not watching a video to unpack what you've implemented.

Which STM32?

I'd avoid f_mkfs, and frankly and write command, until you've debugged the issue.

Cards come optimally formatted, with awareness of the underlying block erase size of the array. I'd avoid reformatting cards unless you've irreparably trashed the file system data.

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

f_mkfs is a very time consuming operation if you are using a large SD card, it can be in the order of a few seconds (even using 4-bit mode with DMA on a 128GB card)... this should only need to be done once to format the drive and can then be omitted.

If you are running this on the same task as TouchGFX then it would probably lock up for a while, and maybe not recover. Also check the task stack size, if you are using FatFS and TouchGFX in the same task you may need to increase this.

Aside from that more information is required, do you end up in a fault handler? If you pause execution where is the code getting stuck? Maybe confirm interrupt priorities are as they should be.

Anthony

JNova.0
Associate III

the code needs to be put in the task. Either to the DefaultTask or to the one specially created for the sd card.

JN

Well none of the peripherals, card or file system are multi-thread/task safe, so yes do the processing end-to-end in one task/thread, or arbitrate ownership via a mutex or semaphore.

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