Search 8052.com...


User (Email)

Password

Remember Logon

Forgot password?
Create Account


8052.com Online Store
Back to 8052.com Main Page



























AT89S52 programming utility for Linux

prog89S52


General

prog89S52 is a utility for Linux (and now DOS - see below) on the PC, allowing programming of Atmel's AT89S52 microcontroller via the parallel printer port. It is functionally similar to AEC-Electronics AEC_ISP.EXE utility for DOS, which is available from their website www.aec-electronics.co.nz. Although AEC's program has been found to work well under DOSEMU, I thought it would be nice to have a native Linux equivalent.

Atmel's 89S series are 8051 based microcontrollers which are programmable via an SPI port, rather than by UART or EPROM programmer as is the case with their 89C series and many devices from other manufacturers. I have found this an advantage during the small amount of time I have spent using these devices, since they require absolutely no additional components in order to program them in-system - they may simply be connected directly to the parallel port of a PC. The SPI (serial peripheral interface) is a very simple standard for synchronous serial communication which requires no specialist hardware and only very simple software, making it useful in the amateur workshop where simplicity is important and expensive equipment is not available.

Hardware

This program requires a standard "Centronics" type PC parallel port (a bidirectional, EPP or ECP port is not required), and so unfortutately will not run on non-IBM-compatible machines (or on modern laptops which don't have such a port). A 5-way cable is required to connect the microcontroller to the port; this is wired in an identical manner as for the AEC_ISP.EXE program, and wiring information is given in the included manual page. Remember that a clock source is required in order to program the device, and that EA (pin 31 on the 40 pin PDIP) must be tied to Vcc when programming the internal flash memory.

Software

Note that since prog89S52 uses ioperm() and friends to access the underlying port hardware, you may need to run it as root. This utility was written under a 2.6 series Linux kernel, and is linked against glibc and libm. It should compile under various other operating systems, but beware that under MS-DOS the format of the outb() system call is different - this will doubtless cause trouble.
Both binary and source may be freely distributed and modified, but both are provided without any form of express or implied warranty.

Project Status

Currently the only microcontroller officially supported is the AT89S52, although it may well work fine with the AT89S51. I also plan to support the AT89S8253 in future, although preliminary work showed little promise (if anyone has had any luck programming this device, I'd be interested to know). Unfortunately I am now busy with other projects, so support for new devices will probably only come as and when I need to use them myself.
The man page was last updated on 22nd Jan 2007, when a small correction was made to the wiring instructions.

Download

Four files are provided; The binary, the source code (in C), the man page and a gzipped tarbal containing all three of the aforementioned:
The binary
The source
The manpage
All of the above, neatly tarred and gzipped

Feedback

If you find any bugs then feel free to let me know at the email address included at the bottom of the man page, although no guarantee is made that these will be fixed.

prog89S52 for MS-DOS

Many thanks to Martin Ribelotta, who has modified my original source code to compile under MS-DOS.
This version of the program also includes slightly modified behaviour regarding resetting of the part after programming:
  • The Reset line is left high after prog89S52 has run, and specifying -r will simply set Reset and leave it high (the original behaviour was to strobe the line high).
  • A -x option has been added, to set the Reset line low (allowing the part to run). Specifying -x will clear the Reset line and quit, performing no other operations.
This version should compile under MS-DOS or UNIX, and is provided separately to the original (it is available as source only, as I have no suitable compiler). I may at some time incorporate Martin's improvements into the original, but for now the code is available here:
prog89S52 for MS-DOS


Tom Izett, 24th Jan 2007

(C) Copyright 1997 - 2008 by Vault Information Services LLC. All Rights Reserved.
Information provided "as-is" without warranty. Please see details.
Contact us for usage and copy permission.