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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

392 Views
jackerison
Contributor III

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 */

0 Kudos
1 Reply

277 Views
c0170
Senior Contributor III

Hello jack erison,

I have seen you posted problem related to IO NON BLOCKING and it was resolved. Was it related to this problem? Just checking.

Regards,

c0170

0 Kudos