Skip to main content
voyvoda .
Senior
August 15, 2018
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
January 10, 2021

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
October 16, 2020

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

PDChauhan
Visitor II
October 19, 2020

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
October 30, 2020

Hello All,

Is there any input / hint for my above observation?

Thanks.

voyvoda .
voyvoda .AuthorBest answer
Senior
January 10, 2021

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
February 27, 2024

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

with stm32f407vg.