cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407 pulls up pins when debugging

erincyldz
Associate III

Hello people, i am making a project using STM32F407VG and i am using a timer that drives a laser. The problem is, when debugging STM is probably pulling couple of its pins to High state before i start F8 (between pressing the 'Debug' button and F8 to stop the program waiting at HAL_Init() function after i run the code it switches back to LOW state ) and messes up with my laser circuit. I want to know which pins go to High state and why, and see if i can control it i really have to deny it pulling to high state. Thanks for the help. Have a great day !  

1 ACCEPTED SOLUTION

Accepted Solutions

No, there is no way to change the default pin states upon reset.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

9 REPLIES 9
TDK
Guru

A few pins are initialized as debug pins by default, but the vast majority of pins are initialized as input.

Which pins are you having issues with? Pins that are not in input mode after reset are PA13, PA14, PA15, PB3, PB4.

If you feel a post has answered your question, please click "Accept as Solution".
Sarra.S
ST Employee

This is typically due to the default configuration of these pins under reset or during boot

If you are using JTAG for example, JTAG pins maintain their pull-up and pull-down resistor settings even under reset

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

is there any way to control this? i am using SW debug btw

No, there is no way to change the default pin states upon reset.

If you feel a post has answered your question, please click "Accept as Solution".

Probably going to need some better interlock / fail-safe mechanisms, so that dead-stopping in debug, fault or watch-dog conditions don't cause dangerous conditions to occur or persist.

Watch also what DBGMCU does with suspending TIM, clocks, etc.

Have your system be aware it's running under a debugger.

Might also look under the MOTORs sections / docs as this might address similar situations

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Michal Dudka
Senior III

How do you control state of used GPIOs when they are not initialised (MCU in reset state, or starting up) ? Are they equiped with some external pulldowns or left floating ?


@Michal Dudka wrote:

How do you control state of used GPIOs when they are not initialised (MCU in reset state, or starting up) ? 


You can't - the reset state is defined by the hardware.

As others have already said, most GPIOs default to being inputs.

For full details, see the datasheet.

Of course i can. For example by external pull-up/pull-down resistors. By my qustion i only want to rule out the possibility that his "laser control output" is left floating during reset/startup. Because in that case it can reach any value, due static charge, or by its "load" and can be misinterpreted as MCU intentional action.

I mean, you can't control the the pin states by any configuration or programming of the microcontroller;  so, yes - you have to do it by external hardware.