Suggestion for external SPI NAND Flash Library

photon
Tags: #<Tag:0x00007fe21eb00cb8>

#1

Guys,

I am looking for a library that supports external SPI NAND flash read and write. I am a newbie to this. I could find libraries for the external SPI NOR flash library. Can I use the same for NAND too?

Cheers!


#2

@Rahul_G, is there a reason you want to use NAND vs NOR? Can you give more details on how you expect to use the external flash?


#3

Thanks for the response @peekay123. This is our client suggested type. The external flash is used to store data when the device is offline and unable to publish data. We will be storing data once in every 15 seconds if the device is offline. The memory used will be very low as we are storing the sensor data which is double type and time in unix.

The cost for 128MB NAND is low compared to NOR. Should we switch to NOR?


#4

@Rahul_G, NAND flash is typically used in SD storage devices and is quite different from NOR flash. There are not many SPI NAND flash libraries available it seems with the exception of FatFs which seems to support NAND. If you want to use a microSD (vs an onboard chip), you could use the SDFat library. For SPI NOR memory, you could use SPIFFS which provides both a file system capability and wear-leveling to increase flash lifetime.

Note, that with no file system or wear leveling, a 1MB flash device and store 15 days of data at the interval and size you indicated. How much offline storage do you really need?


#5

@peekay123 15 days of storage seems plenty for us. Thanks for pointing me in the right direction. I will look into the SPIFFS for SPI NOR memory.

Are there any specific reasons why people choose NOR memory if it uses for writing raw data?


#6

@Rahul_G, NOR is faster than NAND storage and supports continuous and random access. Note that SPIFFS and FatFs do require storage overhead to store their file control structures. However, a 16Mb (2MB) NOR will likely work just fine for your application.


#7

Thanks for the help @peekay123. Really appreciate it!


#8

Hey @peekay123, what you mean by this:

NOR supports continuous and random access

Does this mean we can access NOR like we access EEPROM? If so, do I need to access NAND sequentially by the address? Could you please provide some more details regarding this?
Cheers!


#9

@Rahul_G, NOR cannot be treated like EEPROM. Once bits in a byte are flipped from 1 to 0 the byte must be erased to reset it to all ones. The catch is that erases can only be done in “sectors” which are typically 4KB to 64KB in size. This makes wear leveling trickier. With an EEPROM you can erase single bytes.

I suggest you read about flash memory types on Wikipedia. You will find that NAND is typically more difficult to interface with than NOR and I have not found any libraries for driving SPI NAND flash.


#10

As always Thanks @peekay123. Let me go through the link you provided.