Skip to main content
Vijay1
Associate II
August 24, 2020
Question

Data Logger using STM32L0 and SPI Nor Flash file system

  • August 24, 2020
  • 3 replies
  • 2031 views

Hi All,

I am trying to make data-logger using STM32L0, I application demands to store 2Mb data in .txt and .CSV format for that I am using SPI NOR Flash by Winbond W25Q32JV. I have never used SPI Nor Flash before and new to the file system.

Please help me how I can implement file system.

This topic has been closed for replies.

3 replies

KnarfB
Super User
August 24, 2020

STM32 + W25Q NOR flash has been done before. There are drivers around, search the internet. NOR flash with file system is unusual because SPI NOR are unmanaged flash chips. Those are also not removable chips, so I don't see the need for a file system. But, that has also been done before. Who is reading the files and how? STM32 + file system + removable SD-card?

Tesla DeLorean
Guru
August 24, 2020

The NOR has 4KB erase blocks, so probably want to configure your files system to use that size.

Would suggest you review data sheets and

Write SPI access routines.

Test command interactions with the SPI NOR. Perhaps JEDEC READ ID, and READ BLOCK type commands.

Move on to ERASE BLOCK, and WRITE BLOCK commands.

Test that you can read/write assorted blocks to the NOR device, confirm you can do this successfully, and retrieve exactly the data you wrote previously.

Examine file systems, perhaps looks at FATFS, depends a lot on what you want to do, how many files you expect, if you connect to a PC or not.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Vijay1
Vijay1Author
Associate II
August 25, 2020

Thanks @KnarfB​ and @Community member​ for the suggestion.

The device I am going to connect with USB and retrieve the data from the memory.

I have written the low level SPI driver to communicate with NOR Flash. Till I am able to read , write, erase the raw data in the memory.

Now I Implementing the FATFS, but problem I am facing with NOR flash is to write any new data or rewrite I have to erase the block which is erasing my whole data

so I am not sure how to handle that. FATFS do many read write for even opening and closing of file.

Tesla DeLorean
Guru
August 25, 2020

You'd want to tell FATFS to use 4KB blocks

Yes, there will be a lot of interaction for and open/write, this type of flash isn't particularly fast either.

The alternative would be a journalling type file system, that can incrementally write, with less read-erase-write cycling.

This might be more of a struggle on an L0 system as resources tend to be finite.

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