I'm testing RS-232 communication between two devices(1: Red Hat Linux, 2: Windows)
I can check sending and receiving data. In Windows, it can be checked with a serial communication program, and in Linux, it is easy to check with a terminal. After making the same basic settings for RS-232 communication, I tried sending and receiving data.
If data is sent from the Linux device to the Windows device, I can check that it has been received in the Windows communication program. Conversely, if data is sent from the Windows device to the Linux device, it does not appear on the terminal despite doing cat /dev/ttySX
.
The commands I entered to test RS232 data sending and receiving are as follows.
dmesg | grep ttyS
#output:
ttyS0 at MMIO 0xdf301000 (irq = 126, base_baud = 7812500) is XR17V35X
ttyS1 at MMIO 0xdf301400 (irq = 126, base_baud = 7812500) is XR17V35X
ttyS2 at MMIO 0xdf301800 (irq = 126, base_baud = 7812500) is XR17V35X --> real usage
ttyS3 at MMIO 0xdf301c00 (irq = 126, base_baud = 7812500) is XR17V35X
setserial /dev/ttyS2 uart 8250
# Output
ttyS0 UART:undefined Port:0x0000
ttyS1 UART:undefined Port:0x0000
ttyS2 UART:8250 Port:0x0000 ---> Why port is 0x0000?
ttyS3 UART:undefined Port:0x0000
stty -F /dev/ttyS2 115200 cs8 -cstopb -parenb
Open two terminal and execute following command each:
Terminal 1:
cat /dev/ttyS2" (or "cat < /dev/ttyS2")
Terminal 2:
echo -e -n \x2\x3\x1\x0\x0\x0\x0\x3 > /dev/ttyS2
The data sent from Terminal 2 is received well in the serial communication program of the Windows device, but the data sent from the Windows device does not appear on Terminal 1. However, when I did not say cat /dev/ttyS2
, I only sent it from the Windows serial program, but when I command cat /dev/ttyS2
, I also received a response.
Question: What if I want to display the data received on cat /dev/ttyS2
? And what does Port 0x0000 mean?
Thank you for reading this.