OpenWrt Forum Archive

Topic: ser2net serial interface

The content of this topic has been archived on 28 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi
I try to get Arduino talk to wr710n through ser2net serial interface.
I installed ser2net and I configure as
vi /etc/ser2net.conf
123:raw:600:/dev/ttyATH0:115200

Then I connect router serial OUT and IN to Arduino RX and TX respectively. Upload simple sketch to Arduino.

I monitor in cat /dev/ttyATHO from SSH and receiving data from Arduino.

Now, I have two problem.
(1) How to send data from router to Arduino? What is the command line?
(2) How to monitor from Putty , raw mode? I set raw, ip address, port 123 ( I set 123 earlier), but it doesn't work. I thought I can monitor from raw mode, forgive me if I am wrong.

I guess you even have third problem:
(3) How to disable terminal and kernel messages on serial port?

Thanks MBS. Yes, you are right. I am so happy that I forgot to disable terminal.

Thanks Nick56 for the link. It is very helpful.
I also found another link:
http://www.cse.dmu.ac.uk/~sexton/ENGD20 … enwrt.html

I can connect to Arduino through usb and test successfully.

However I want router to talk to Arduino through Uart (from router's OUT/IN to Arduino RX/TX)
Above method did not work.
What driver I have to use? Any lead?

Looks like ttyS0 is the serial (not-USB) UART, so change the command to this:

ser2net -C "8082:raw:600:/dev/ttyS0:115200 NONE 1STOPBIT 8DATABITS -XONXOFF -LOCAL -RTSCTS"

Then you can use Putty to connect to port 8082 in Telnet mode.  Just tested all this and it worked, shouldn't need any special drivers.

danitool:
Thanks, good find!  Do you know if there is a way to disable it sending the boot messages as well?

Thanks Nick56

I follow your command, but not successful.

8082:raw:600:/dev/ttyS0:115200 NONE 1STOPBIT 8DATABITS -XONXOFF -LOCAL -RTSCTS
#123:raw:600:/dev/ttyS0:115200
#2002:raw:600:/dev/ttyS1:9600 NONE 1STOPBIT 8DATABITS XONXOFF LOCAL -RTSCTS
#2003:raw:5:/dev/ttyS2:9600
#2004:raw:5:/dev/ttyS3:115200
#2005:raw:5:/dev/ttyS4:9600
#2006:raw:5:/dev/ttyS5:9600
#2007:raw:5:/dev/ttyS6:9600 tw=tw1 tr=tr1
#3001:telnet:0:/dev/ttyS0:19200 remctl banner1
#3011:telnet:3:/dev/ttyS0:19200 banner2
#3002:telnet:0:/dev/ttyS1:9600
#3003:telnet:0:/dev/ttyS2:9600 banner3
#3003:telnet:0:/dev/ttyS2:9600 signature1
#3004:telnet:0:/dev/ttyS3:115200
#3005:telnet:0:/dev/ttyS4:9600
#3006:telnet:0:/dev/ttyS5:9600 open1
#3007:telnet:0:/dev/ttyS6:9600 close1
#5001:rawlp:10:/dev/lp0
#123:raw:600:/dev/ttyATH0:115200
root@OpenWrt:~# cat /dev/ttyS0
cat: read error: Input/output error
root@OpenWrt:~#
 

I cannot telnet nor view from ssh. Where went wrong? Anymore setting to do?

Config looks fine, probably just need to start the program.  Try "ser2net" with no other parameters in the console. 
Note that it won't say anything in the console even if it works:

root@OpenWrt:~# ser2net
root@OpenWrt:~#

Also I made a mistake on the previous part, connection settings in Putty should be port 8082 mode: RAW

Hi
After doing try and error for a few days, I get it work.
Now I can telnet the router and send data to arduino. I can also send the data from smart phone to arduino.
Another problem that I found is the limitation of devices connecting to router. Only one device can talk to arduino at one time. For example, if I telnet arduino, smart phone cannot talk and vice vasa. Is it because of ser2net or bugs? Anybody face same problem?Any  suggestion?

Thanks advance.

That is not a bug. Imagine two people would talk to you simultaneously (even if they would interleave properly), you would certainly just understand garbage. Same with a device connected through a serial port.

Thanks MBS for your opinion.
But this is not the case for professional gedget selling in the market. I am using them and I have no such problem with it. For example, USR, Hi-Link WifiUart modules.

Let me rephrase my problem to understand fully. If one app is talking to arduino, another app is able to connect to ruoter (I think) but cannot send/receive data unless first app is closed.

Is there other kernel I can use in place of ser2net?

Thanks

After I search for more info about ser2net, I realised that it did not support multi connection.
Anyone knows similar to ser2net and support multi connection?

Regards

Hi
Finally, I found it which support multi connection. You need to compile it. I don't know how to compile it. Please share with me if you succeed. Take note it is different from ser2net. This is called ser2nets.

https://sourceforge.net/projects/ser2ne … /ser2nets/

Hello wnat,

I am trying to do the same thing as you except that I only need one connection. I am wondering if you can share the config file, and also how to telnet to the router?

I was not able to telnet to the router. I currently set it up exactly as your config file shown above.

The discussion might have continued from here.