2025-10-30 2:24 PM
Hello Expert,
I am working on an STM32F303VET6 project using the MCSDK. I want to configure TIM16 to generate a 10 ms periodic interrupt . However, I noticed that on this MCU, TIM16 shares its NVIC vector with TIM1 (TIM1_UP_TIM16_IRQHandler), which is already used by MCSDK for motor control.
Could you please advise:
Can I safely use TIM16 for my 10 ms task while TIM1 is used by MCSDK?
If yes, what is the recommended way to handle the shared interrupt?
Are there any potential conflicts or timing issues I should be aware of?
In MCSDK- 6.41 , #define TIMx_UP_M1_IRQHandler TIM1_UP_TIM16_IRQHandler
void TIMx_UP_M1_IRQHandler(void)
{
/* USER CODE BEGIN TIMx_UP_M1_IRQn 0 */
/* USER CODE END TIMx_UP_M1_IRQn 0 */
LL_TIM_ClearFlag_UPDATE(TIM1);
R3_2_TIMx_UP_IRQHandler(&PWM_Handle_M1);
TSK_DualDriveFIFOUpdate(M1);
/* USER CODE BEGIN TIMx_UP_M1_IRQn 1 */
/* USER CODE END TIMx_UP_M1_IRQn 1 */
}
Solved! Go to Solution.
2025-10-30 11:53 PM
No need for 10ms interrupt - add some code to SysTick ISR to execute every 10 interrupts.
If you want to use the shared interrupt, in the ISR first check the flag to determine which peripheral caused the interrupt, then invoke the proper handler only if the flag is set.
2025-10-30 8:26 PM
My suggestion would be to not write additional code in the interrupt routine but just update a flag and in the while loop check for the flag and perform the action. This is the safest method i assume you have to verify the 10ms period by toggling a port and confirming the behavior.
2025-10-30 11:53 PM
No need for 10ms interrupt - add some code to SysTick ISR to execute every 10 interrupts.
If you want to use the shared interrupt, in the ISR first check the flag to determine which peripheral caused the interrupt, then invoke the proper handler only if the flag is set.