Message board for the users of flat assembler.
> Non-x86 architectures > [x51] Programming AT89S51 with another 8051 through ISP
The reason to do this is the trouble in usage of DIY or cheap programmers to program AT89S51 on modern computers. On the LPT era there was a cheapest and simpliest STK-200 programmer, which is supporting by all programmer's software and consists only of some wires at least, some resistors for more comprehensive, logical buffers and even led for most complete versions.
As the modern computers have poor IO capabilities reduced mostly to USB only, there is a problem appears. Some USB programmers made for Atmel supports AVR but not supports AT89S, other supports both but has only windows software.
So, when I met inexpectively that I can not program AT89S but I had to do this badly I decided to use my Olduino to solve this problem! So, it appeared not too complex as ISP protocol is described in each Atmel datasheet.
Here is a code to control MCU through ISP:
.xbyte - sends/recieves byte through ISP
.prog_enable - enters programming mode. this procedure substracts proper MCU responce, so, if success then accumulator contains zero value on return
.release - sets reset into inactive level (zero), so MCU may execute internal program without disconnection from programmer
.read_sig - reads signature byte
.read_byte - reads single byte from flash
.write_byte - writes single byte to flash
.erase - clears entire flash of MCU and lock bits
.writex - writes block into the flash byte by byte
As this code was made as quick solution, there is no subroutines for block reading, verifying flash or writing lock bits. If necessary their implementation is a bit trivial with this code.
Here is a part of code from s51uploader to write data from command memory (RAM for Olduino) into the AT89S51 flash:
NOTE: in-system programmer for AT89S51 must have strong pull-up to provide reset to target MCU as 8051 boards usually have capacitor and pull-down resistor for power-on reset, which may make reset impossible as internal pull-ups of x51 MCUs are weak (~40k). To be specific, my board has 10k pull-down resistor for RESET, thus I've been using 2k pull-up resistor on RESET wire for ISP programming.
|07 Jul 2018, 19:02||
< Last Thread | Next Thread >
Copyright © 2004-2018, Tomasz Grysztar.
Powered by rwasa.