OpenWrt Forum Archive

Topic: Serial port on WR741ND

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

Hi!

I'm working on a project with OpenWRT router.
Thing is next:
I have a router connected to some third-party device via serial port.
First I tried with router Linksys  wrt54gl v1.1 + kamikaze, second serial port, device /dev/tts/1
Everything worked OK.

For communication I used a C-program. It was specially written for this communication protocol over serial, because the device on the other side is not configurable.
Then I switched to newer router, TP-Link WR741ND v4.22 + attitude adjustment  / latest trunk (18.4.2013)
I changed next things:
1. Corrected the c-program to suit the new hardware: change /dev/tts/1 to /dev/ttyATH0 inside c source code for my communication program.
2. Cross-compiled my new c-source with new, appropriate mips-openwrt-linux-gcc from openwrt toolchain
3. in openwrt /etc/initab i deleted the row regarding /dev/ttyATH0, SO THE FIRST SERIAL PORT SHOULD BE TOTALLY FREE. (Am I right?)
(
    Linksys router had two ports. 0 was taken by the system, and 1 was totally free for my program.
    TP-Link has only one serial port, so I had to disable that one in order to use it.
)
# No other changes were made to c-program source code. Just the serial port.

And now things work really weird. It doesn't work.
I used oscilloscope, still saw that there are some signals at boot time. Bit that's another thing.
Later on, when openwrt boots I tried to send some data to serial pot via command:
echo Hello! > /dev/ttyATH0
I was monitoring the serial port with oscilloscope and I saw that even though I was sending several times the same string, the signals on wire were all time different.

The thing is, that the same program work perfectly on Linksys router, second port. But it doesn't work on TP-link with one serial port.
The only difference is:
--> changed appropriate serial
--> compiled with appropriate ...-gcc

QUESTIONS:
1)
What can I do to totally free the first (only) port on Openwrt?

2)
Is there a way to disable those signals that i get at boot time on serial port? I know, that that is dangerous and that I wouldn't be able to save te router if bricked, but anyway... Those signals could harm my device on the other side of serial cable.

3) does anyone of you have (or know of anyone who has) an working example of program that communicates on a first port of openwrt-enabled router. I'm curious of how have you initialized the serial port inside c-source.

On second thought, I'm looking for any application that uses the first port, so port number 0, which is taken by openwrt system by default.

I'm really looking for help. That problem has been bugging me for quite a long time and I'm willing to pay a reasonable fee for help.


Regards,
Peter

pcpostar wrote:

3) does anyone of you have (or know of anyone who has) an working example of program that communicates on a first port of openwrt-enabled router. I'm curious of how have you initialized the serial port inside c-source.

On second thought, I'm looking for any application that uses the first port, so port number 0, which is taken by openwrt system by default.

I'm really looking for help. That problem has been bugging me for quite a long time and I'm willing to pay a reasonable fee for help.

Does anyone uses communication with any device via first serial port (serial port 0) and he uses c-program for comunication?

The discussion might have continued from here.