Jean
Jean

Reputation: 3

UART SW and HW flow control, linux

Currently, I'm testing flow control between 2 RS485 UART Port (Just connect Rx and RX, Tx and Tx, DTS/CTS is not connected).

Flag setting (between get and set attribute)

tty.c_cflag |= CRTSCTS; // RTS/CTS tty.c_iflag &= ~(IXOFF|IXON|IXANY);

tty.c_cflag &= ~CRTSCTS; tty.c_iflag |= (IXOFF|IXON|IXANY);

I assume that if I set both of UART1 and UART2 are Hardware flow control and baudrate is high (for eg. 460800 bps) or write into UART1 with higher baud-rate, read() from UART2 with lower baud-rate, FIFO (currently is 64byte) will be overflow as same as kernel send some notification.

But actually, it is always write() and read() successful. Could anyone share me suggestion how to observer buffer overflow?

Sorry if my question is a little dump cuz I'm a new linux leaner.

Thanks so much.

Upvotes: 0

Views: 1756

Answers (1)

kunif
kunif

Reputation: 4360

There should be no hardware flow control in the RS485 standard.
Since the API is shared with the RS232C standard, it can be called but it will not work effectively.

Also, the 64-byte FIFO you wrote is a hardware (interface chip) buffer, and the device driver also has a software buffer. Buffers often exist in kilobytes.

It is no wonder that even with high speed, transmission and reception of short data size ends normally.

Perform judgments such as overflow by checking the format of received data, and checking the balance and sequence of commands and responses.

Upvotes: 0

Related Questions