Skip to main content
Boris Hoz
Associate II
September 18, 2017
Question

MX_TIM2_Init() hangs debugging

  • September 18, 2017
  • 1 reply
  • 2602 views
Posted on September 18, 2017 at 13:25

Hi,

I use Stm32CubeMX v4. It creates the code for TIM2, TIM3 and TIM8 (STM32F103VCT, custom board). All timers have 'Clock Source == Internal Clock' and 4 channels configured to 'Input Capture direct mode'. When I debug the code with sw4stm32 v2.2.1 (ubuntu 04 x64) there is not return from 'Step over' debugging in MX_TIM2_Init(). Debugging hangs. The code is attached.

After that in addition the only way to reload (or erase) the code is to connect the reset pin of St-link v2 to MCU NRST and use 'Reset Mode == Connect under reset'.

When I comment MX_TIM2_Init() debugging is OK with 'Reset Mode == Software system reset'.

Is there a way to debug with TIM2?

Thanks for assistance,

Boris.

#tim2-debugging #stm32cubemx

Note: this post was migrated and contained many threaded conversations, some content may be missing.
This topic has been closed for replies.

1 reply

Vangelis Fortounas
Associate II
September 18, 2017
Posted on September 18, 2017 at 22:34

Hello !

The initialization code seems normal.

Is stack size appropriate? .(use callgraph to observe the maximum stack usage).

>>>there is not return from 'Step over' debugging in MX_TIM2_Init().

what about 'Step Into'? Do you have the same result?

Regards

vf

Boris Hoz
Boris HozAuthor
Associate II
September 19, 2017
Posted on September 19, 2017 at 11:37

Hello,

thank you for advices.

I can not run callgraph in sw4stm32 - 'Unhandled event loop exception

java.lang.StackOverflowError'. I increase 'Minimum stack size' in

stm32cubemx 2 times to 0x800. No effect.

I attached screens for 'Step Into'. Debugging hangs in line 112

stm32f1xx_hal_msp.c __HAL_AFIO_REMAP_TIM2_ENABLE();

Regards,

Boris.

2017 23:35, Vangelis Fortounas пишет:

>

STMicroelectronics Community

<https://community.st.com/?et=watches.email.thread>

>

Re: MX_TIM2_Init() hangs debugging

reply from Vangelis Fortounas

<https://community.st.com/people/FORTOUNAS.EVANGELOS?et=watches.email.thread>

in /STM32 MCUs Forum/ - View the full discussion

<https://community.st.com/message/169081-re-mxtim2init-hangs-debugging?commentID=169081&et=watches.email.thread#comment-169081>

>

________________

Attachments :

F5_before_hang.png : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyRW&d=%2Fa%2F0X0000000b7g%2FRGAC_baRLqlSUFBnIS6HLeypLgw3W3yZFJv24xysckU&asPdf=false

F5_hang.png : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hy8D&d=%2Fa%2F0X0000000b7e%2FmibobpCb4hLB4SZmqa25kvNpHLGOtK0p8eaaNj7ka.c&asPdf=false
Vangelis Fortounas
Associate II
September 19, 2017
Posted on September 19, 2017 at 13:52

Hello Boris

Are you use JTAG ?

__HAL_AFIO_REMAP_TIM2_ENABLE()   remaps CH1 to PA15, CH2 to PB3.  Theese pins used by JTAG also.

In this case is normal to have  ''hang'' . (JTAG can not communicate)

If you don't mind , post your .Ioc file  and also the code before the

0690X00000608I7QAI.png

Regards

VF