2015-07-30 05:17 AM
Hello
I generated code using CubeMX in order to measure a pulse (20µs - 100ms). TIM2 is what I am using for that. In the HAL_TIM_IC_CaptureCallback I am checking the value in the CCR1 register. I am expecting that inside CCR1 the captured value will reside. Unfortunately there is always the preload value as it was configured during initialization of TIM2. Is there something I messed up? I assume that the timer is not counting at all. Is there a way to proof this?2015-07-30 06:17 AM
You could watch TIM2->CNT incrementing.
If it's not incrementing check the TIM2 APB clock is enabled.If it's not capturing, and flaging a capture event, you'll have to check how it's configured, and if the external signal is present on the correct pin.Not much detail to work with here.2015-07-31 03:38 AM
Hi kostorz.lukas,
After code generation with CubeMX, what did you added to your main.c file?CubeMX will only generate initialization code.Refer to examples under ''STM32Cube_FW_F0_V1.3.0\Projects\USED_BOARD\Examples\TIM\TIM_InputCapture''.-Mayla-To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.