本帖最后由 1983万年青 于 2021-10-28 15:29 编辑
找到是PWM1中断打开,无法退出导致的, 但是现在不知道为什么PWM1无法退出,我外部信号都没有接,设置的还是上升沿中断,还在研究什么原因导致;
PWM1输入捕获中断优先级3级; 另外PWM0输入捕获中断也是打开,
有个疑问,Autogen生成的 PWM输入捕获中断服务函数里面没有清除中断标志位的指令,同时回调函数也没有回调参数定义;
生成的RTC中断函数中有中断标志位清除指令,回调函数也有回调参数;
static void ATC_PWM1_Init(void)
{
/* USER CODE BEGIN PWM1_Init 0 */
/* USER CODE END PWM1_Init 0 */
PWM_SetCallback(PWM1, PWM1_IRQHandler_Callback);
/* USER CODE BEGIN PWM1_Init 1 */
/* USER CODE END PWM1_Init 1 */
MSP_PWM_Init(PWM1);
PWM_InputCaptureInit(PWM1, PWM_CHANNEL_CHANNEL0, PWM_INPUTCAPTURE_RISINGEDGE);
PWM_SetCapturePSCValue(PWM1, PWM_CHANNEL_CHANNEL0, 0);
PWM_ClockSet(PWM1, PWM_CLOCK_SYSTEMCLOCK, 0);
/* USER CODE BEGIN PWM1_Init 2 */
/* USER CODE END PWM1_Init 2 */
}
void PWM1_IRQHandler_Callback(void)
{
/* USER CODE BEGIN PWM1_IRQHandler_Callback*/
/* USER CODE END PWM1_IRQHandler_Callback*/
}
/**
*
* @param[in] none.
*
* [url=home.php?mod=space&uid=266161]@return[/url] none.
*
* [url=home.php?mod=space&uid=247401]@brief[/url] PWM1_Isr interrupt service routine.
*/
void PWM1_IRQHandler(void)
{
if (s_pwmCallback[1])
{
s_pwmCallback[1]();
}
}
RTC中断函数* BKP_IRQHandler
*
* @param[in] none
* [url=home.php?mod=space&uid=266161]@return[/url] none
*
* [url=home.php?mod=space&uid=247401]@brief[/url] override the BKP_IRQHandler
*/
void BKP_IRQHandler(void)
{
if (g_BKPCallback[0])
{
g_BKPCallback[0](BKP_IsTIF(), BKP_IsTEF());
}
BKP_ClrTIF();
BKP_ClrTEF();
}
|