Reference
W25Q
SPI flash memory (W25Q32/Q64/Q128).
- Connects over
- SPI
- Made by
- Winbond
- Datasheet
- winbond.com
Use it
hardware {
device w25q: W25Q(cs: 16)
}
every 1s {
let value: int = w25q.erase_chip()
log("w25q", "erase_chip={value}")
}
The W25Q goes on the SPI bus; give it its cs pin as an argument.
Methods
-
w25q.erase_chip() -> int
-
w25q.erase_sector(addr: uint32_t) -> int
-
w25q.read(addr: uint32_t, buf: uint8_t *, len: uint16_t) -> int
-
w25q.write_page(addr: uint32_t, data: const uint8_t *, len: uint16_t) -> int
Wiring
| Pin | Connect to |
|---|---|
VCC | 3.3V or 5V |
GND | Ground |
SCK | SPI clock |
MOSI | Master Out / Slave In |
MISO | Master In / Slave Out |
CS | Chip select (active low) |
WP | Write protect (tie high to allow writes) |
HOLD | Pause SPI without releasing CS (tie high if unused) |
Specifications
- Voltage
- 2.7V – 3.6V (NOT 5V tolerant)
- Current
- 4 mA read, 1 μA powerdown
- Capacity
- Variants from 1 Mbit (W25Q10) to 256 Mbit (W25Q256)
- Interface speed
- Standard/Dual/Quad SPI up to 133 MHz
Tips
- Writes are page-based (256 bytes); erases are sector (4 KB), block (32 KB / 64 KB), or chip-wide.
- Erase before write — bits go 1→0 on program, only 0→1 on erase.
- Endurance is ~100k erase cycles per sector — wear-level for write-heavy use.
Alternatives worth knowing:
- AT25SF: Adesto — similar chip family, slightly different command set.
- MX25R: Macronix — low-power variants.