How to use Flashmagic to program the SST89E516RD Microcontroller

Wichit Sirichote, kswichit@kmitl.ac.th

Replace the NXP89V51RD2 with the SST89E516RD and use Flashmagic for program loading.


This article describes the magic of transformation from the SST89E156RD to the NXP89V51RD2 chip. We can use the Flashmagic to program the SST89E516RD chip easily. Since both chips are hardware and software compatible, so the method is just to reprogram the bootloader of the SST89E516RD chip with NXP's bootloader firmware. The external host mode or parallel programmer is used to program the NXP's bootloader to the SST89E516RD chip. The parallel programmer has been modifed from the Easy-downloader V2.0.

External host or parallel programming

The SST89E516RD has two blocks of code memory i.e. 64kB block 0 and 8kB block 1. Block 0 is for application program whereas block 1 is for bootloader firmware. We will use external host or parallel programming to write the new boot loader to the block 1. Figure 1 shows the hardware connection. P0 is for data bus, P2, bit 0 to bit 5 are for A8-13. A14 and A15 uses P3.4 and P3.5. The flash control mode uses 4 bits signal at P2.6, P2.6, P3.6 and P3.7. Such hardware configuration is quite the same as Easy-downloader V2.0. We will try modify our circuit, Easy-downlaoder V2.0 to provide signals for programming the SST89E516RD chip.
Figure 1: Hardware for parallel mode programming

The program control pulse, PROG/ALE is negative pulse -_-. RST signal must be high and PSEN must be logic low.

Modification of Easy-downloader V2.0

Some address line has changed, A15 uses P2.7. Prog_pulse then has changed to P3.2 of the master chip. PSEN of the target chip is now triggered by Q3 through the reset signal of the master chip. SW1 is added for Flashmagic connection process. For VPP, a supply of +12V controlled by LM317 is the same as Easy-downloader V2.0.
 
Figure 2: Schematic of modified Easy-downloader V2.0.

I have modified the Easy-downloader V2.0 and used the SST89E516RD as the master chip.
Figure 3: Master chip is SST89E516RD and target chip is also the SST89E516RD.

 

Figure 4: Simple modifications with wire soldering. Reset button was soldered at the bottom layer.

Flex.c, the new firmware of the masterchip

The control program of the master chip is now modified to provide appropriate signals for the SST89E516RD according to the Flash programming. The source code, Flex.c is modified from Easy V2.0 and the hex code is available for programming the master chip.

Figure 5: Testing the firmware with 9600 Terminal.

The example of connecting the programmer board with a 9600 terminal is shown in Figure 5. Command 'g' will get the chip ID, 93. Command 'b' selects memory block 0 or block 1. Above shows reading 100 bytes with 's100' command and 'r' command. Block 0 is blank, all bytes are FF whereas block 1 is the hex code of preprogrammed boot loader.

If we press command 'e', the current memory block will be erased.
Figure 6: Press command 'e' will erase the current memory block to FF. Press 'r' to read it.

Programming the NXP's bootloader to block 1 of SST89E516RD chip.

We can use the EZDL4 to program the new bootloader. However since the EZDL4 regcognizes only 89C52, the command that reads ID, will then change the chip ID from 93 to 52 chip. The size for memory block 1 is also the same as 89C52, i.e. 8kB. So we can use the EZDL4 without any problem.

Step 1: Program the chip with NXP.HEX to memory block1. The window shows the 89C52 chip was recognized.
Figure 7: Click connect.

Step 2: Click Send, select the NXP.hex file. The hex code will be sent and programmed to block 1 of the SST89E516RD chip.

Figure 8: Complete without any error.

Step 3: Now the new bootloader is ready for Flashmagic testing. You can test it by replacing the master chip with target now.

Figure 9: Replace the master chip with the target chip. The permanent ink wrintten with "NXP" indicates the chip is now with the NXP's bootloader.

Using Flashmagic with new bootloader

Now run theFlashmagic and select Advanced Options>Hardware Config. Deselect the box, Use DTR to control RST.

Figure 10: Deselect box Use DTR to control RST

Select the chip, 89V51RD2, COM port, Baud rate and more important mark only Erase blocks used by Hex File. Do not mark Erase all Flash!

Figure 11: Setting of the Flashmagic.

Then choose the hex file to be loaded, click Browse.

Before press Start button, Press and hold RESET button of the programmer board. Press Start. This window will popup.

Figure 12: MCU circuit

Then Release RESET button, the Flashmagic will connect the board and write the hex file to the block 0 memory.

Figure 13: Flashmagic is writing the hex code to the SST89E516 chip.

We can use many ISP functions, for example, read device signature (BF is SST company, 91 is 89E516RD, bootloader version 7) or display memory block 0.

Figure 14: Read device signature and display block 0 code memory.

The SST89E516Rd is now ready for the application board and we can use Flashmagic to program the chip then.

However, if need to recover with the SST bootloader, you may program the chip with SSTBSL.hex using external host mode again. You can get back to use the EasyIAP.

Download FlashFlex datasheet, FlashFlex parallel programming

Project Board for SST89E516RD


<

28 December 2013