标题:
STM32和openmv串口通讯运行速度变慢
[打印本页]
作者:
liuchao626
时间:
2021-2-17 09:27
标题:
STM32和openmv串口通讯运行速度变慢
1.使用了仿真器下载程序
2.可以正常收发数据
3.在拔掉openmv串口后,程序起飞,正常运行
4插上串口后,一行代码大概跑0.5秒,屏幕刷新很慢
视频中黑屏是放下手机在插线,各位大佬移步观看视频(GIF)。
11111.gif
(13.29 MB, 下载次数: 167)
下载附件
2021-2-17 09:26 上传
作者:
kaixuan_27
时间:
2021-2-17 09:27
没有清除串口接收中断标志。
void DEBUG_USART_IRQHandler(void)
{
if(USART_GetITStatus(DEBUG_USARTx,USART_IT_RXNE)!=RESET)
{
temp_head[0] = USART_ReceiveData(DEBUG_USARTx);
}
USART_ClearITPendingBit(DEBUG_USARTx, USART_IT_RXNE);
USART_ClearFlag(DEBUG_USARTx, USART_FLAG_RXNE);
}
作者:
liuchao626
时间:
2021-2-17 09:34
这是串口中断
void DEBUG_USART_IRQHandler(void)
{
if(USART_GetITStatus(DEBUG_USARTx,USART_IT_RXNE)!=RESET)
{
temp_head[0] = USART_ReceiveData(DEBUG_USARTx);
}
}
复制代码
这是显示数据的代码
while(1)
{
Gui_DrawFont_GBK16(5,5,BLUE,BLACK,"任务显示:");
Gui_DrawFont_GBK16(5,55,BLUE,BLACK,"进程:");
Gui_DrawFont_Num32(0 ,20,GREEN,BLACK,Num[2]);
Gui_DrawFont_Num32(0 ,20,BLACK,BLACK,Num[2]);
Gui_DrawFont_Num32(0 ,20,GREEN,BLACK,Num[3]);
Gui_DrawFont_Num32(0 ,20,BLACK,BLACK,Num[3]);
Gui_DrawFont_Num32(0 ,20,GREEN,BLACK,Num[4]);
Gui_DrawFont_Num32(0 ,20,BLACK,BLACK,Num[4]);
Gui_DrawFont_Num32(25,20,GREEN,BLACK,Num[2]);
Gui_DrawFont_Num32(50,20,GREEN,BLACK,Num[3]);
Gui_DrawFont_GBK16(82,30,RED,BLACK,"+");
Gui_DrawFont_Num32(90,20,GREEN,BLACK,Num[1]);
Gui_DrawFont_Num32(115,20,GREEN,BLACK,Num[2]);
Gui_DrawFont_Num32(140,20,GREEN,BLACK,Num[3]);
USART_SendData(DEBUG_USARTx,0xA2);
sprintf((char*)cx_buf,"cx:%08X",temp_head[2]);
Gui_DrawFont_GBK16(5,80,RED,BLACK,cx_buf);
复制代码
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1