2023-06-06 03:15 AM - edited 2023-11-20 03:50 AM
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
if(htim->Instance == TIM2)
{
LL_GPIO_TogglePin(CLK_GPIO_Port,CLK_Pin);
}
}
USB_printf("1");
HAL_TIM_Base_Start_IT(&htim2);
USB_printf("2");
After receiving 1, the serial assistant no longer receives it and has no reaction when stuck, the pin turns over normally, and the callback function executes normally.
2023-06-06 05:10 AM
833 KHz? Really? :face_with_medical_mask:
2023-06-06 06:28 PM
I want to output a 4MHz frequency clock signal.Can't it do that?
2023-06-07 03:54 PM
For such purposes timers have output channels, which can generate PWM. Read the reference manual and application notes.
2023-06-07 07:56 PM
Good day.
I do what you suggest,it works.But it can noly generate PWM,if i use HAL_TIM_PWM_Start_IT() to start PWM,it will happen the same thing.Now i have to turnover other pin's level(its frenquency is different form PWM) when the PWM turnover.How can i do it?
Thanks for your suggestions.