P89C51RD2HBP will not program

Started by Rons, August 26, 2003, 01:54:52 PM

Previous topic - Next topic

Rons

I have been using the P89C51RD2BN with FlashMagic for about 3 weeks.
I was using a 20Mhz crystal in 12 clock mode. I decided to change to a
24Mhz crystal. Within 1 day both of my devices stopped responding to
ISP mode. I think what happened is that FlashMagic and my device got
hung up and I had to kill the app, etc. There was no other way to. The
microcontroller will only execute the last program in flash. I think the
boot vector got corrupted.

So, I got a couple of P89C51RD2HBP devices to hold me over. I am able
to do everything with FlashMagic except program the flash. I get the message:

Error programming the Hex file. Address : 0x0000

Also, if I try to erase the flash block by block it looks like it works.
If I try to erase the entire flash at one time, FlashMagic says it is erasing
but the program just sits there.

My setup is the same and my hex file is the same.  I have a way to re-write
the boot vector and status byte for my original problem with the P89C51RD2BN but the distributor was out of stock.

Andy Ayre

I'm not sure why the devices would stop working when you switched to 24MHz. What baud rate were you using?

Make sure you have the correct device selected in Flash Magic. The H and non-H parts are not identical and have different Flash Block arrangements.

How long does Flash Magic appear to hang for? On some specific devices, a full erase can take up to 30 seconds. An error when programming at address 0 is usually caused by one of two things - block 0 is not fully erased, or the hex file contains two records that attempt to write to address 0.
 
If the device is a H device then make sure that P2.6 and P2.7 are floating or (preferably) pulled high at reset. If both pins are not floating or pulled high then the device can do strange things. Also odd things can happen if the baud rate is too high. Try 9600 or 19200. Does it make any difference?
 
To debug this problem further I need to see what is going on. Can you please have the engineer perform the following steps:
 
Start Flash Magic
Press F1 so [Debug] appears at the top of the window
Make sure high speed communications and (if possible) half-duplex communications are turned off under the Advanced Options
Attempt a full device erase. Make sure you wait about a minute or so before giving up.
Close Flash Magic
Start Flash Magic
Reset the device
Press F1 so [Debug] appears at the top of the window
Erase each block in the device using the block erase feature (i.e. don't perform a full device erase)
Make sure the Erase All checkbox in section 2 of the main window is erased
Attempt to program the hex file so the error is generated.
Close Flash Magic
Email me the generated debug file C:\flashmagic.fmd
Delete C:\flashmagic.fmd

My Email address is below and you can also reach me at the Email address at the bottom of the Flash Magic web page.

Embedded Systems Academy, Inc.
support at esacademy dot com

Rons

I think flahmagic got confused or hung. I had to reset the device and kill
the app. I think the boot vector got corrupted.

Baud rate was 38400

I had the right part selected

Hang is greater than 5 minutes. Eventually a message appears "unable to
access com port"

SInce I have tried known working good hex files, I seriously doubt that
your suggestion about 2 records that attempt to write to address 0 is valid.

I have strapped P2.6 & P2.7 to 5 volts. 9600, and 19200 don't make any
difference.

I tried your debug procedure. I am unable to erase single flash blocks
when debug mode is on. I get a hang as if I was erasing the entire flash.

When debug mode is off I can erase single flash blocks, or at least it
appears that way from the app.

BTW, I am the engineer.

I have sent you the debug file

Rons

I put my part into a breadboard with minimal connections. Only enough
wires and resistors for ISP. I then could program the part. I put this
part into my circuit board. And it ran, sort of. It looked like eratic resets
were occuring. I probed the circuit and found a floating ground connection.
FlashMagic is good. And thanks for your quick reply.