完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
您好朋友,我有一个PIC32 MX795F512L与UART配置通过使用FTDI到PC应用的通信。在我的配置中,我有一个设定的BUAD率100000 BPS的硬件和软件。下面是我在CODRESIGETETABDATUFFER()上面的代码,在主循环中接收到特定的命令和处理。在上面的配置中,我已经完全发送和接收命令。但是实际问题是假设我已经通过PC命令发送,如{7q05},{7p5000 },{7Z05},{7e5}},{3uM+},{3xM+},{3ZM,{3ZM。+}…同时也接收相同的命令,但是每当UART ORR错误设置时,我错过了上述包{7q05}、{7p5000 }、{7Z05}、{7e05}、{3uM+}、{3xM+}、{3ZM+}中的一个。当Uart Oerr只检测时间的时候,但是当UART ORR没有检测到时,我已经完全收到了所有命令。那么,任何解决UART ORR设置的解决方案,我也必须阅读我的整个缓冲区吗?
以上来自于百度翻译 以下为原文 Hello Friends, I have a PIC32MX795F512L configure with UART via comunication using FTDI to PC Application. In My configuration I have a set Buad Rate 1000000bps both hardware and software. Below is My code #define SYS_FREQ (80000000L) #define DESIRED_BAUDRATE (1000000) //The desired BaudRate void TimerandUartInit(void) { int pbClk; pbClk = SYSTEMConfig(SYS_FREQ, SYS_CFG_WAIT_STATES | SYS_CFG_PCACHE); OpenUART2(UART_EN |UART_NO_PAR_8BIT | UART_2STOPBITS , // Module is ON UART_RX_ENABLE | UART_TX_ENABLE | UART_RX_OVERRUN_CLEAR, // Enable TX & RX pbClk/16/DESIRED_BAUDRATE-1); // 1000000 bps, 8-N-1 UARTSetFifoMode(UART3A, UART_INTERRUPT_ON_TX_NOT_FULL | UART_INTERRUPT_ON_RX_NOT_EMPTY); ConfigIntUART2(UART_RX_INT_EN | UART_TX_INT_DIS | UART_ERR_INT_EN | UART_INT_PR1 ); } CHAR dummy; void __ISR(_UART_2_VECTOR, ipl1) IntUart2Handler(void) { if(IFS1bits.U3ARXIF) { if(U3ASTAbits.OERR != 0) { SerialGetDataBuffer(); U3ASTAbits.OERR = 0; IEC1bits.U3ARXIE = 0; IEC1bits.U3ARXIE = 1; } else { if ((U3ASTAbits.FERR != 0) || (U3ASTAbits.PERR != 0)) { dummy = U3ARXREG; U3ASTAbits.FERR = 0; U3ASTAbits.PERR = 0; } else { SerialGetDataBuffer(); } } //while (U3ASTAbits.URXDA != 0); IFS1bits.U3ARXIF = 0; } if(IFS1bits.U3ATXIF) { IFS1bits.U3ATXIF = 0; } if(IFS1bits.U3AEIF) { IFS1bits.U3AEIF = 0; } } // Uart Handler in above code SerialGetDataBuffer() received particular command and processing in main Loop. in above configuration i have completely send and receive command . But actual Problem is Suppose i have send through PC command like {7Q50000} ,{7P50000}, {7Z50000},{7E50000}, {3UM+},{3XM+},{3ZM+} ... And also receive same command but whenever UART OERR error set that time i have miss the one of the above packet {7Q50000} ,{7P50000}, {7Z50000},{7E50000}, {3UM+},{3XM+},{3ZM+} THIS highlighted command is missing. when Uart Oerr Detect that time only . but when is UART OERR not detect that time i have received completely all command. So is that any solution to overcome UART OERR set that time also i have to read my whole buffer? |
|
相关推荐
14个回答
|
|
你能显示SerialGETDATABUFER()的代码吗?Ruben
以上来自于百度翻译 以下为原文 Can you show the code for SerialGetDataBuffer()? /Ruben |
|
|
|
下面的代码是我的收发代码和主循环比较匹配字符串和处理数据。 以上来自于百度翻译 以下为原文 ok below is code CHAR ReceiveData[20], ProcessCommand[20]; void SerialGetDataBuffer(void) { char Command, Count = 0; mLED_1_On(); Command = U3ARXREG; if(Command == '{') { for(Count = 0; Count < 20; Count++) { ReceiveData[Count] = ' |