10-STM32F1 -FLASH
Flash(W25Q64)
类型:
Flash分为NOR Flash和NAND Flash。W25Q64为NOR Flash。
- NOR Falsh 支持字节写入。
- NAND Flash必须以块或扇区为单位进行读写。
存储特性:
- 在写入数据之前必须先擦除,擦除时把所有位置1。
- 写入数据时,只能将所需要修改的数据数据0置0,数据1不变(示例:0x9D->0xFF->0xBD)。
- Flash擦除时必须按最小单位擦除(一般为扇区)。
W25Q64
- SPI,Dual SPI,QUAD SPI。
- SPI速率最高支持80Mhz。
Block&Seator(块和扇区)
命名规则:W25Q64,64 = 64Mbit = 8MB = 128 * 64 KB。
Flash分为块(Block)和扇区(sector)存储。
Flash(W25Q64:8MB)分为0~127个Block,每个Block大小为64KB。
每个Block分为0~15个Seator。每个扇Seator为4KB。

Instruction set(指令)
状态寄存器
Flash具有状态寄存器(Status Register)通过读取状态寄存器了解Flash状态。

指令集


常用指令集示例
读取ID
(Manufacturer ID / Device ID ,Unique ID & JEDEC ID)

- Manufacturer ID/Device ID: Instruction(90h)+Address(000000h)+Manufacturer ID(EFh) + (Device ID(ID7~ID0,16h))
- Unique ID:Instruction(4Bh)+dummy1+dummy2+dummy3+dummy4+(Unique ID(ID63~ID0))
- JEDEC ID:Instruction(9Fh)+(Manufacturer ID(EFh))+ (Memory Type (ID15-ID8,40h)) + (Capacity (ID7-ID0,17h))
Flash JEDEC ID:0xEF4017,Manufacturer ID:0xEF16h
读取状态寄存器:
- Read Status Register1:Instruction(05h)+(Status Register1(S7~S0))
- Read Status Register2:Instruction(35h)+(Status Register1(S15~S0))
擦除扇区
- Sector Erase:Instruction(05h)+24-Bit Address
页写入
- Page Program:Instruction(05h)+24-Bit Address+Data Byte 1 …+ Data Byte 256
页写入可以写入1Byte~256Byte,只要保证写入的数据地址已经被擦除。
读取数据
- Read Data:Instruction(03h)+24-Bit Address+ Data Out 1 + Data Out 2 + …
读取数据允许从内存中依次读取一个或多个数据字节
低功耗处理
- Power-Down:Instruction(B9h)
- Release Power down:Instruction(ABh)
低功耗处理
- Power-Down:Instruction(B9h)
- Release Power down:Instruction(ABh)