CH32V203程序代碼不使用FreeRTOS時,USB-FS-CDC? 串口2DMA發(fā)送,串口2DMA接收,空閑中斷保存DMA接收數(shù)據(jù)? ?功能都是是OK的
加上FreeRTOS時,USB-FS-CDC正常工作,FreeRTOS的兩個任務(wù)正常運(yùn)行,串口2DMA發(fā)送不能進(jìn)入DMA發(fā)送完成中斷,串口2空閑中斷也無法進(jìn)入。
加上FreeRTOS時文件修改了:
void USBFS_IRQHandler(void) __attribute__((interrupt()));
void USART2_IRQHandler(void) __attribute__((interrupt()));
void DMA1_Channel7_IRQHandler(void)__attribute__((interrupt()));
中斷優(yōu)先級設(shè)置如下
void NVIC_uart2_Configuration(void)
{
? ? NVIC_InitTypeDef NVIC_InitStructure;
? ? NVIC_InitStructure.NVIC_IRQChannel = USART2_IRQn;
? ? NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
? ? NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
? ? NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
? ? NVIC_Init(&NVIC_InitStructure);
? ? NVIC_InitStructure.NVIC_IRQChannel = DMA1_Channel7_IRQn;?
? ? ?NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=1;
? ? NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
? ? NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
? ? NVIC_Init(&NVIC_InitStructure);
}
main函數(shù)中中斷設(shè)置如下
?NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);