I designed a this stand alone programmer with SD card for storage and four places for flash chips (2xSO8 + 2xSO16 packages) with serial console for writing commands, Hoping that this will help debricking routers for those who don't have usb programmers (Like me) and want to build their own ones (and have fun , of course)
The circuit is controlled by an ATMEGA168 with the following features:
*-fast read/write (writing 4MB flash in 30 sec).
*-simple command line for reading and writing files from/to flash (It uses the UART port so you must use your usb2serial cable @115200 baud or if you don't have one you have to store the commands you want to execute in a file "script1.txt" and then press the button).
*-Automatically detect flash size and brand , i added most commonly known chips so if your chip is not recognized it'll tell you the ID of the chip and you have to add this ID in file SpiFlash.c in function getFlashInfo(ID) and recompile.
*-two push-buttons for executing commands stored in files in the SD card , so if you press SW1 the command in file script1 will be executed and pressing SW2 will execute the contents of file script2.txt that stored in SD (if you don't want to connect the board to PC).
*-External Connector for Programming chips out of board ( In System Programmer ?) .
*-Two status LEDs , One for read and one for write.
*-Open source software and hardware so you can modify it to meet your needs.
commands:
1- cp dest source
copies source to destination (can be chipx or file name)
ex1:
cp chip3 flash.bin
writes file flash.bin to the chip placed in chip4 location (you must erase first i.e type: "erase chip4"
ex2:
cp read_ch1.bin chip1
reads the contents of chip1 to a file "read_ch1.bin"
2- erase dest blk_num
erases the 64k block/entire chip if not specified
ex1:
erase chip1 0
erase first 64k(bootloader?)
ex2:
erase chip1
will erase the entire chip(fill it with FF's)
3- id
read the chip id
ex:
id chip2
Usage:
*Put the file you want to write to the chip in a FAT16 formatted SD Card
*Power up the board 3.3v (5V works fine, don't worry) and connect the USB to Serial converter to your board and insert the SD Card
*use the Following commands:
example : backup the chip (in the chip3 location)contents and save it to backup.bin and then replace the bootloader (assume it is the first 128kb) with the file boot.bin:
answer:
1- backup flash (chip3)
cp backup.bin chip3
2- erase first and second 64k blocks
erase chip3 0
erase first 64k block
erase chip3 1
erase second 64k block
3- write file to chip
cp chip3 boot.bin
That's it !
Photos:
Source files:
https://www.dropbox.com/s/s0vhksx4dp1i8 … _source.7z
PCB and Schematic
https://www.dropbox.com/s/gp846uwp928e0 … PCB_SCH.7z
Limitations :
*SDHC Cards not supported so use SD card with maximum capacity of 4GB
*FAT16 only file system with no long filename support and read/write files to root directory only so don't use folders
TODO :
*- Add verify feature to match chip with the file programmed.
*- Add copy chip to another chip since the board contains four chips (and it's primarily designed for this )
*- Use the external connector for in system programming of the router (without desoldering the flash)