AnsweredAssumed Answered

A read() problem about serial port on i.MX6Q with kernel 3.14.52

Question asked by Junhua Qiao on Apr 19, 2017

Hi all,

  I have a problem.

 

  Other device send 7 bytes data every 100ms by serial port with baud rate 2400.

 

  I use i.MX6Q to receive the 7 bytes data (kernel version is 3.14.52).

  But the read function blocked more than 10 seconds every time.

  I tried to get the serial buffer length, as:  ioctl(fd, FIONREAD, &nBufferLen);

  and found that nBufferLen returned 4095, and then 1,and then 4095,1,4095,1...,repeatedly.

 

  I tried to open the serial device with O_NONBLOCK mode, but not improved.

  I also tried to modified the serial parameter:

         options.c_cc[VTIME] = 1;
         options.c_cc[VMIN] = 0;

  and got the same result.

 I tried kernel version 4.1.15, and got the same result.

 

But, with kernel version 3.0.35, the serial port worked ok, and function: ioctl(fd, FIONREAD, &nBufferLen);

nBufferLen is 1, and read() function returned immediately.

 

 

Regards,

Qiao

Original Attachment has been moved to: test_uart.c.zip

Outcomes