Programming user fuses on the Atmel AT89LP51 from the serial port.

Disclamer: This workes for me. It may work for you as well. If it doesn't I am not responsable. Try it on a board you can afford to throw away.

I have been using the AT89LP51RD2 for a good while. I have been using the serial port to program the chip, just like I did with the AT89C51xx. But I also wanted to get access to the "User Fuses" so that I could gain access to single cycle mode and other features.

According to the manual:
"23.2 User Configuration Fuses ... Note that the bootloader only has limited access to the fuses. For full device configuration an external ISP programmer is required."

Well, I didn't want to invest in the external ISP programmer and I didn't want the extra connector on each board, so I devised a firmware solution.

The code given here allows you to set or clear any of the user fuses. The code can be compiled and linked using SDCC.

Proceedure:

1) Edit "main.c" to include set_fuse and/or clear_fuse calls for any desired fuses, where I have the call to "clear_fuse(0x6); // set the processor to fast mode". Also edit svc.h to set the OSC define the the appropriate valus for your board.

2) Compile, load and execute the program.

3) Comment out all calls to set_fuse and clear fuse.

4) Compile, load and execute the program again.

5) Observer that the printout shows the modified fuses, but the fuse changes are not in effect.

6) Completely power off the processor.

7) Execute the program.

8) Observer that the printout shows the modified fuses, and the fuse changes are in effect.

9) Use the board with the modified CPU user fuses.

(obviously some steps are for verification only and are not required.)

Note: If you incorperate this code into your own program, make sure the fuse routines from svc.c are not loaded in the first 256 bytes of flash or they will conflict with the hardware areas needed for this code to work. In the provided set of code, this requirement is met.

(john.munch@att.net)