2021-02-04 03:51 AM
Hi
I am using CubeMX to setup a project to measure pulses using Timer 3 Input capture. However I am not hitting the Timer 3 interrupt.
I have on my main code:
int main(void)
{
uint8_t test;
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_I2C1_Init();
MX_SPI1_Init();
MX_TIM2_Init();
MX_TIM3_Init();
MX_TIM6_Init();
MX_USART1_UART_Init();
MX_USB_PCD_Init();
/* USER CODE BEGIN 2 */
HAL_TIM_Base_Start(&htim2);
HAL_TIM_PWM_Start(&htim2,TIM_CHANNEL_1);
HAL_TIM_PWM_Start(&htim2,TIM_CHANNEL_2);
HAL_TIM_PWM_Start(&htim2,TIM_CHANNEL_3);
HAL_TIM_PWM_Start(&htim2,TIM_CHANNEL_4);
//__HAL_TIM_SET_COMPARE(&htim2, TIM_CHANNEL_2, 50);
/* USER CODE END 2 */
HAL_TIM_IC_Start_IT(&htim3, TIM_CHANNEL_1);
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
test++;
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
But I had found on the web, there is should be a callback for Input capture like this:
void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef * htim)
Any suggestions to get CaptureCallback interrupt generated?
Thanks
2021-02-04 01:52 PM