FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
568 views 9 comments
by anonymous

Hello,

I have a TRB142, FW ver: TRB1421_R_00.01.04.2

I have an RS232 device that periodically sends some data.

I want to connect the RS232 device to the TRB142 serial port and have it send serial data to my server on the internet. The data is 50 or 60 bytes, every few seconds, or every few minutes, or every few hours. There could be a long time between data bursts. I only need one-way communication.

I have configured the TRB142 with a SIM and it works. I have selected "Over IP" and "Client" modes for the RS232 connection. I have set timeout to 60s. I have set up the IP address and port of my server, and I have set up port forwarding to my PC. At first, everything works! It's great!

For testing I am using netcat:

nc -lvk 1232

My expected data arrives in my nc terminal window. If there is a short time with no data, no problem, data appears when I start sending again. But if there is a longer time with no data then nc stops printing anything. If I send more data from the serial device then it does not appear in nc. I am not sure what the shortest time is before this happens, but I just left it for about an hour and I could no longer get data in nc.

 

After leaving the modem for an hour and seeing that data no longer was transferred I power-cycled the modem. I did not restart nc and I did not disconnect or do anything with the serial data source. nc did not report any new connection. And serial data from the RS232 device was not seen in nc.

I restarted nc but it did not immediately get a new incoming connection. After about 1 minute (probably the timeout time) I saw a new incoming connection, and RS232 data could be seen again.

Is it necessary to do something to keep the connection alive? I am hoping to make this a transparent serial link with no intervention required. The initial results are promising, but I don't know if my expectations are unreasonable, or if I am doing something wrong.

Thank you.

by anonymous
Ok. Thanks. I'll wait until new information becomes available.

1 Answer

0 votes
by anonymous

Hi,

First of all, I see that you're using fairly old firmware. Could you please update it to the latest?

Also, as your firmware is older than 00.01.06.1, you will need to upgrade through legacy firmware first, so follow these instructions:

https://wiki.teltonika-networks.com/view/TRB142_Legacy_FW_Upgrade_Instructions

After you've updated your device to legacy firmware use FOTA to update to the latest.

EB.

by anonymous
Cool, thanks. Sorry, I have literally just bought this device. Maybe it has been sitting on the shelf for a while.

I will update the firmware as you suggest, however, are my expectations reasonable? i.e. once the device is set up and working I should continue to get serial data passing through the modem to my server regardless of how idle the serial device is.
by anonymous
As there are many firmware versions and changes awaiting let's hope this was the issue and the firmware version will fix it.

If not, we can look further into this.

EB.
by anonymous

Ok. I upgraded the firmware using the legacy instructions. Then I did a direct OTA upgrade. I am now running TRB1_R_00.02.04.3

During the legacy upgrade I lost my settings, which I was warned about, but it's okay as I only need to configure the RS232, and everything else can remain as default. Again, I enabled RS232, set up the baud rate, set "Over IP" and "Client", set my server address and port, and set local echo.

When I rebooted, in my serial monitor I see "RDY", but when I send some serial data I don't get an echo.

When I start nc on my server I see an incoming connection, but when I send some serial data it does not arrive.

I rebooted the TRB142 but there is no improvement.

I power-cycled the TRB142, but it still doesn't work as expected. I get "RDY" on my serial monitor, and local echo is working. I see a new incoming connection with nc on my server, but no data when I send something from the serial monitor. So, with the new firmware it appears worse than it was. Am I missing something?

by anonymous

Could you check if you have spamming connection sockets when you execute netstat -tupan in CLI?

by anonymous


Thanks for your suggestion. I don't know how to interpret this, but here it is:
root@Teltonika-TRB142:~# netstat -tupan
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Pro
gram name
tcp 0 0 0.0.0.0:4204 0.0.0.0:* LISTEN 23980/s
hellinaboxd
tcp 0 0 127.0.0.1:5037 0.0.0.0:* LISTEN 2510/ad
bd
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2939/uh
ttpd
tcp 0 0 0.0.0.0:5555 0.0.0.0:* LISTEN 2510/ad
bd
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 23221/d
nsmasq
tcp 0 0 192.168.2.1:53 0.0.0.0:* LISTEN 23221/d
nsmasq
tcp 0 0 100.86.177.93:53 0.0.0.0:* LISTEN 23221/d
nsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2362/dr
opbear
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 2939/uh
ttpd
tcp 0 0 100.86.177.93:39603 222.154.29.214:1232 ESTABLISHED 4739/so
dog
tcp 0 407 192.168.2.1:4204 192.168.2.249:26187 ESTABLISHED 23980/s
hellinaboxd
tcp 0 0 100.86.177.93:39602 222.154.29.214:1232 ESTABLISHED 4739/so
dog
tcp 0 1 100.86.177.93:40007 222.154.29.214:1232 SYN_SENT 4739/so
dog
tcp 0 1 100.86.177.93:40006 222.154.29.214:1232 SYN_SENT 4739/so
dog
tcp 0 0 100.86.177.93:39600 222.154.29.214:1232 ESTABLISHED 4739/so
dog
tcp 0 210 192.168.2.1:4204 192.168.2.249:26103 ESTABLISHED 23980/s
hellinaboxd
tcp 0 0 192.168.2.1:80 192.168.2.249:26084 ESTABLISHED 2939/uh
ttpd
tcp 0 0 :::80 :::* LISTEN 2939/uh
ttpd
tcp 0 0 ::1:53 :::* LISTEN 23221/d
nsmasq
tcp 0 0 fd67:b215:b54::1:53 :::* LISTEN 23221/d
nsmasq
tcp 0 0 fe80::d09b:4dff:fec0:641e:53 :::* LISTEN 23
221/dnsmasq
tcp 0 0 fe80::728b:38ef:52ce:bcbb:53 :::* LISTEN 23
221/dnsmasq
tcp 0 0 :::22 :::* LISTEN 2362/dr
opbear
tcp 0 0 :::443 :::* LISTEN 2939/uh
ttpd
udp 0 0 100.86.177.93:59924 103.242.70.5:123 ESTABLISHED 4438/nt
pclient
udp 0 0 127.0.0.1:53 0.0.0.0:* 23221/d
nsmasq
udp 0 0 192.168.2.1:53 0.0.0.0:* 23221/d
nsmasq
udp 0 0 100.86.177.93:53 0.0.0.0:* 23221/d
nsmasq
udp 0 0 0.0.0.0:67 0.0.0.0:* 23221/d
nsmasq
udp 0 0 :::547 :::* 2692/od
hcpd
udp 0 0 ::1:53 :::* 23221/d
nsmasq
udp 0 0 fd67:b215:b54::1:53 :::* 23221/d
nsmasq
udp 0 0 fe80::d09b:4dff:fec0:641e:53 :::* 23
221/dnsmasq
udp 0 0 fe80::728b:38ef:52ce:bcbb:53 :::* 23
221/dnsmasq
by anonymous
Hi,

I've identified this issue and it is already reported to RnD for further investigation.

EB.
by anonymous
Great. Thanks. Can you describe the issue? Have I overlooked something that I should have done? In any case, if it's going to R&D then I guess I'll have to wait for a firmware revision.

Sorry about the delay in replying. I'm in New Zealand, and I expect you are in Europe. Thanks for your help.

Cheers.
by anonymous
Your configuration is all right and correct, so you don't have to look up for anything. It will be fixed, but I can't tell you the time when it will be done.

EB.