CH32V203程序代码不使用FreeRTOS时,USB-FS-CDC 串口2DMA发送,串口2DMA接收,空闲中断保存DMA接收数据 功能都是是OK的
加上FreeRTOS时,USB-FS-CDC正常工作,FreeRTOS的两个任务正常运行,串口2DMA发送不能进入DMA发送完成中断,串口2空闲中断也无法进入。
加上FreeRTOS时文件修改了:
void USBFS_IRQHandler(void) __attribute__((interrupt()));
void USART2_IRQHandler(void) __attribute__((interrupt()));
void DMA1_Channel7_IRQHandler(void)__attribute__((interrupt()));
中断优先级设置如下
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函数中中断设置如下
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);