A20 USART Driver Problem

Started by margadon, November 10, 2015, 01:14:00 PM

Previous topic - Next topic

margadon

Hi, I faced the problem with USART on Olinuxino A20 on Original Debian Image. I use USART5: PI10, PI11 pins, asynchronous mode. Sending some data packets on speed 115200, I get unexpected delays between packets from 10 up to 20 ms long. I see It on logic analyser. I send different packets of 1-40 bytes long. And after 10-15 packets I get those delays. In normal state the distance between packets is less than 1 ms - (approx.0.6~0.7ms). Is It because the USART Driver, or Linux, or what is the reason of those unexpected delays?
The same situation I get, when i tried to use GPIO to control TX/RT mode for RS 485 Driver chip (like st485). The moment of switching It to 1 was delays sometimes on the same 10-20 ms, what destroys the transmission session.
Can somebody recomend how to fix it?
Thanks!

JohnS

#1
It might be your packets.  What happens if you send lots of ASCII only (big text file)?

Are you looking at the data using a logic analyser so you can be 100% certain what is actually on Tx?

Next idea if you get the gaps using ascii and an analyser shows they genuinely are there (i.e. are no activity rather than perhaps NUL chars) would be a different Linux image (best to build your own).

An advantage of building your own is you can put debug code in the actual driver, such as to wiggle a GPIO at certain points and watch with analyser.

If still there, report to Debian or maybe linux-sunxi ML.

Of course, read datasheet and check there is no FIFO buffering occurring and enabled (plus no hardware handshaking or you have hardwired the handshake to disable it).  Also make sure Debian has no powersave etc modes set.

John

isidoro

I solved using the setserial command.
uart uart_type: 16450
I tried different, to me the best was 16450


margadon

#3
Thanks for your answers, we send our own defined data like [address_byte][conf_byte][state1][state2]...[last-state]
Also we set  setserial uart 16450 and got no any changes.
here is the screenshots from logiс analyser: https://yadi.sk/i/vsKBa1UokQHAp
https://yadi.sk/i/lIzgcR5ekQHFD
Chanel0 line - is the packages from linux to serial devices. You can see the holes in row, which appears randomly.
but, if i send data without waiting for serial devices answer, It works ok: there is no delays. look on the picture: https://yadi.sk/i/OcncpOE9kQRsq