Serial NOR flash¶
Driver for serial NOR flash memory technology devices attached via SPI.
-
const
mtd.h::mtd_desc_t
mtd_spi_nor_driver
¶ NOR flash SPI MTD device operations table.
-
const mtd_spi_nor_opcode_t
mtd_spi_nor_opcode_default
¶ Default command opcodes.
The numbers were taken from Micron M25P16, but the same opcodes can be found in Macronix MX25L25735E, and multiple other data sheets for different devices, as well as in the Linux kernel, so they seem quite sensible for default values.
-
const mtd_spi_nor_opcode_t
mtd_spi_nor_opcode_default_4bytes
¶ Default 4-byte addresses opcodes.
Commands for 4-byte addresses chips (above 128Mb)
-
JEDEC_NEXT_BANK
¶ Byte to signal increment bank number when reading manufacturer ID.
1
(0x7f)
-
SPI_NOR_F_SECT_4K
¶ Flag to set when the device support 4KiB sector erase (sector_erase opcode)
1
(1)
-
SPI_NOR_F_SECT_32K
¶ Flag to set when the device support 32KiB block erase (block_erase_32k opcode)
1
(2)
-
struct
mtd_spi_nor_opcode_t
¶ SPI NOR flash opcode table.
-
uint8_t
rdid
¶ Read identification (JEDEC ID)
-
uint8_t
wren
¶ Write enable.
-
uint8_t
rdsr
¶ Read status register.
-
uint8_t
wrsr
¶ Write status register.
-
uint8_t
read
¶ Read data bytes, 3 byte address.
-
uint8_t
read_fast
¶ Read data bytes, 3 byte address, at higher speed.
-
uint8_t
page_program
¶ Page program.
-
uint8_t
sector_erase
¶ Block erase 4 KiB.
-
uint8_t
block_erase_32k
¶ 32KiB block erase
-
uint8_t
block_erase
¶ Block erase (usually 64 KiB)
-
uint8_t
chip_erase
¶ Chip erase.
-
uint8_t
sleep
¶ Deep power down.
-
uint8_t
wake
¶ Release from deep power down.
-
uint8_t
-
struct
mtd_jedec_id_t
¶ Internal representation of JEDEC memory ID codes.
-
uint8_t
bank
¶ Manufacturer ID bank number, 1 through 10, see JEP106.
-
uint8_t
manuf
¶ Manufacturer ID, 1 byte.
-
uint8_t
device
()¶ Device ID, 2 bytes.
-
uint8_t
-
struct
mtd_spi_nor_t
¶ Device descriptor for serial flash memory devices.
This is an extension of the
mtd_dev_t
struct-
const mtd_spi_nor_opcode_t *
opcode
¶ Opcode table for the device.
-
spi.h::spi_t
spi
¶ SPI bus the device is connected to.
-
gpio.h::gpio_t
cs
¶ CS pin GPIO handle.
-
atmega_common/include/periph_cpu_common.h::spi_mode_t
mode
¶ SPI mode.
-
atmega_common/include/periph_cpu_common.h::spi_clk_t
clk
¶ SPI clock.
-
uint16_t
flag
¶ Config flags.
-
mtd_jedec_id_t
jedec_id
¶ JEDEC ID of the chip.
-
uint32_t
page_addr_mask
¶ bitmask to corresponding to the page address
Computed by mtd_spi_nor_init, no need to touch outside the driver.
-
uint32_t
sec_addr_mask
¶ bitmask to corresponding to the sector address
Computed by mtd_spi_nor_init, no need to touch outside the driver.
-
uint8_t
addr_width
¶ Number of bytes in addresses, usually 3 for small devices.
-
uint8_t
page_addr_shift
¶ number of right shifts to get the address to the start of the page
Computed by mtd_spi_nor_init, no need to touch outside the driver.
-
uint8_t
sec_addr_shift
¶ number of right shifts to get the address to the start of the sector
Computed by mtd_spi_nor_init, no need to touch outside the driver.
-
const mtd_spi_nor_opcode_t *