cancel
Showing results for 
Search instead for 
Did you mean: 

Unexpected PB3 behavior with connected st-link

shiawasenapluto
Visitor

Moved from Feedback forum.

The Feedback forum is for feedback about the forum itself - not product questions.


Hello! During project debugging i encountered with follow situation. I have a led connected to PB3 pin (configured as output push-pull with low level by default) on STM32F103 and it turns on during debugger connecting and programming (i program empty flash) process and before the main program entering. I full erased flash then with STM32CubeProgrammer, but PB3 still raises high while debugger(ST-Link V2) is connected.
After power toggling i downloaded under IAR debug with st-link other firmware and the pin behaves as expected (stays low).

I also generated empty project with CubeMx (only external oscillator and SWD enabled) to see how PB3 would behave. After IAR debug session started it stays low. So, i suppose the problem is in firmware, but i can't understand where i should search it.  All projects are generated in CubeMx 6.13 and debugged with IAR 9.60, HAL drivers version is V1.8.5

2 REPLIES 2
Andrew Neil
Super User

Welcome to the forum.

Please see How to write your question to maximize your chances to find a solution for best results; in particular:

  • What board are you using - if a custom board, show schematics;
  • Are you sure this is a genuine STM32, and a genuine ST-Link?
A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
TDK
Super User

PB3 is SWO by default. Makes sense that it may not be idle.

Once you set it to output, it should behave as an output. With flash erased, it will remain as SWO.

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