OpenWrt Forum Archive

Topic: UART receive problem on TL-MR3020

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

Hi,

I have a problem in communication over UART. I'm using ARM Cortex with several PIR sensors on one end and TP-Link MR3020 with 3g dongle on the other for monitoring movement in a warehouse. System is collecting data from sensors and sending them over 3g on my server in a form of text file. What is the problem? Sometimes the transmitted data is OK, and sometimes is incomplete. I'm using echo command to write and append into file. Correct report file looks smth like this:

Correct report wrote:

sensor 1: no activity
sensor 2: no activity
sensor 3: movement detected
sensor 4: no activity

But, in 3/10 cases I receive this:

Incorrect report wrote:

sensor 1: no activity
sensor
sensor 3:
se

I'm not getting random data, just some parts missing. Beginning of the string is always transmitted, but not the end. I tried changing speed from 115200 to 19200, tried changing cable (some 4 inches long Cat 5 cable) and nothing helps. Can I change (increase) serial buffer size somehow? Or do you have some other idea?  Optocouplers are up to 1 MHz so that shouldn't make any problems. Maybe 3.3V levels are too low, but it's 4 inch distance - so I don't think that's too much. Thank you.

(Last edited by jagodica on 25 Apr 2013, 09:31)

Did you decouple UART and system console in kernel?

I'm afraid I don't know what that means smile

If you refer to removing ttyATH0 from kernel command line (i think it's CONFIG_CMDLINE), no.
I tried that before but then I couldn't receive anything from router (I run shell scripts and receive exit codes to my microcontroller in order to know what's going on and if everything is working properly).


I forgot to add one thing. When this happens, I have to restart router or else nothing is sent over UART anymore. Probably because quotes (") in echo are not closed. Sending quotes doesn't solve my problem.

(Last edited by jagodica on 25 Apr 2013, 09:59)

you should turn off the debug console. then you can use the console as data channel. you can try to use ser2net.

asuming you only use the rx from the router and don't care about the tx data, you could simply remove

ttyS0::askfirst:/bin/ash --login

from the /etc/inittab or comment it out

When the router starts up, it still puts the boot messages on to the tx line of the router and when you put tpl on rx line the you will get into the boot environment. I think it will be ok for your project.

The discussion might have continued from here.