cancel
Showing results for 
Search instead for 
Did you mean: 

interface external flash to stm32 by fatfs

Amitkumar Pramanik
Associate
Posted on May 28, 2018 at 08:28

I am working stm32l031g6u6 controller and i  want to interface external flash using fatfs.

I refer the document by stm Implementation-of-FatFs-on-Serial-Flash- and tested the code but it's not working.

It showing error of FR_NO_FILE SYSTEM. i have modified the diskio.c file as per document but nothing work.

i have attached the main file and diskio.c file.

#flash #diskio #fatfs-not-working #flash-interface-fatfs #external-flash #stm32 #stm32lo #fatfs
3 REPLIES 3
Posted on May 28, 2018 at 12:09

Can't review file on phone. Blank media would need to be formatted using f_mkfs () make sure that and all the DISKIO functions complete without error.

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 28, 2018 at 14:45

 ,

 ,

Not sure what version of FatFs you're using but the syntax for f_mkfs() looks entirely wrong

http://elm-chan.org/fsw/ff/doc/mkfs.html

 ,

You want at least version R0.12c

uint8_t workBuffer[_MAX_SS],

 , , , , , /* ♯ ♯ -3- Create a FAT file system (format) on the logical drive ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ */

 ,

 , , , , , /* WARNING: Formatting the uSD card will delete all content on the device */

 ,

 , , , , , if(f_mkfs((TCHAR const*)SDPath, FM_ANY, 0, workBuffer, sizeof(workBuffer)) != FR_OK)

 ,

 , , , , , {

 ,

 , , , , , , , /* FatFs Format Error */

 ,

 , , , , , , , Error_Handler(),

 ,

 , , , , , }
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Amitkumar Pramanik
Associate
Posted on May 28, 2018 at 17:17

Hello Clive,

Thanks for your Reply.

Actually I am generating the code form STM32CubeMX tool and version is mentioned R0.11. Where I can found latest version of FatFs? I will check by updating the STM32CubeMX tool also. But it would be good if you can tell me the path where latest version is available.

I am working on Flash memory interfaced on SPI with STM32L0 micro-controller. So does this FatFs library use to implement File system for Flash memory?

I will also check your suggestions and will get back to you. Appreciated for your reply.

Thanks & Regards,

Amit