Using USB to TTL DTR to power on reset an STC 8051

Discussion in 'Embedded Systems and Microcontrollers' started by bthomas, Oct 25, 2017.

  1. bthomas

    Thread Starter Member

    Aug 15, 2009
    14
    1
    Hi,

    I am using an STC 89C51 microcontroller connected to my computer using an USB to TTL adapter, as per their datasheet. I am using stcgal to program this microcontroller. However to program it I need to put it into its serial bootloader mode. This requires a power on reset, which I have to do manually by power cycling the MCU. stcgal does have the ability to trigger a pulse on the USB to TTL DTR line. I was wondering if there is a simple way to power cycle the VCC line (pin 40) in response to the DTR pulse. I did try connecting the DTR line to RST pin 9 of the MCU. The RST pin 9 is held down using a 10K ohm resistor as per the datasheet and it is a active low pin. Though stcgal produces a high pulse, it does not put the MCU in serial boot loader mode and I expected this since the datasheet seems to indicate that the MCU can only be put into bootloader mode by power cycling.

    regards
     
  2. philba

    Active Member

    Aug 17, 2017
    959
    303
    Is there a way in software to put it into bootloader mode? You could set up an interrupt on the DTR pin.

    Another way is to use a P-MOSFET in-line with the VCC input to the microcontroller. Pull the gate high to turn off the power to the micro. You might need to add an inversion stage (NPN) if the DTR has to be low to reset the micro.
     
  3. bthomas

    Thread Starter Member

    Aug 15, 2009
    14
    1
    Thanks philba. I will try the P-MOSFET idea using a BS250 (which is what I have). Its continuous drain current is 230mA which I think should be enough for the 10mA used by STC89C51.

    I think there is a way to do a soft reset into ISP mode by first writing 60H into the ISP_CONTR register and then doing a soft reset (warm boot) using the RST pin as above. But I prefer the hardware approach as it is simpler and does not depend on the state of the currently loaded program.
     
Loading...