Web51 - Hardware |
|
In-system serial programming interface by ATMEL is generally associated with AVR processor family, where its usage is generally simple and reliable. Some problems may occur if the edges are not fast enough; this can be partially solved by decreasing values of pull-up resistors and using cables less than 1m long.
Besides AVRs, two processors from the x51 series also support ISP - AT89C8252 and AT89S53. Uploading of firmware through ISP is a good way of developing applications for the old x51 family. Unlike AVR, the level of RESET is inverted; this needs to be specified in certain programming utilities. The reset circuit must be carefully designed, too - peripherals must expect a reset from the ISP programmer.
A big problem is poor HW implementation of ISP interface support. Due to limited number of pins, ISP is shared with P1. When programming in the system, peripherals must allow data transfer over these pins in RESET state. Programming of internal FLASH through ISP is implemented by an ISP block that has been added to the chip structure. This block scans for a certain sequence after RESET, disconnecting the rest of CPU and programming the memory if it is detected. As ATMEL describes in their errata docs, in some cases the ISP block wrongly identifies access to P1 when the program runs as the ISP sequence. In such a case, the CPU enters an undefined state where ISP may or may not function. Such a CPU then has to be erased and re-programmed in a regular parallel programmer.
When programming through ISP is finished, programming software releases RESET to inactive state, therefore immediately starting program execution. Quite a few combination access P1 and therefore the above described behavior needs to be taken into account. Atmel recommends to refrain from accessing ISP pins of P1 for approx. 500 ms after reset. For example, if all I/O pins are to be set to '0' after reset, use a delay loop before setting the ISP pins (P1.5 to P1.7).
After reset, Web51 sets ports to '0' to decrease consumption. Since this affects the mentioned P1, there is a delay loop in the .global_reset section of web51.asm (found in /lib/):
.global reset reset: MOV R7,#20 ;ISP DELAY for AT89S8252 CPU ISP_Ra: MOV R6,#0xFF ; 255 x 255 x 25 = 650 ms for 22.1184 MHz Xtal ISP_Rb: MOV R5,#0xFF ISP_Rc: DJNZ R5,ISP_Rc DJNZ R6,ISP_Rb DJNZ R7,ISP_Ra
In-system Serial Programming (ISP) of Atmel microcontrollers is a common thing nowadays that saves a lot of development time. We would like to introduce a simple programmer, or rather an interface, for ISP, that uses a LPT port.LPT ISP Prog is rather an interface than a real programmer. It contains no sockets for programming of devices on its board. Its output is the ISP connector only. If you need to program an ISP capable processor outside of an application, simply connect it directly to the ISP output and add an xtal with capacitors.
Power supply
ISP interface provides supply voltage. Since power can be drawn from the application or another source as well, there is a separation diode D1 on the interface board. If it is shorted, all power is interconnected. The diode separates supply for the buffer circuit only; supply voltage pins of the ISP connector are connected to the terminal block for connection of optional external supply.
Besides supply voltage, the ISP interface controls processor reset (/RESET), signals for serial writing (MOSI) and reading (MISO) of contents of internal FLASH and EEPROM, and a synchronization signal (SCK).
MISO and MOSI signals are NOT crossed. MISO from the programmer connects to MISO of the CPU, MOSI connects to MOSI.
- Connects to the parallel port, does not block any serial ports. A serial port remains free for connection of the application being developed.
- Software for Windows 95,98 and Windows NT/2000 (SW contains fast drivers that work under W9x as well as slower drivers that work under NT and W2000 as well)
- Our price includes a royalty fee for the author of the software, C. Lanconelli.
- Unlike direct connection to parallel port pins, the programmer contains a bus driver that defines output logic levels. Therefore, the programmer correctly operates on all parallel ports and does not require extremely short cables.
- The bus driver makes all SCK edges fast enough, avoiding problems described in ATMEL's Errata docs (of course, unless 10 meters of cable are used...)
- Software for LPT ISP Prog is a part of the "PonyProg" package and is regularly updated. So, you can rely upon a problem being corrected if, for example, ATMEL modifies their programming algorithms.
- Software is user-friendly, written with respect to ongoing development. It contains for example an option to reload the .hex file from disk before every programming - a must in any multi-window design environment.
- Programmer contains indication of the programming progress and supply voltage.
- If the SW cannot find the programmer on its port, try to change driver in hardware settings of PonyProg software.
- If the power LED is off, look for an error in power distribution.
- Watch out for reset circuit in your application; it must allow the reset to be issued by the ISP programmer.
- When using AT89S8252, respect the limitations described in Errata; especially the part about not using ISP pins during the first 500 ms after reset.
According to PonyProg author, ISP can be called externally via PonyProg SW and scripts. For example, it is possible to call programming software and program the device from a Makefile.
The following example calls PonyProg from a Makefile using make isp. PonyProg2000 v. 2.04h or later is required.ISP = c:/programmi/ponyprog2000/ponyprog2000.exe MCU = at89s8252 isp: $(TRG).rom $(TRG).eep echo -e "SELECTDEVICE $(MCU)\nLOAD-PROG $(TRG).rom\nLOAD-DATA $(TRG).eep\nERASE-ALL\nWRITE-ALL" >isp.e2s $(ISP) isp.e2s #$(RM) isp.e2s
Full documentation of the interface is available at HW server in the LPT ISP Prog article (Czech language), including sources for PCB and software.
You can also order a ready-made ISP Prog as well as our other products.
AT89S8252 8-bit Microcontroller with 8K Bytes Flash (34 pg.) [local copy]
The Errata sheet for AT89S8252 and AT89LS8252 (2 pg.) [local copy]
| Web51 description | News | FAQ | ORDER FORM | DOWNLOAD | Links |
| (c)Copyright 2000 - 2002, HW server & Radek Benedikt
Web51@HW.cz, Web51.HW.cz |
|