Serial flash (QSPI Nor flash) - expect sustained write throughput (datalogging)? - Page 1
Forum section: electronics / general

author: wb0gaz
author_rank: Frequent Contributor
timestamp: February 07, 2022, 02:36:29 am
content: I'm looking at QSPI Nor flash (typical 8-pin devices found on PC motherboards - Winbond is one of a number of suppliers) for a (relatively) low speed data logging application (10K-100K bytes/sec typical sustained). The only write timing information I can find in (Winbond) datasheets suggests typical page (256 byte) write times of 400-750 nSec; max time of 3 milliseconds. This is within order of magnitude of my expected sustained data logging throughput requirement.In lieu of experimentation, could anyone shed any light on expected writing throughput (ideally, bytes/second min/typ/max) and what factors influence that figure? Is there anything to go on beyond the AC characteristics in the (Winbond) data sheets for which I cited specs above?I'm looking in particular for anyone that's had hands-on experience with these devices as a persistent data storage device (rather than something just to push a code image into once at manufacturing time.)Thanks for any advice!

author: NorthGuy
author_rank: Super Contributor
timestamp: February 07, 2022, 04:18:19 am
content: There's transmission time necessary to pass the data to flash. It depends on the mode and speed. For example, 256-byte block with 50 MHz SPI mode will take roughly 40 us, while QSPI mode at 100 MHz will only require 5 us.Then there's write time, which is much longer. In my experience, it is roughly 0.5 to 1 ms.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: February 07, 2022, 05:25:10 am
content: If this is sustained, another factor to include is the erase time, for the second and subsequent pass thru's, as you will need to erase old data. before you write new page.The MAX erase times could mean you need reasonable buffering for your sustained stream - either an additional SRAM or FRAM may be needed ?

author: wb0gaz
author_rank: Frequent Contributor
timestamp: February 07, 2022, 01:23:07 pm
content: Thanks for both replies - that's helpful.I don't plan to erase during running of data capture; the memory will begin bulk-erased, then won't be overwritten until a separate read-out phase, so the plan is that writes to the flash will only be to erased sectors. I'm thinking that will reduce the variables involved, as the chip should not need to erase a sector prior to writing to it.I do plan a circular buffer in the microcontroller (size TBD) which will accommodate near-term fluctuations in write throughput, so that's why I was mostly focusing on what can be obtained over a relatively long period of writing, on average (there's a 4:1 or worse ratio between typical and max write duration in the datasheets I've seen.)The bus speed certainly would impact latency, but I'm thinking (although it's not clear) that write/erase timing is more constrained by internal processing (the chip going "busy" while writing) than the bus speed.The behavior of these parts (which I've never made use of before) from a write perspective seem somewhat like generic USB flash drives, which are very slow to write, but reasonably fast to read (such as those "USB3" flash drives that write data really really slow).

author: NorthGuy
author_rank: Super Contributor
timestamp: February 07, 2022, 04:22:39 pm
content: Quote from: wb0gaz on February 07, 2022, 01:23:07 pmFlash is a flash.

author: voltsandjolts
author_rank: Unknown
timestamp: February 07, 2022, 04:38:18 pm
content: Quote from: wb0gaz on February 07, 2022, 02:36:29 amSo, are you looking for 2560 bytes every 3ms, or about 850KiB/sec?

author: wb0gaz
author_rank: Frequent Contributor
timestamp: February 07, 2022, 05:17:59 pm
content: If it completes 256 bytes writing in 3 milliseconds (what the datasheet says is max time to write 256 byte sector), then that is I think 85 kbytes/second (256/.003) which is "good enough" for the proposed application in sustained writing mode. If I have the calculation wrong, then of course my assumption may be wrong too!A ring buffer would accept application data (for logging) then deliver 256-byte writes to the memory as fast as the memory would accept. If the ring buffer ends up overflowing, that would be the hint that either the process isn't adequate or the memory throughput isn't adequate. If the ring buffer ends up underflowing, then that is not a problem because no writing would be done until the ring buffer again has 256 bytes.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: February 07, 2022, 07:30:52 pm
content: Quote from: wb0gaz on February 07, 2022, 01:23:07 pmYou can easily calculate using both numbers,eg a rough idea at 1MHz is (3m+260*8*1u) = 5.08msand at 10MHz (3m+260*8*0.1u) = 3.208msDataflash parts from adesto, have dual page buffers, so you can fill one while it writes from the other, but they have size limits.Larger FLASH parts can be fastereg I see MX25L51245G (3V, 512M-BIT [x 1/x 2/x 4]) specs Page Program Time ~0.25 < 0.75 ms (256 bytes)So that becomes just on 1ms at 10MHz

author: wb0gaz
author_rank: Frequent Contributor
timestamp: February 07, 2022, 07:40:02 pm
content: Thank you, PCB.Wiz!I had planned 12 MHz SPI clock (as that's the highest speed the host processor will support SPI). As the datasheet is silent about double buffering, I think your analysis applies directly, which is that data transfer and writing are sequential. So, the solution has little "headroom" beyond my expected requirements, but those requirements are somewhat flexible. Still, this is very good learning experience.I looked at FRAM but it seems capacity is much less. There are some yet-larger 8-pin QSPI flash devices, but in surveying datasheets so far the write throughput only appears to improve marginally. It appears these things were probably intended for PC Motherboard BIOS storage which is basically EPROM replacement.Another option might be a micro-SD card (Sandisk has some that are "Application" rated, and work reasonably well as storage for a virtual machine running Windows 10 or Ubuntu Linux, so I think they have some internal RAM for buffering).Thank you again,Dave