This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3200 uart接收数据不完整问题请教

Other Parts Discussed in Thread: CC3200

Ti工程师,好

我利用下面代码来接收uart的数据:

int uartRecvMsg(char *buffer, unsigned short len) {
        int i = 0, j = 0;
        char c;

         while (1) {
                   if (MAP_UARTCharsAvail(CONSOLE) == true) {
                          c = MAP_UARTCharGetNonBlocking(CONSOLE);
                          buffer[i] = c;
                           i++;
                          len--;

                         if (len == 0) {
                               break;
                         }
                   } else {
/  * 如果在后续10ms内没数据的话,return */
                       if (j < 2) {
                               MAP_UtilsDelay(40000);
                                 j++;
                         }

                     if (buffer[0] != '\0' && j == 2) {
                                j = 0;
                               break;
                     }
              }
         }
          return i;
}

目的就是:如果能够接收满给定长度的字符(1024byte),就退出,否则如果10ms没有字符,也退出;

问题:

当uart每次输入3~5个字符的时候,很正常; 但是当我每次发送30个字节的时候,会出现接收 乱序,字符丢失 现象。。

请帮忙指点下。

谢谢