cancel
Showing results for 
Search instead for 
Did you mean: 

Debug problems with STM32F030

David Martins
Senior
Posted on March 26, 2017 at 21:35

Hello.

I'm trying to debug code on STM32F

SWD debug wire is enabled.

I can get into debug mode!

The problem is that the code blocks whenever a HAL_Delay() occurs.

I think the problem is related to systick timer, because the program counter does not move from here.

I do not know how to solve this problem.

Look at this picture.

https://spostimg.org/5hk0ey4b5/Capturar.jpg

The code is very simple, as you can see here.

https://s3.postimg.org/wsyj52ecj/Capturar.jpg

#hal-v1.7.0 #eclipse-debug #systick #stm32f0

Note: this post was migrated and contained many threaded conversations, some content may be missing.
9 REPLIES 9
Posted on March 27, 2017 at 02:18

Make sure that SysTick is enabled, you have a proper handler, and the vector table links correctly

In stm32f0xx_it.c

/**

* @brief This function handles SysTick Handler.

* @param None

* @retval None

*/

void SysTick_Handler(void)

{

HAL_IncTick();

}
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on March 27, 2017 at 09:57

The MCU settings were made with CubeMX.

By default this handler should be enabled.

I went to check and everything is OK.

https://spostimg.org/kp3cpj0jr/Capturar.jpg

This situation is very strange.

Not using debug is not an option for me.

It was the only free connection I left on my PCB

:(

.

Posted on March 27, 2017 at 15:21

>>

This situation is very strange.

There are still only a handful of reasons why it is not working. CubeMX only saves you from knowing what's going on, and that's only helpful until it gets things wrong. If everything was OK, it would work. I doubt the debugger is stopping SysTick from working.

Is it treating the stm32f0xx_it.c file as a .cpp or C++ file? Does the handler get called, break-point it?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on March 27, 2017 at 20:26

The file is treated as C/C++.

In fact the handler is not called.

I put a breakpoint and it never gets there.

If I do not debug, the code runs and the LED flashes.

I will try change some project properties.

Posted on March 27, 2017 at 21:14

Very odd, not familiar with the tool chain you are using.

For .cpp or C++ make sure interrupts are of the form extern 'C' void SysTick_Handler(void)

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on March 27, 2017 at 21:39

Bahh..

I' getting this again.

https://spostimg.org/gm5xodtc1/image.jpg

Posted on March 28, 2017 at 00:28

I'm definitely not getting any breakthrough.

I created a new, simple project, to just blink an LED.

I can use ST-Link to program without problems ... but I can not debug.

Here is the project.

https://meocloud.pt/link/598784ec-fa1d-42d8-af76-7cb16e4d0636/debug.rar/

 

What am I doing wrong?

At work I'm using a setup very similar to this, but with an STM32F302.

The debug runs smoothly.

Posted on March 28, 2017 at 01:45

RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL12; // Are we sure x12 is reasonable, try x6

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
zhivko zivkovic
Associate III
Posted on March 30, 2017 at 10:21

I use AC6 Eclipse eveloping environment with BlackMagic probe (that is hardware GDB server:

https://github.com/blacksphere/blackmagic/wiki

), and for me it seems that debugger is stoping freezing whole processor also interrupts calling SysTIck_Handler() - so I think this is completely normal operation and it is not possible that interrupts are called while you are in debug mode.

I was also asking same thing in ##stm32 irc forum, and guys confirmed that.

However if there is possibility the interrupts to run while debugger is holding uC at some line I would be very thankful if somebody explains how to do that (preferebly in AC6).

I am developing some motor PID project that runs on stm32f3 that I could use that feature very much.

https://github.com/zhivko/EclipseStm32

 

I have also used CubeMX to produce lower layer code.