1
\$\begingroup\$

I'm trying to establish a high speed UART communication on Raspberry Pi board. Since internal UART is not quite good at 1+ Mbaud, decided to use FTDI adapter (based on FT232RL chip) instead.

I've tested an adapter on my laptop running Debian 8 and reached stable transmission speed at 3 Mbaud (with a cat * >> /dev/ttyUSB0). Then plugged it to Pi2 doing exactly the same, and noticed this:

(at 3 Mbaud) enter image description here

(at 1 Mbaud) enter image description here

There are wide (up to 1 second at 3 Mbaud) gaps in transmission at regular time intervals. Transmitting data is not corrupted, just delayed. Any suggestion on how to overcome a problem? Thank you.

\$\endgroup\$
  • \$\begingroup\$ Perhaps your data source is too slow, try cat /dev/zero >> /dev/ttyUSB0 \$\endgroup\$ – Jasen Nov 16 '15 at 10:29
  • \$\begingroup\$ I've tried all kinds of data including UDP, TCP traffic over PPP. Gaps are staying the same. \$\endgroup\$ – Alexey918331 Nov 16 '15 at 10:36
  • \$\begingroup\$ What has UDD,TCP to do with UART? As your Rpi does also other things it can't send the data without gaps. Perhaps doing a custom kernel that uses all resources from RPi just to send data, the gaps would vanish, but what's the point of that? \$\endgroup\$ – Marko Buršič Nov 16 '15 at 12:58
1
\$\begingroup\$

The RPi has only one USB Bus. One second long gaps sould be very rare, but you would see them if your data source for cat * uses the same USB bus to tranfer data into the RPi at the same time.

Something with more buffer like dd if=/dev/zero of=/dev/ttyUSB0 bs=1M should show less gaps, unless there are more USB devices active.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Does internal microSD card reader use the USB Bus? There are no USB devices connected to the board except the adapter. \$\endgroup\$ – Alexey918331 Nov 16 '15 at 11:21
  • \$\begingroup\$ I've tried to do output with your command - gaps are exactly the same. \$\endgroup\$ – Alexey918331 Nov 16 '15 at 14:08
  • \$\begingroup\$ The Ethernet port is on the USB 2.0 Bus. Do you see the gaps when ethernet is disconnected? \$\endgroup\$ – Turbo J Nov 16 '15 at 18:06
  • \$\begingroup\$ Yes. Ethernet is disconnected. \$\endgroup\$ – Alexey918331 Nov 17 '15 at 5:23
0
\$\begingroup\$

Solved

The problem was in RPi's USB driver.

Answer from developer:

At high baud rates, you may hit the USB NAK packet throttle threshold on outbound data - we have a crude mechanism implemented to stop FTDI devices from causing interrupt storms that lock the CPU out for extended periods of time. You can probably live with the increased interrupt rate on a Pi2 that comes from reducing the throttle interval.

After disabling NAK holdoff (by adding dwc_otg.nak_holdoff=1 to /boot/cmdline.txt) it works perfect at 3 Mbaud.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.