# How to get max. throughput form SPI FLASH memory?

I have a number of arrays that are going to get stored on an external FLASH IC.

1. The data from each array is read in ascending index order. So I might read index 0, 1, 10, 12... but never 0, 1, 12, 10.
2. The arrays are different in length.
3. After the array was read to it's end, it starts all over again.

During normal operation, about 353,600 bytes will be read per second from the FLASH to the MCU. With SPI Clk @ 4MHz this would take 88.4msec which leaves time for the MCU do to other things.

In fact there's a command byte + 3 address bytes on top of every transfer. This overhead makes the said transfer unrealistic.

Most of these SPI FLASH devices, such as the W25X40CLSVIG TR I'm about to use, have a hardware feature called hold. One can halt the transfer and resume it without having to re-send a commands & address.

If we'll assume there're 10 arrays, one could arrange the data on the FLASH like so:

array0[0] ,array1[0]..., array9[0], array0[1], array1[1]...


This would solve some of the issues because I'll have a much lower overhead, but after the 1st pass of the shortest array I'll be facing the same problem again.

Does anyone have a suggestion how to implement a solution that might make the transfer possible?

• What are you trying to do? And w.r.t. 4MHz this would take 88.4msec which leaves time for the MCU do to other things. - you can use DMA transfer to let the MCU to do the other things freely. – Eugene Sh. Oct 23 '17 at 17:38
• Which MCU? Why is the SPI clock limited to 4MHz? – Bruce Abbott Oct 23 '17 at 19:04
• My MCU does not have DMA, I would need to upgrade in order to have that. If that's the only solution I might go with that. The clock speed is set by the current external clock, it can go higher but will require a hardware modification which will be done only if no choice. – user34920 Oct 23 '17 at 23:25
• Interesting... so you're going to write these arrays to the flash and then read them over and over again, like non-stop? I don't want to question your design, but I'm questioning your design lol. – DigitalNinja Oct 24 '17 at 0:19
• @DigitalNinja yes that's basically it. I don't have enough RAM (or code space) inside the MCU to store the data, that is why I need to fetch it from external memory. – user34920 Oct 24 '17 at 1:16