- Thu Sep 04, 2014 4:32 pm
#193
OK, let's reconsider something about Flash memory access: first, the XTensa CPU seems to be clocked @ 80 MHz. It is fast, but nothing compared to more powerful WiSoC running at 400~800 MHz.
Then these Flash SPI chips can also run pretty fast... Not only do they support "simple" single bit wide SPI access, but also dual and quad bit wide access, at speed reaching 80~104 MHz!
I found something prety interesting in
Winbond's W25Q16CV 16M-bit Serial Flash Memory datasheet general description:
The W25Q16CV (16M-bit) Serial Flash memory provides a storage solution for systems with limited
space, pins and power. The 25Q series offers flexibility and performance well beyond ordinary Serial
Flash devices. They are ideal for code shadowing to RAM, executing code directly from Dual/Quad SPI
(XIP) and storing voice, text and data. The device operates on a single 2.7V to 3.6V power supply with
current consumption as low as 4mA active and 1μA for power-down.
In quad bit mode, these chips thus provide a throughput of 416 Mb/s or 52 MB/s... I don't know much about the particular Xtensa CPU architecture, but CPU and memory speeds are close...
Maybe the SPI Flash chip is just "shadowed into RAM"? Whatever this means, my guess is that accessing some locations in the 32-bit memory space is mapped directly to an access to the corresponding address in Flash memory with little latency, or that Flash memory regions are cached into SRAM?
As the same pins that are used to access the SPI Flash chip can also be used for accessing an "SDIO 2.0"-compatible SD Card, let's look at the
SDIO .20 spec too:
This specification defines two types of SDIO cards. The Full-Speed card supports SPI, 1-bit SD and the 4-bit SD
transfer modes at the full clock range of 0-25MHz. The Full-Speed SDIO cards have a data transfer rate of over
100 Mb/second (10 MB/Sec). A second version of the SDIO card is the Low-Speed SDIO card. This card
requires only the SPI and 1-bit SD transfer modes. 4-bit support is optional. In addition, Low-Speed SDIO cards
shall support a full clock range of 0-400 KHz.
So 10 MB/s seems to be the max here. However, depending on their
speed class, SD Card can actually range from 2~30 MB/s, so slower than the SPI Flash chips in quad mode, but still not ridiculous compared to the CPU speed.
My point is that an application stored in the SPI Flash chip or on the SD Card may be cached into SRAM and execute from it, with the "shadow" mechanism.
This doesn't mean that everything is executed from there: it looks like there is indeed a 200KB ROM that contains the low-level functions (including bootstrap loader at least from UART) for which the linker definition file contains the entries, and this mask/write once ROM cannot be modified. In the "write once" case, this may explain why SPI Flash is not mandatory: the SoC may be self-contained, with all the code stored in write-once ROM.
Again, all the above are just guesses!