The NanoFlashProg is an Flash programmer using Arduino Nano.
Currently tested chips are:
- Winbond 25Q128FV
- Spansion S25FL032P
- Macronix MX25L8006E
Anticipated to be well supported:
- Any Winbond 25Qxxx series.
- Any Spansion S25FLxx series.
- Any Macronix MX25Lxx series.
This has been particularly designed to flash uboot bootloader on SPI Flash chips.
The NanoFlashProg shield fit on an Arduino Nano. The full kit has:
- Mini USB port for serial comm.
- 8 pin connector for connection with socket programmer.
A terminal emulator is required to communicate with the programmer. We recommend Cutecom. HyperTerminal or similar will also work as long as the emulator is able to send a file.
Connect to the programmer using settings 115200 8N1.
On connection the programmer will introduce itself and offer a prompt.
NanoFlashProg v1.0.0 Type h for help >
Pressing h and enter will show the help.
> h R - Read page D - Dump page W - Write File I - Chip Info E - Chip Erase H - Help >
You must erase the chip before flashing uboot. At the prompt type e and enter. Then answer y to confirm (or anything else to cancel). This will take around 6 seconds to complete.
> e Erase Entire Chip? (y/n): y Erasing chip. >
Then issue the w command to write a file. The prompt will be waiting for a file. In Cutecom click on Send File. Then select the uboot file downloaded previously.
> w > Waiting for a file. Writing page 0 Writing page 1 Writing page 2 ... Writing page 491 Timeout. >
Once the file has been entirely written to the chip it will timeout and return to the prompt.
You can now check the data in the chip by dumping the first page (a page is 256 bytes). Type d and 1 as for one page.
> d How many pages? 1 100000ff00000000100000fd000000001000017500000000100001730000 000010000171000000001000016f000000001000016d000000001000016b 000000001000016900000000100001670000000010000165000000001000 01630000000010000161000000001000015f000000001000015d00000000 1000015b0000000010000159000000001000015700000000100001550000 0000100001530000000010000151000000001000014f000000001000014d 000000001000014b00000000100001490000000010000147000000001000 014500000000100001430000000010000141000000001000013f00000000 1000013d000000001000013b00000000 >
If you are on a Linux computer you can use the xxd command to make sure this is the same as the uboot file. Issue the following command on your computer.
xxd -ps u-boot_mod__tp-link_tl-wr703n_v1__20180223__git_master-7a540a78.bin | head
Replace the filename as appropriate. This should output the same data as above.
Backup entire chip
This will create a image file of the chip. We will assume you are using a Linux computer for this. If you have installed Putty you should also have the Plink command available.
Connect to the device with the plink command like so:
plink -raw -serial /dev/ttyUSB0 -sercfg 115200 | tee winbond.txt
At the prompt enter d and 0. 0 means entire chip. The data will then be dumped to the screen (time to take your pet for a walk as this will be really long).
Once complete press Ctrl^C. Using a text editor remove the heading and trailing spurious lines from the prompt so that only the dumped data remains. Then using this command below you can create a binary image of the chip:
xxd -ps -r winbond.txt > winbond.img
Make sure the image is the right size by counting the number of bytes as follow:
wc -c winbond.img
Dump only uboot
If you wish to verify the uboot flash has been entirely successfull use the same as above but enter 492 instead of 0. 492 is the number of pages the uboot file contains (number of pages = number of bytes / 256).
Then you can double check the two files are identical using the md5sum command:
md5sum winbond.img uboot_file.img
This should return 2 identical long numbers.