帮忙看看 (AT-START-F421 V1.1):
Artery AT32 MCU Pack_20201130\BSP\AT32F4xx_StdPeriph_Lib_V1.2.8\Project\AT_START_F421\Examples\USART\Interrupt\
问题:
1.PC发送数据,it.c中,检测不到接收标志
2.USART_ClearITPendingBit() 函数不起作用,操作寄存器才行
uint32_t status_uart1;
void USART1_IRQHandler(void)
{
// if(USART_GetITStatus(USART1, USART_INT_RDNE) != RESET)
// { USART_ClearITPendingBit(USART1,USART_INT_RDNE);
// }
//
// if(USART_GetITStatus(USART1, USART_INT_TDE) != RESET)
// { USART_ClearITPendingBit(USART1,USART_INT_TRAC);
// }
status_uart1 = USART1->STS;
if(status_uart1 & 0x00000060) //TRAC
{
USART_ClearITPendingBit(USART1,USART_INT_TRAC);
status_uart1 = USART1->STS;
USART1->STS &= ~0x00000060;
status_uart1 = USART1->STS;
}
else if(status_uart1 & 0x00000020) //RDNE
{
USART_ClearITPendingBit(USART1,USART_INT_RDNE);
status_uart1 = USART1->STS;
USART1->STS &= ~0x00000020;
status_uart1 = USART1->STS;
}
status_uart1 = USART1->STS;
USART_ClearITPendingBit(USART1,USART_INT_RDNE);
status_uart1 = USART1->STS;
USART_ClearITPendingBit(USART1,USART_INT_TRAC);
status_uart1 = USART1->STS;
}
|