Skip to content

wsy2220/spiflash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#spiflash This project can turn an AVR MCU into a programmer to read and write 25 series SPI rom chips. Rom chips no more than 16MB(address bits no more than 24) should work fine.

#System configuration I only tested this project on ATmega128A MCU and MX25L1606E rom chip.

An AVR MCU with 16MHz clock is connected to PC through a serial port, with baud rate 115200. To change baud rate, see Porting section.

Here is the wiring between MCU and flash:

AVR MCU SPI Flash
MOSI ---> SI
MISO ---> SO
SCK ---> SCK
SS ---> CS

WP and HOLD on chip are held high.

#Building MCU program requires gcc-avr to build. PC program should work with any c compiler and POSIX compliant system.

To build MCU program in intel hex format, go to mcu/ and type make. To build PC program, go to pc/ and type make.

#Usage

If the MCU is connected to serial port /dev/ttyUSB1, and the chip has a capacity of 1MB, To dump the content of the rom chip into dump.bin:

spiflash -p /dev/ttyUSB1 -s 0x100000 -r -f dump.bin

Since this program does not detect the size of the chip, you have to specify the size to be read.

To flash the chip with dump.bin:

spiflash -p /dev/ttyUSB1 -w -f dump.bin

This will automatically flash all the content of dump.bin into the chip. So make sure the size of the file is correct.

Type spiflash -h for more options.

#Porting To port to other AVR MCUs, you shoud modify pin definitions in mcu/spi.h to match the target MCU.

To change serial port baudrate, first modify serial_init() function in mcu/serial.c, and change UBRR0 to get the correct baud rate. Then go to pc/system.h and change BAUD to definitions supported by cfsetispeed().

About

SPI ROM programmer based on AVR MCU

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published