Returns SPI flash User Info settings
Device
Available on the imp005 only
Table of SPI flash User Info settings
This method returns the SPI flash timing settings data stored within the external SPI flash attached to an imp005 module. The data for a given SPI flash chip is returned as as a table:
Key | Value Type | Description |
---|---|---|
size | Integer | Size in bytes |
max_write_size | Integer | Max write size in bytes |
fast_read_freq | Integer | Fast read clock frequency in Hz |
normal_read_freq | Integer | Normal read clock frequency in Hz |
supports_fast_read | Bool | Flash supports fast read |
supports_quad_read | Bool | Flash supports quad-width read |
fast_dummy_cycles | Integer | Number of dummy cycles to use in fast mode |
These timings are written directly to the imp005’s User Info page — stored in the module’s external SPI flash — within the factory. The User Info page’s information is stored as a variable-length data structure containing settings for all of the types of SPI flash chip that a customer might choose to install in a given product. At start up, impOS™ will retrieve the connected SPI flash chip’s JEDEC ID and program the chip with the stored timings associated with that ID. This allows the manufacturer to include specific timings for various types of SPI flash chip in the same User Info data.
The format of each entry in the User Info page is:
Name | Type | Description |
---|---|---|
tag | uint16 | The type of setting |
length | uint16 | The length of the data in bytes, not including the header. Must be a multiple of four |
data | The settings data: one storedFlashCapabilities structure (see below) per SPI flash chip type |
At this time, the only valid tag value is 1, for ‘flash timings’. In the future, the User Info page may be updated to provide other customer-writeable settings.
The length value will be 16 times the number of chip types included, ie. 32 for two types, 48 for three types, and so on. The data structure for each type, presented below, fits into 16 bytes and includes the ID (device_id) used to match against a connected chip’s JEDEC ID (see spiflash.chipid()) at boot.
struct storedFlashCapabilities {
uint32_t device_id;
struct {
uint32_t size;
uint16_t maxWriteSize;
uint8_t fast_read_divider; // Maximum 31
uint8_t normal_read_divider; // Maximum 31
unsigned int supports_fast_read:1; // 1 (true) or 0 (false)
unsigned int supports_quad_read:1; // 1 (true) or 0 (false)
unsigned int fast_dummy_cycles:4;
} capabilities;
};
Note When either fast_read_divider or normal_read_divider are applied, the calculation is rounded down. So odd divisors have the same result as the nearest lower even divisor. For example, a divisor of 0x07
has the same effect on the frequency calculation as 0x06
, 0x05
the same effect as 0x04
. Please bear this in mind when recording your flash timing settings.