Author Topic: P89C51RD2BA and MAX232 (wiring RST, /PSEN, TX, RX on the microcontroller)  (Read 12515 times)

dr.d3z

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
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.

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2105
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: P89C51RD2BA and MAX232 (wiring RST, /PSEN, TX, RX on the microcontroller)
« Reply #1 on: February 08, 2010, 05:13:33 pm »
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
Embedded Systems Academy, Inc.
support at esacademy dot com

dr.d3z

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
Re: P89C51RD2BA and MAX232 (wiring RST, /PSEN, TX, RX on the microcontroller)
« Reply #2 on: February 12, 2010, 05:23:00 am »
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

dr.d3z

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
Re: P89C51RD2BA and MAX232 (wiring RST, /PSEN, TX, RX on the microcontroller)
« Reply #3 on: February 13, 2010, 02:28:16 am »
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?
« Last Edit: February 13, 2010, 02:39:17 am by dr.d3z »

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2105
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: P89C51RD2BA and MAX232 (wiring RST, /PSEN, TX, RX on the microcontroller)
« Reply #4 on: February 13, 2010, 04:59:10 am »
A full device erase should clear the security bits.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

a9o1o8o

  • Jr. Member
  • **
  • Posts: 17
    • View Profile
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?

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2105
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
After a full erase yes you can re-program.
Embedded Systems Academy, Inc.
support at esacademy dot com

a9o1o8o

  • Jr. Member
  • **
  • Posts: 17
    • View Profile
A full device erase operating is always fail to me Now.Is there anyway to erase the full device but software handshake chip?

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2105
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
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.
Embedded Systems Academy, Inc.
support at esacademy dot com