Web51 - Hardware

MAC addresses  hw_web51.html  WWW8052 Prototype

Hardware Web 51 - In-system Serial Programming


In-system Serial Programming (ISP) of Atmel microcontrollers is a common thing nowadays. It saves development time, not to mention the inconvenience of constantly moving the CPU between its socket in an application and a programmer. This document contains a general description of ISP as well as a design of an interface that uses LPT port for ISP. You can download full specifications from www.HW.cz and build it yourself, or order a ready-made kit.

Using ISP in practice

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
	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


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.

Schematic of the supplied programmer

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.

Advantages of the programmer:

Tips and tricks

Programming through PonyProg from applications

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
$(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.


pdfAT89S8252 8-bit Microcontroller with 8K Bytes Flash (34 pg.) [local copy]
pdfThe Errata sheet for AT89S8252 and AT89LS8252 (2 pg.) [local copy]

Sponzored by LPhard Ltd. Graphics by GIMP Created by EasyPad

(c)Copyright 2000 - 2002, HW server & Radek Benedikt
Web51@HW.cz, Web51.HW.cz
MAC addresses  Obsah  WWW8052 Prototype