An Arduino firmware to read, write, erase, and transfer files to SPI NOR Flash via UART.
-
SPI NOR Flash Memory Control
- Only support 1x SPI
- Erase specific blocks (4KB, 32KB, 64KB)
- Write and read single bytes or pages
- Chip erase (full memory wipe)
- Read device ID and status registers
- Configurable SPI settings
- Compatible with 25-series SPI NOR Flash (e.g., Winbond, Macronix, SST, Microchip) OPCODE LIST
-
Data Integrity & Transfers
- CRC32 Calculation to verify memory integrity
- Dump Flash Memory to UART (for logging or backups)
- Custom SPI Transactions (for example costum OPCODE)
- Receive files via XMODEM and store them in SPI NOR Flash
- Send files via XMODEM from Flash to UART
-
Hardware Control
- Software & hardware reset support
- Arduino Minima R4
- Any board level translator bi-directional
- SPI-NOR Flash 25-series
- Tested MX25L128356(SPI-NOR Datasheet)
| SPI Signal | Arduino Minima R4 Pin |
|---|---|
| MISO (CIPO) | D12 |
| MOSI (COPI) | D11 |
| SCK | D13 |
| CS (Chip Select) | D10 |
| RST (Optional Reset) | D9 |
See in a your SPI-NOR datasheet if are compatible OPCODE with list below
| Command | Description | Opcode |
|---|---|---|
1 |
Block Erase (4KB, 32KB, 64KB) | 20h / 52h / D8h |
2 |
writeEnable | 06h WREN |
3 |
chipErase | C7h |
4 |
readFlash | 03h RDSR |
5 |
statusRegister | 05h RDSR |
6 |
writeData | 02h PP |
7 |
deviceID | 90h REMS |
8 |
deviceID | 9Fh RDID |
9 |
Reads data from UART and writes it to flash | 02h |
10 |
CRC32 calc | 03h |
11 |
HW Reset cylce | - |
12 |
Dump Flash to UART | 03h |
13 |
SPI setting | - |
14 |
Custom SPI Transaction | - |
15 |
Receive file XMODEM and write into flash | 02h |
16 |
Send file XMODEM | 3h |
The Arduino Serial Monitor does not support file transfers, so it must not be used for sending or receiving data.
For file transfers, use Tera Term or another terminal emulator that supports the XMODEM protocol, or send binary file
per size 256byte.
-
Open Tera Term.
-
Go to Setup > Terminal:
- Receive: AUTO
- Transmit: CR (Carriage Return)
-
Go to Setup > Serial Port:
- Speed:
115200baud - Data Bits:
8 - Parity:
None - Stop Bits:
1 - Flow Control:
Xon/Xoff - Transmit Delay:
0ms
- Speed:
- Ensure flow control is enabled (
Xon/Xoff). - Do not use Arduino Serial Monitor for file transfers. Set
Carriage Returnand115200 - For debugging only, the Arduino Serial Monitor can still be used to display logs a
-
Read Flash ('4')
-
Reads data from UART and writes it to flash, remember erase flash!!! ('9')
-
Enter the starting address where you want to start writing (hex).
-
Configure Teraterm to send binary file per size, do not send any characters from the keyboard
-
The file transfer will start
-
At the end the file size must match the size indicated. Compare CRC32 with your file on your pc using 7zip(or similar)
-
- CRC32 calc ('10')
- Receive file from XMODEM and write data into flash ('15')
git clone https://github.com/Jampag/UART_to_SPI-NOR.git










