89C51RC2 ISP problems

Started by Carlos, August 18, 2004, 11:35:13 AM

Previous topic - Next topic


I see upon looking through this forum that I should add a "backdoor" to my code, and that's probably a good workaround, BUT:

I have a batch of 1000 boards with the 89C51RX2BA CPUs and our tech started trying to program them with Flash Magic (V1.97; I've since downloaded the current V2.05).

Four of the first 10 or so boards appear to have had the boot vector and/or the status byte modified such that we cannot re-program them via the ISP - they won't re-enter the ISP state.

The last of the four was programmed in front of me, and appeared to program normally, but when the sequence ended, a pop-up window said something like "Error writing boot vector and Status byte."  Sure enough, that unit also will no longer enter the ISP mode - it seems to have the firmware on board and runs it, but cannot be made to re-enter the ISP mode.

My question is:  Why was there any attempt to write the boot vector/status bytes anyway?  There is a big deal made of warning the user about changing these values if you try it from the drop-down menus, and no mention whatsoever is made of changing them in the normal programming sequence, so why was Flash Magic trying to change them?  I didn't ask it to!!?!?

Is there any way to prvent Flash Magic from messing with those values?


Andy Ayre

Some of the devices (I believe yours included) erase the boot vector and status byte when a global erase is performed. Flash Magic then has to program the boot vector back to the factory default. If it doesn't do this then on the next reset the device will be useless without a parallel programmer.

Flash Magic always programs the status byte to zero after programming a hex file, to ensure that the application will execute on the next reset.

Some of the devices (the Rx2Hxx and 66x families) require that the Boot Vector is erased whenever the status byte is erased. In order for Flash Magic to set the status byte to the value it wants, it has to erase the Boot Vector as well. It then immediately reprograms the Boot Vector back to the factory default.

What Flash Magic does to avoid unecessary programming of the Boot Vector and status byte is as follows. Before any programming of the boot vector and/or status byte, the values of the boot vector and status byte are first read. If they match the values Flash Magic wants then no programming takes place. Only if they are different does Flash Magic go ahead and program the values.

If you have a glitch/ripple on the power supply or the power is removed or drops to a low voltage while the Boot Vector and Status Byte are being erased or programmed, then the operation may not complete properly.

Embedded Systems Academy, Inc.
support at esacademy dot com


Thanks for the explanation - I guess that makes sense.  I added the "backdoor" code so now we're prepared should it happen again - and only 3 boards with unusable CPU's - and I've tested it by deliberately changing the boot vector.