cancel
Showing results for 
Search instead for 
Did you mean: 

how to learn STM32 Debugger?

AA.21
Associate II

I had one STM32 debugger (ST-LINK-v2). how to learn the STM32 debugger and how to connect the stm32 chip to the debugger. give any solution or tutorial.

I will be waiting for your replays. Thank you.

20 REPLIES 20

As far as I know stm32cubeprogrammer allows you to interact with the bootloader built into stm32 microcontrollers over e.g. UART. With it, if you put an stm32 microcontroller in boot mode, you can download FLASH code, erase FLASH or program option bytes.

But it does not allow debugging.

On the other hand, if you use stm32cubeide, you can connect directly to the stm32 microcontroller via STLink using SWDIO and SWCLK. Then you can really debug. You can start running your program in debug mode (the button that looks like a small beetle) with e.g. a breakpoint where you suspect something wrong is happening. When the arm microcontroller hits that breakpoint it will stop and allow you to examine all the variables and registers, to help you work out how it got there. Maybe in the light of this you want to add another breakpoint and start afresh, or maybe change one of the variables and continue execution, perhaps even line-by-line of code. This is all possible within stm32cubeide.

Once you decide you need to change the source-code, you can edit it and then hit "debug" again - stm32cubeide will rebuild your code, download it into flash memory and it will pause at the entry to main(). Place additional breakpoints as needed and start executing.

As long as your code doesn't disable the SWDIO and SWCLK function, you can keep debugging without having to enter the bootloader.

(Others more experienced than me with the stm32cube range - please correct me if I've said something misleading).

Hope this helps,

Danish