cancel
Showing results for 
Search instead for 
Did you mean: 

GPIO state when unprogrammed

Posted on April 05, 2018 at 07:31

Hello there,

Is there any set state of the GPIO's when the MCU (STM32L4 in my example) is unprogrammed? Or more likelly, when the MCU is in the system bootloader (I believe thats where the program counter is before I flash the MCU with anything). It seems to me that the GPIO are set as outputs HIGH or have pull-ups set.

I would appreciate all help.

#gpio
23 REPLIES 23
T J
Lead
Posted on April 05, 2018 at 07:50

when your processor is reset electrically, I believe all pins are set to input.

your code starts up the clock configuration and pins.

from the cube there is an option to make any unused pin and Analog input.

T J
Lead
Posted on April 05, 2018 at 09:54

Yes many chips have bidirectional reset hardware.

You definitely need the cap, 1uF is a good place to start

did you see this note ?

If the supply voltage at VIN drops below 2.3 V, the current limit is reduced. This can happen

when the input power source becomes weak.

I would increase your input capacitance in parallel with C27, for this issue, maybe add some 1uFs too.

https://www.digikey.com/product-detail/en/texas-instruments/TPS63020QDSJRQ1/296-43286-2-ND/5774166

 

it looks like the EN pin may be puling you up.

did you try to disconnect the processor pin PB8 and recheck the voltage on EN ?

Posted on April 05, 2018 at 07:55

Hi, thanks for answer.

Yes what you have wrote I know, I mean for another situation:

The situation is where there is no code at all, nothing was programmed to the MCU flash memory. The chip just got soldered out of the tray or tape. On power on (reset held high) the MCU enters system bootloader, as there is no code in user flash. What are the GPIO state when MCU is in system bootloader?

Posted on April 05, 2018 at 08:05

generally, the code starts after the hardware Reset, very shortly after Reset

generally Reset is a hardwired electrical impulse.

a Reset pulse travels through the processor chip itself and will reset all the pins functions to input within 2-20uSec at a guess

then the bootloader will start.

all the GPIOs are set to input before you get to the bootloader.

Posted on April 05, 2018 at 08:17

I am experiencing some unexpected behavior then... Please take a look at this schematics:

0690X0000060AR6QAM.png

The EN port is connected to the MCU's PB8 pin (no code in MCU).

In general when EN is pulled HIGH, the Q1 transistor should turn off and U2 should go ON. When pulled low, Q1 goes ON discharging the 3V8 voltage and U2 shutdowns.

My problem is that when I test this circuit I get voltage spikes on EN line, thus, U2 is constantly turned ON/OFF/ON/OFF. You can hear the conductor switching. I started to add capacitance to EN line (between EN and GND). First 100 nF, the spikes became smoother. Then I added 1 uF and spikes no longer occured but the voltage at EN pin was not what I expected: 2.3 V (Mcu is powered from 3.3 V). So even though there is a pulldown on EN line, its state is 2.3 V. Nothing else is connected to this line, so this voltage level has to be forced from the MCU PB8 line...

I experienced similar problems in the past with F4 chips and reset line. I had to use diode because it seems like at startup the reset pin becomes an output for a moment. I dont know if this situation is something common.

What do you think?

Edit: removing the R12 resistor (it was 100k, not 470k) from EN line gives 3.259 V on it (MCU is powered from 3.299 V). Replace R12 with 10k, and EN voltage becomes 0.7 V. This means there is some series resistance on PB8 pin, am I correct? What is this state?

Posted on April 05, 2018 at 10:25

Sorry, I typed it wrong:

At startup the EN has to be held low to turn off the converter and turn ON the Q1, so it is discharging any voltage present on the converter output.

Posted on April 05, 2018 at 11:53

Thank you for further explanation,

Yes I am perfectly fine with another PIN, but I need to make sure either this wont happen on another PIN as well. The MCU i am using is STM32L452VE to be exact but I guess its the same for 472.

Posted on April 05, 2018 at 10:06

Thanks for answer,

I could not find any notes about the EN pin being pulled up in the TPS6320 datasheet. It says there that it cannot be left floating, so I think there is no internall pull up.

As for the note you have mentioned, I am not sure how this reffers to my problem. I think the input voltage of the converter shouldnt have anything to do with EN functionality.

I havent tried disconnecting the PB8 pin. I will do that now and let you know, thanks.

Posted on April 05, 2018 at 10:09

I think I found it, R12 should be a pullup resistor, to shut the FET off when EN is Tristate.

at start up make the PB8 PIN High to Enable U2

pull PB8 low and power will go off momentarily.