Spi Serial Flash Programmer Schematic Definition
This is a very simple Arduino sketch and Python 3 client to program SPI flash chips. It's probably not very nice or tolerant, but it does at least have error correction and fast verification.
RushSPI is an Open Hardware USB-based programmer for SPI chips, designed by Nikolaj Schlej. It uses an FTDI FT232H chip and features a DIP-8 socket and a pin header. The user-space source code is part of flashrom, the schematics and PCB layouts are licensed under the CC-BY-SA 3.0 license and were created using the open-source Kicad EDA suite (GPL, version 2).
The requirements are pySerial and clint. Both modules can be installed with pip:
Usage
- Program the Arduino with sketch
- Connect the SPI flash chip as described
- Run python client on PC to talk to programmer
Connecting a chip
Connect the chip as follows, assuming you have an 3.3V 8-pin SSOP Flash chip.You will need an Arduino running at 3.3V logic. See 3.3V Conversion to convert your Arduino to 3.3V.
Or use one of the following devices running at 3.3V:
Chip pin | Arduino pin |
1 /SS | 10 |
2 MISO | 12 |
3 /WP | +3.3V |
4 GND | GND |
5 MOSI | 11 |
6 SCK | 13 |
7 /HOLD | +3.3V |
8 VDD | +3.3V |
Spi Eeprom Programmer
Commands
Troubleshooting
- Try reducing the serial speed from 115200 to 57600. You'll have to edit the value in both the .ino and the .py.
- Play with the SPCR setting in the .ino according to the datasheet.
License [CC0][http://creativecommons.org/publicdomain/zero/1.0/]
To the extent possible under law, the authors below have waived all copyright and related or neighboring rights to spi-flash-programmer.
- Leonardo Goncalves
- Nicholas FitzRoy-Dale, United Kingdom
- Tobias Faller, Germany
I used this to write a 16MB flash chip for the wr703n router running OpenWRT. Recent versions of OpenWRT detect the larger Flash and automatically use it, so you don't need to do any patching. U-Boot still thinks the chip is 4MB large, but Linux doesn't seem to care. So all you need to do is copy the image and write the ART (wireless firmware) partition to the right spot, which is right at the end of Flash.
I guess if you do a system upgrade which puts the kernel image somewhere after the first 4MB you might be in trouble, so upgrade u-boot before doing that.
Connect the original chip and dump it:
python3 spi_flash_programmer_client.py -s 4096 -f wr703n.orig.bin read
Connect the new chip and write it:
python3 spi_flash_programmer_client.py -s 4096 -f wr703n.orig.bin write
Verify the write.
python3 spi_flash_programmer_client.py -s 4096 -f wr703n.orig.bin verify
Write the ART partition to the final 64k of the chip (the magic numbers are 16M-64K and 4M-64K respectively).
python3 spi_flash_programmer_client.py -f wr703n.orig.bin --flash-offset 16711680 --file-offset 4128768 write
Verify the ART partition.
python3 spi_flash_programmer_client.py -f wr703n.orig.bin --flash-offset 16711680 --file-offset 4128768 verify
Solder the new chip in.
If you try this, let me know!
This example uses the OLIMEXINO-32U4 to flash a Olimex iCE40HX8K-EVB. The steps should also work with a iCE40HX1K-EVB.
The board is connected using the UEXT connector.