Flash Magic Forum

In-System Programming Support => P89C51Rx+/P89C51Rx2/P89C66x/P89C6xX2/P89V66x => Topic started by: dr.d3z on February 07, 2010, 11:51:07 am

Title: P89C51RD2BA and MAX232 (wiring RST, /PSEN, TX, RX on the microcontroller)
Post by: dr.d3z on February 07, 2010, 11:51:07 am
Hello guys,

I've found your website a resource of outstanding information that solved lots of my problems. Thanks so much for this awesome website!

So now I've got a problem about my first microcontroller circuit.
I have got a P89C51RD2BA already programmed, so I've built a circuit to run it into ISP mode and use FlashMagicTool to recode - edit - erase it.

After checking some docs on your website, I realized that the microcontroller needs to be forced into ISP mode by setting /PSEN low during the Reset. I was just wondering i you guys have got a circuit or a scheme to automatize this process.
I saw that the FlashMagicTool Manual has a good example about how to automatize this, but it looks like I would need 2 MAX232 as there are 3 RS232 outputs and just 1 TTL input. I am talking about the example circuit, so I was wondering if there's a way to Reset and setting /PSEN low during the reset using a single MAX232, resetting the device using the serial and all the functions supported by FlashMagicTool.
Also, I was wondering if there's any way that the device might be read-write protected even against the hardware ISP running mode.
Any help would be very appreciated guys!

Cheers,
Dr.D3z.
Title: Re: P89C51RD2BA and MAX232 (wiring RST, /PSEN, TX, RX on the microcontroller)
Post by: Andy Ayre on February 08, 2010, 08:13:33 am
The LPC2xxx ARM7 devices use a similar approach to entering ISP mode and Flash Magic supports it in the same way, namely using DTR and RTS to control reset and the ISP entry pin. Therefore you can look at how Keil Software solved this problem on their eval boards:

http://www.keil.com/mcb2300/mcb2300-schematics.pdf

To lock the device you need to set the security bits. The security bits are only cleared if all the flash memory is erased. I.e. ISP commands are still accepted but are limited in what they can do. Check the NXP user manual for your device for the full details.

regards, Andy
Title: Re: P89C51RD2BA and MAX232 (wiring RST, /PSEN, TX, RX on the microcontroller)
Post by: dr.d3z on February 11, 2010, 08:23:00 pm
Thanks Andy for your reply.
However I still have got problems starting the P89C51RD2BA into ISP mode.
I have been looking around and I've found different solutions, so I am a bit confused
.
First of all, the RESET, should it be connected to +5 (when the button is pressed), and then go back to GND ( or disconnected ) ?
The PSEN should always be connected to GND (to force ISP mode) during and after the reset?
And.. the 2 pins P2.6 and P2.7 should always be connected to +5 (maybe with a 10k resistor each one) during and after the reset?

Sorry man, but it's fairly new for me this stuff so I am trying to understand...

Also, High or Low .. is the same as saying +5 / GND?

Cheers,
D3z
Title: Re: P89C51RD2BA and MAX232 (wiring RST, /PSEN, TX, RX on the microcontroller)
Post by: dr.d3z on February 12, 2010, 05:28:16 pm
Nevermind, I've got it finally working! :)
However the 3 security bits are set, so I cannot read/erase the flash ram... do you guys know any way to bypass or erase the security bits?
Title: Re: P89C51RD2BA and MAX232 (wiring RST, /PSEN, TX, RX on the microcontroller)
Post by: Andy Ayre on February 12, 2010, 07:59:10 pm
A full device erase should clear the security bits.

Andy
Title: Re: P89C51RD2BA and MAX232 (wiring RST, /PSEN, TX, RX on the microcontroller)
Post by: a9o1o8o on January 14, 2016, 05:51:53 pm
A full device erase should clear the security bits.but if you consure this chip is still useful to me?Is this chip still can download codes?
Title: Re: P89C51RD2BA and MAX232 (wiring RST, /PSEN, TX, RX on the microcontroller)
Post by: Andy Ayre on January 15, 2016, 12:07:07 am
After a full erase yes you can re-program.
Title: Re: P89C51RD2BA and MAX232 (wiring RST, /PSEN, TX, RX on the microcontroller)
Post by: a9o1o8o on January 17, 2016, 06:05:14 pm
A full device erase operating is always fail to me Now.Is there anyway to erase the full device but software handshake chip?
Title: Re: P89C51RD2BA and MAX232 (wiring RST, /PSEN, TX, RX on the microcontroller)
Post by: Andy Ayre on January 18, 2016, 01:10:18 am
Are you using P89C66x or P89C51RD2? Because you are posting almost the same questions in two threads for two different microcontrollers. Please limit your posts to the thread for the actual microcontroller you are using.

For both devices you can only erase it through ISP after performing the ISP autobaud sequence. You can also use a parallel programmer to erase.