NanoFlashProg: Difference between revisions

From lechacal
Jump to navigation Jump to search
 
(18 intermediate revisions by the same user not shown)
Line 8: Line 8:
The NanoFlashProg is an Flash programmer using Arduino Nano.
The NanoFlashProg is an Flash programmer using Arduino Nano.


Currently supported chips are:
Currently tested chips are:
* Winbond 25Q128FV
* 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.
This has been particularly designed to flash uboot bootloader on SPI Flash chips.
Line 15: Line 22:
=Hardware=
=Hardware=


The NanoFlashProg shield fit on an Arduino Nano. The full kit has:
The NanoFlashProg shield fit on an Arduino Nano. The full kit sold is:
* Arduino Nano
* NanoFlashProg Shield
* SOIC8 Clamp with cable.
 
Additional hardware required (not provided):
* Mini USB port for serial comm.
* Mini USB port for serial comm.
* 8 pin connector for connection with socket programmer.
* SPI flash chip
 
The chip must be desoldered. It is not possible to clamp on a chip already soldered on a board. You can remove the soldered chip with a air gun. Flash it and resolder it back again.
 
==Connecting the chip==
 
The chip to program should be de-soldered from the PCB. Do not connect the clamp on a soldered chip as supply voltage might conflict.
 
Connect the ribbon cable ensuring the red wire is on the same side of the white indicator on the NanoFlashProg.
 
[[File:IMG_2033_small.png | 250px]][[File:IMG_2030_small.png | 250px]]
 
Clamp on the chip ensuring the red wire is on the same side of the dotted pin on the chip.
 
[[File:IMG_2032_small.png | 250px]][[File:red_wire_clamp.png | 250px]]


=Sketch=
=Sketch=


 
[http://lechacal.com/nanoflashprog/NanoFlashProg_v1.0.0.ino Sketch v1.0.0]<br>
[http://lechacal.com/nanoflashprog/NanoFlashProg_v1.0.0.zip Library v1.0.0]


=Software=
=Software=
Line 94: Line 121:
  '''xxd -ps''' u-boot_mod__tp-link_tl-wr703n_v1__20180223__git_master-7a540a78.bin''' | head'''
  '''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.
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.
==Troubleshooting==
If the prompt starts with the following message:
Failed requesting device information.
Check connection between the NanoFlashProg and the chip. Then close the serial connection and re-open it to re-initialise the communication.

Latest revision as of 12:54, 19 August 2020

Overview

link to the shop

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.

Hardware

The NanoFlashProg shield fit on an Arduino Nano. The full kit sold is:

  • Arduino Nano
  • NanoFlashProg Shield
  • SOIC8 Clamp with cable.

Additional hardware required (not provided):

  • Mini USB port for serial comm.
  • SPI flash chip

The chip must be desoldered. It is not possible to clamp on a chip already soldered on a board. You can remove the soldered chip with a air gun. Flash it and resolder it back again.

Connecting the chip

The chip to program should be de-soldered from the PCB. Do not connect the clamp on a soldered chip as supply voltage might conflict.

Connect the ribbon cable ensuring the red wire is on the same side of the white indicator on the NanoFlashProg.

Clamp on the chip ensuring the red wire is on the same side of the dotted pin on the chip.

Sketch

Sketch v1.0.0
Library v1.0.0

Software

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.

Usage

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
>

Flashing Uboot

We recommend downloading uboot from pepe2k repository. Github link.

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.

Troubleshooting

If the prompt starts with the following message:

Failed requesting device information.

Check connection between the NanoFlashProg and the chip. Then close the serial connection and re-open it to re-initialise the communication.