3

I'm trying to establish a high speed UART communication. Since ttyAMA0 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.

  • What lines are you monitoring? – joan Nov 16 '15 at 11:08
  • TX line from RPi – Alexey918331 Nov 16 '15 at 11:17
  • USB doesn't have a TX line. Do you mean the Pi's UART TXD pin (pin 8 on the expansion header)? I thought you were not using the UART. Could you explain what and how each end of the link is connected? – joan Nov 16 '15 at 11:29
  • I'm using the FTDI USB <--> RS-232 adapter. This is the monitoring from TX pin on the output of adapter. – Alexey918331 Nov 16 '15 at 11:34
  • I assume a "FTDI adapter" is some kind of USB serial device. The throughput is limited by 2 factors. Firstly Linux is not a real time OS, so interrupts can cause breaks in processes. Secondly all I/O via USB/Ethernet goes via the same chip which has a limited bandwidth. You are unlikely to achieve a higher throughput than the on-chip UART on the SOC. There may be other factors limiting this e.g. buffer sizes. You also need to specify what software you are using to send data. – Milliways Nov 16 '15 at 11:38
3

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.

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.