Score:0

Piping data from ethernet to serial and back to ethernet doesn't reach destination

sa flag

CONCEPT VISUALIZED

I'm trying to establish a bidirectional communication where ethernet UDP packets enter a linux system (suppose a Raspberry pi) from eth0 interface and piped into the UART hardware of the system, then read by the second linux system, piped into the eth0 interface and transmitted again as UDP packets to a sensor and vice versa.

In other words I'm trying to convert UDP packets to serial and again to UDP seamlessly.

I've managed to make the UDP packets from PC to reach the second linux system, but they don't reach the sensor which is their final destination.

Configuration: PC is just in the same subnet as the first linux system and sends packets constantly in broadcast address, port 33000.

In the first linux system I used netcat to pipe data from eth0 to UART using these commands: stty -F /dev/ttyS0 to set the baud rate of the uart and then nc -ul 172.31.255.255 33000 >/dev/ttyS0 </dev/ttyS0 to pipe data from eth0 to the ttyS0 (uart). Data are successfully transmitted to the second linux system where I can print the payloads. But from there on problems appear.

In the second linux system I used the same commands as the first: stty -F /dev/ttyS0 and nc -ul 172.31.255.255 33000 >/dev/ttyS0 </dev/ttyS0. The problem is that the packets don't reach their final destination which is the sensor. I monitor the traffic in the second linux system's eth0 interface with wireshark and no UDP packets are transmitted.

Weirdly enough, with this configuration, packets from PC (port 33000) don't reach the sensor, BUT, if I change the listening port to 10021 (in both linux systems), then the way is open for the packets from the sensor and they successfully reach the PC (software).

I'm thinking that it might has to do with the server/client roles. PC (through sensor's special software) initiates communication with sensor by sending SYN packets in 33000 and waits for a reply. Those packets don't reach the sensor, but sensor sends data of telemetry in port 10021 and those packets successfully reach the software (PC).

Any insights welcome.

Tilman Schmidt avatar
bd flag
What are the business requirements leading to that design?
zanglorion avatar
sa flag
@TilmanSchmidt the packets must transmitted over a certain radio band, unfortunately not in 2.4Ghz. It will be like this: ethernet --> serial --> radio transmission --> serial --> ethernet
Tilman Schmidt avatar
bd flag
Did you consider one of the protocols designed for transmitting IP packets over serial lines, such as PPP?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.