2017-09-18 04:25 AM
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.2017-09-18 01:34 PM
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
2017-09-19 04:37 AM
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=falseF5_hang.png : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hy8D&d=%2Fa%2F0X0000000b7e%2FmibobpCb4hLB4SZmqa25kvNpHLGOtK0p8eaaNj7ka.c&asPdf=false2017-09-19 06:52 AM
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
Regards
VF
2017-09-19 07:13 AM
Hello Vangelis,
I use SWD.
main.c and ioc are attached. The only my code is GPIO LED toggling to
control the PCB alive in the main circle. Everything else is generated
by stm32cubemx.
Regards,
Boris.
2017 14:53, Vangelis Fortounas пишет:
>
STMicroelectronics Community
<https://community.st.com/?et=watches.email.thread>
>
Re: MX_TIM2_Init() hangs debugging
reply from Vangelis Fortounas
<
in /STM32 MCUs Forum/ - View the full discussion
<https://community.st.com/message/169121-re-mxtim2init-hangs-debugging?commentID=169121&et=watches.email.thread#comment-169121>
>
________________ Attachments : Sk8129.ioc.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyRR&d=%2Fa%2F0X0000000b7f%2FPFqHoPufjeVDfXhla_PXA2PKjoXT_LCsQDjB9LiK6kE&asPdf=falsemain.c.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyRM&d=%2Fa%2F0X0000000b7d%2FUA5putMK58y1P__3CcchYkBINrB2WwxEc0sbFHaHN4s&asPdf=false2017-09-19 09:38 AM
I can't understand how this code generated.
__HAL_AFIO_REMAP_TIM2_ENABLE() is a full TIM2 Remap (remaped to B11, B10, B3, A15 pins)
But according to your IOC file you can't sellect PB11, PB10 because are reserved as GPIO outputs.
I use an updated version of CubeMx 4.22.1
regards
vf
2017-09-19 09:55 AM
Excuse me,
I have sent a wrong ioc and code. Correct ones are attached.
Regards, Boris.
2017 17:38, Vangelis Fortounas пишет:
>
STMicroelectronics Community
<https://community.st.com/?et=watches.email.thread>
>
Re: MX_TIM2_Init() hangs debugging
reply from Vangelis Fortounas
<
in /STM32 MCUs Forum/ - View the full discussion
<https://community.st.com/0D70X000006T0qSSAS
>
________________ Attachments : main.c.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyN2&d=%2Fa%2F0X0000000b7W%2F2V2IdfxkR2Xny_VNate60sGTCe_VInwCNvLE7.a8mPc&asPdf=falseSk_big_ind.ioc.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyAo&d=%2Fa%2F0X0000000b7S%2Fv_Bs3H5nVRPkcMvIfwtoDRQBC5yzCqbJi4Ux36c5QMU&asPdf=false2017-09-19 05:17 PM
Hello Boris
I ran your code in my STM32F103ZET custom board (LQFP144 same datasheet, i don't have the same MCU)
and initialized without problem.
I used an onboard STLink from an ST board (clock,data, ground). I use W10 with sw4stm32 version 4.6.3
So.. check if Stlink has last firmware, also for sw4stm32. Remove all connections between Stlink and board except the four basics : SWCLK SWDIO RESET GND .
RGRDS
vf
2017-09-20 05:19 AM
Hello Vangelis,
I use last versions of cubemx, sw4stm32 and stlink and only 4 wires from
stlink.
It seems the problem is in __HAL_AFIO_REMAP_TIM2_ENABLE();
I add to the project TIM1 and TIM5 (with 4 input capture channels).
MX_TIM5_Init() is OK. MX_TIM1_Init() hangs. CubeMx generates
__HAL_AFIO_REMAP_TIMx_ENABLE() for TIM1, TIM2. This function is not in
TIM5, TIM3 and TIM8.
It is possible that __HAL_AFIO_REMAP_TIMx_ENABLE() is not generated for
STM32F103ZET at all. For example __HAL_AFIO_REMAP_TIMx_ENABLE() is
absent in STM32F103RBT6 code.
Could you please send me your ioc file ащк STM32F103ZET or find
__HAL_AFIO_REMAP_TIMx_ENABLE() in
HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base)?
Thank you for assistance.
Regards, Boris.
2017 01:18, Vangelis Fortounas пишет:
>
STMicroelectronics Community
<https://community.st.com/?et=watches.email.thread>
>
Re: MX_TIM2_Init() hangs debugging
reply from Vangelis Fortounas
<FORTOUNAS.EVANGELOS?et=watches.email.thread>
in /STM32 MCUs Forum/ - View the full discussion
<https://community.st.com/message/169165-re-mxtim2init-hangs-debugging?commentID=169165&et=watches.email.thread#comment-169165>
>