AnsweredAssumed Answered

Serial can  only receive a maximum of 8 characters a time MQX4.0

Question asked by jack erison on Apr 29, 2013
Latest reply on Apr 29, 2013 by Martin Kojtal

Hi,everyone.

    I was using the twrk60n512 borad.I use the serial to receive data,I found it can  only receive a maximum of 8 characters a time,it would drop the the characters after the eighth character.I tested the serial in IO_SERIAL_NON_BLOCKING mode and IO_SERIAL_BLOCKING mode,it was the same.

The following was my code:

  unsigned int  iTimeoutCount=0;
  unsigned int iRLengh=0;
  unsigned char szRbuf[200];
  serial_fd =  _io_fopen("ttya:",(pointer)IO_SERIAL_NON_BLOCKING );  
  while(TRUE)
  {
    if (fstatus( serial_fd )) {  
      fread(szRbuf+iRLengh,1,1,serial_fd);
      iRLengh++;
      iTimeoutCount=0;
    }
    else
    {
      _time_delay(10);
      iTimeoutCount++;
      if(iTimeoutCount>10)
        break;
    }
  }

  I sent 10 characters to the serial from pc,I found it can only receive 8  characters,I don't konw whether there was something wrong.

 

/*   {     Please use Syntax highlighting for code, thanks!   }   by c0170 */

Outcomes