NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

FTDI Usb to Serial Converter issues1KHz interrupts on cRio-9068 per channel

DAQjr wrote:

Please see the Transaction Translator section of this article: https://en.wikipedia.org/wiki/USB_hub

If your hub is actually USB 2.0 high speed, then there should be no 12 MBit signalling that ever reaches the controller. That means that what BradM said in his intial reply does not apply to you.

The more you know. I was unsure of that, it seemed fairly plausible but I didn't find supporting evidence, and it seems that either that's not the case here or there's something other than just the SOF that's at play. That 8kHz also maps pretty well to the USB high-speed microframe, and checking the Zynq TRM again:

Section 15.11.1:

...

SOF Interrupt

This SOF Interrupt a free running 125-microsecond interrupt for the host controller. EHCI does not

specify this interrupt but it has been added for convenience and as a potential an HCD time base. The

interrupt is indicated and enabled in the USBSTS and USBINTR registers.

I'm unsure if that's what we are seeing or not, but it's worth checking into it

0 Kudos
Message 11 of 15
(2,231 Views)

BradM and DAQjr,

For simplifying the test, I connected a single 7 port USB 2.0 Hub to cRio-9068 and connected a single USB to Serial converter (FTDI 232R chip based). Following is the ouput of "cat /proc/bus/usb/devices".

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480  MxCh= 1

B:  Alloc=  0/800 us ( 0%), #Int=  1, #Iso=  0

😧  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1

P:  Vendor=1d6b ProdID=0002 Rev= 3.02

S:  Manufacturer=Linux 3.2.35-rt52-1.0.0f1 ehci_hcd

S:  Product=Xilinx PS USB EHCI Host Controller

S:  SerialNumber=xusbps-ehci.0

C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA

I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub

E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 7

😧  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1

P:  Vendor=0409 ProdID=0050 Rev= 1.00

C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=100mA

I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub

E:  Ad=81(I) Atr=03(Int.) MxPS=   1 Ivl=256ms

T:  Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#=  3 Spd=12   MxCh= 0

😧  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1

P:  Vendor=0403 ProdID=6001 Rev= 6.00

S:  Manufacturer=FTDI

S:  Product=FT232R USB UART

S:  SerialNumber=A503F1EG

C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr= 90mA

I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=ftdi_sio

E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms

E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms

We could see that cRio9068 USB root hub and added 7port USB 2.0 hub is at 480Mb speed. With this setup, when I open /ttyUSB0 serial port for communication, I do see 1 KHz interrupts (IRQ53- ehci_hcd:usb1) on CPU-0. From above usb device details, FTDI UART is mapped as full speed device at 12 Mb speed. From http://www.linux-usb.org/ link, it appears USB 1.1 periodic transfer is worked on every eight microframes (8x 125uSec microframe time will give us 1 msec). If I connect the 2nd FTDI device, IRQ rate scales up to 2KHz.

BradM,

You mentioned about "interrupt is indicated and enabled in the USBSTS and USBINTR registers.". Is there a way to access/modify these registers?

0 Kudos
Message 12 of 15
(2,230 Views)

As an experiment, I was checking if ehci_hcd driver module has any input options. Link https://www.kernel.org/doc/Documentation/usb/ehci.txt mentions following:

Module parameters (pass to "modprobe") for ehci_hcd include:
log2_irq_thresh (default 0):
Log2 of default interrupt delay, in microframes.  The default value is 0, indicating 1 microframe (125 usec).  Maximum value is 6, indicating 2^6 = 64 microframes.  This controls how often the EHCI controller can issue interrupts.

To use this option, I tried following to unload and load the ehci_hcd module:

# modprobe -r ehci_hcd

# modprobe -v ehci_hcd log2_irq_thresh=6

After this, I am seeing IRQ rate dropped to 130 Hz. In fact when I connect two channels, I am still seeing same IRQ rate of 130Hz. Do you think, it is safe to go with this option? and how do I configure it as a permanent setting for ehci_hcd driver? Will it impact anything w.r.t. stability of system?



0 Kudos
Message 13 of 15
(2,230 Views)

It seems to be part of the USB standard¹, from what I can tell. It's at very least worth trying out.

¹http://www.intel.com/content/www/us/en/io/universal-serial-bus/ehci-specification-for-usb.html, table 2-9

0 Kudos
Message 14 of 15
(2,230 Views)

Thank you, BradM.

I will try it out and see how it goes.

0 Kudos
Message 15 of 15
(2,230 Views)