-
HC32L17系列串口通信问题 sos
案例代码都是用9600作为波特率与串口通信,结果没问题,但是调到115200后,出现了乱码,发现是实际波特率的问题,于是用示例的App_RCH4MHzToPll48MHz代码,调到48MHZ,实际串口没问题,但是在与4G模块通信时,还是会出现数据缺失的问题 [img]data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGgAAAA5CAIAAABVrPmkAAADzElEQVR4Ae2b304UMRTG2+EhCL6T+iQ+A2IiJhhUWFB2V99IvBFv8AITRVxEVEBv1wyHfPvtaedfZ2eFUkLI1zPntD2//pkys2vs4Nz2z2z/t935ZV+d2pc/7PZ32xvZzSO7cWiff7brB3Zt3zx+bx7uLt19sLi4OB6PTfppA255bORXMHKR7XFCDga3TNMO2hVxUjPGdAEO+KKlZozJhhfZ4DwbnJXvcXZ1z668W7o32eOYDnT8KxRzYebgjMk3vvh/ugB3K9glcIGLIxicTCve1G7XcaQNuMCxiiMsgQscxwQuEJwdXuRn4IH8u/oz/3d1+8RuHdveN7v51b74YtYPzNq+Wd0zK2/5HBfYXjRhLcHxkQ03B75juKDYje8wqIodxIgKcYkD3SbmYZktOJzgQEFyQBECnl7BRm8N3nrmwQtttAfHObgJe9NG6yVX3WrFwn9VuKq222IbcG4OLjgsLgg3H++lcnCoRLnB3rnoGpwkgPQgOLE6RvERxIj1BuJqt6IlOHeyeJOBEYKzqmMUn3jASf6cOWumU+LpDVFGFCHcyudqqZxx9tkn+/SjffJBneN48KHdCegmo3xUUXZJGAUTimoP/Z8Qg8G5RG6XJYELHO8ELoELJBAYNtsZh11cberYxdmBffieUCcTrkf82YLm3JuJarROW36f9uDQSwjuLowQfBU5K+Hv67QVFZaIorYQMl1lk1JH4NAFdBHCm4xcLfFBhRBwVgJF8ZSZqKKUD642EPXB2Ue76nmcWh3e3sCH+6Q8kZuyc4ir3Zq9FjVO0kSjhtymc0sbcFIjOgHBLdUxig/wcXiJRhR86lgUR8Q2FjcdHINwBwlzkC+xbswLAe3BoSruEDQE3DhVMcIHgp2LNJwbCbf1ovor7DMEJ33iFYcBRydggRssKiXgQCwLFYUiBDojUWKHsbxybqhQzxZcYTPxXUjgAsc0gQsEt/Dmb/5Oenh++THgq/eqWf4x4Kv3qnge557jApuMI8wLjl9IJ3D+gU7g/FwqrdnrP+5STTOukptJ4KoZeT3SUvViqTYmcNWMvB4JnBdLtRF73OVXHeQcd2q3Tha2j7PeUbZxyMeRO/cn33Oorjpuj0bg1IPMuMlUZOcDl38i0zvjErgJzSJw2dbIXaoJXAI3IRCoimZcnaXKTw3VM0I8OAzs1vUPCwbHD1GhXXH9CQT2sAtwwBfYpxsRxuCy/uXX8qe/58DnOL45MB3o+FcoBtULzvRGlQ8yAYtfsoiRL6Gh2EQX4BhlbLyQTwIHFM1EMDh1/lDF6De7f28tAO9q96A8AAAAAElFTkSuQmCC[/img] 发送AT+CPIN?后,应该回复+CPIN:READY,但实际转发到串口查看,缺少数据D,实际代码也没往下跑,因为接收数据缺失 在检测4G模块正常的情况下,是哪里出现了问题?代码如下: /*author ljx*/ #include "hc32l17x.h" #include "uart.h" #include "gpio.h" int RxCount=0;//接收缓冲区坐标 char RxBuffer[1000];//接收缓冲区 //串口引脚配置 void usart1_Init(void) { stc_gpio_cfg_t stcGpioCfg; stc_uart_cfg_t stcCfg; stc_uart_baud_t stcBaud; DDL_ZERO_STRUCT(stcGpioCfg); DDL_ZERO_STRUCT(stcCfg); DDL_ZERO_STRUCT(stcBaud); Sysctrl_SetPeripheralGate(SysctrlPeripheralGpio,TRUE); //使能GPIO模块时钟 ///
=1000) RxCount=0; //字符数组满了,从头再来 } } 179浏览量 0回复量 关注量