2019-11-08 08:28 AM
I am switching my project from an STM32F4 MCU to an STM32F1 MCU and am stuck on this one issue where a function I previously used to get the input capture period of a timer on the F4 series chip does not exist for the F1 series chip.
Why might this be? Does that mean the F1 series of MCUs do not support input-capture modes on timers?
// Input Capture callback in non blocking mode.
void HAL_TIM_IC_CaptureCallback (TIM_HandleTypeDef * htim) {
if (htim->Instance == TIM4) {
inputCaptureOld = inputCaptureNew;
inputCaptureNew = __HAL_TIM_GetCompare(&htim4, TIM_CHANNEL_1); // read TIM4 channel 1 capture value
__HAL_TIM_SetCounter(&htim4, 0); // reset counter to zero after input capture interupt occurs
}
}
Above is the code I had for the F4 chip to capture the period of an external clock signal on channel 1.
2019-11-13 02:56 PM
You are supposed to use the HAL_TIM_ReadCapturedValue() function, rather than the macros, to read the captured value.
JW
PS. Please change your username to a normal nick