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

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

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

1,589 Views
junhuaqiao
Contributor III

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

Tags (2)
0 Kudos
Reply
2 Replies

1,242 Views
igorpadykov
NXP Employee
NXP Employee

Hi Junhua

one can look at uart ioctl examples in imx-test package (..mxc_uart_test/mxc_uart_test.c)

www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx-test-5.3.tar.gz

Uart driver description can be found in attached Linux Manual Chapter 46
Universal Asynchronous Receiver/Transmitter (UART) Driver, may be recommended to check

dma configuration and dts file.

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

1,242 Views
junhuaqiao
Contributor III

Hi igor

   

    I disabled DMA in serial driver, and it worked OK.

    

Best regards,

Junhua Qiao

0 Kudos
Reply