Skip to main content
voyvoda .
Senior
Aug 15, 2018 2:32 PM UTC
Solved

FatFs with SPI Flash porting on STM32 MCU

I would like to implement FatFs on my STM32 MCU with SPI Flash, W25Q16JV.

Is there a sample code for this? How can I port it ?

This topic has been closed for replies.
voyvoda .
voyvoda .Best answer
Senior
Jan 10, 2021 12:28 PM UTC

Hello, I am able write and read successfully.

change the line in "ffconf.h" file as below

#define _MAX_SS  4096

change the line in "spi_flash.h" file as below

#define FLASH_SECTOR_SIZE 4096

the attached file should be modified as well

20 replies

PDChauhan
Visitor II
Oct 16, 2020 9:43 AM UTC

it seems that Read Data in FatFs Flow and raw Flash data read outside FatFs are different!

PDChauhan
Visitor II
Oct 19, 2020 7:23 AM UTC

FAT header is stored in sector #63. When I read sector 63 at the end of f_mkfs (), it is found as expected. After that I call f_mount (). I have read sector 63 at the beginning of f_mount () and found that the data is 0xFF. There is nothing between f_mkfs () and f_mount () that should change the data of sector #63.

What can be the reason for this? How can the data of sector 63 is 0xFF inside f_mount ()?

Thanks and Regards.

PDChauhan
Visitor II
Oct 30, 2020 6:57 AM UTC

Hello All,

Is there any input / hint for my above observation?

Thanks.

voyvoda .
voyvoda .AuthorBest answer
Senior
Jan 10, 2021 12:28 PM UTC

Hello, I am able write and read successfully.

change the line in "ffconf.h" file as below

#define _MAX_SS  4096

change the line in "spi_flash.h" file as below

#define FLASH_SECTOR_SIZE 4096

the attached file should be modified as well

Associate II
Feb 27, 2024 4:51 AM UTC

Hello, I am not able to create file through fatfs in w25q64 in stm32cubeide

with stm32f407vg.