Hello everybody, this post describes data transfer over USB from Joker TV to a host using high bandwidth USB isochronous transfers which has bitrate 3 times higher than regular USB isochronous transfers.
High bandwidth USB isochronous transfers
Regular isochronous USB transfer contains only one data packet (DATA_0) per microframe (125 usec) and can achieve 62.5 Mbit/sec of data throughput. In the same time high bandwidth isochronous USB transfer contains three data packets (DATA_2, DATA_1 and DATA_0) per microframe (125 usec) and can achieve 187.5 Mbit/sec of data throughput.
Joker TV FPGA firmware implemented high bandwidth USB isochronous transfers starting from revision 0x2d. The source can be found on github. Now EP3 IN endpoint respond to DATA_IN token with DATA_2, DATA_1 or DATA_0 packets. The packet to be sent is defined in “Table B-2” of xHCI specification. The rule is simple – DATA_2 and DATA_1 should be filled to the maximum size (1024 bytes) and DATA_0 can be any size below the maximum.
Sniffing USB traffic on FPGA
Now I will show you how to log (sniff) USB traffic on FPGA. We will use JTAG connection to Joker TV and SignalTap II Logic Analyzer from Intel/Altera Quartus package. We will recompile Joker TV fpga firmware with “SignalTap II Logic Analyzer” enabled in “Assignments->Settings->SignalTap II Logic Analyzer” menu. In this case joker_tv.stp file will be used with already composed “usb-dump” instance (state based triggering used). After recompile we should load new firmware to FPGA using “SOF Manager” menu on SignalTap II Logic Analyzer window. After that we should press “Start analysis – F5” icon. And then we should start the actual USB transfers in terminal with joker-tv app:
If everything is ok then you should see dump of USB transfers as shown on following screenshot:
USB traffic dump on FPGA. Tokens are marked by blue arrows.
Above screenshot was made with Joker TV connected to Intel NUC d54250wyk with Linux kernel 4.15.0-rc6. Here is a photo of installation:
Joker TV with connected JTAG cable and Intel NUC
Host side driver (xHCI)
Joker TV user-level driver, working over libusb, also requires changes to support high bandwidth USB isochronous transfers. Here is a commit to do this. I have increased usb packet size from 1024 to 3072. This will allow libusb + kernel to save all three USB isochronous packets transferred in one microframe (125 usec). Finally all our libusb requests will go to ‘xhci_queue_isoc_tx‘ function located inside drivers/usb/host/xhci-ring.c of Linux kernel sources. This function prepare TD’s (with TRB’s inside) and schedule it for processing on hardware. Function ‘process_isoc_td‘ will be called when hardware receive all scheduled isochronous packets.
Ok, I will try to do some performance test. We will use joker-tv app with data generator implemented inside FPGA:
libjokertv$ ./build/joker-tv -t *** Joker TV usb device found. firmware version 0x2d *** High bandwidth USB isochronous transfers supported. Max TS speed 187.5 Mbps 181.352470 mbits/sec, 241.803293 calls/sec 187.514410 mbits/sec, 250.019213 calls/sec 187.507017 mbits/sec, 250.009357 calls/sec 187.514410 mbits/sec, 250.019213 calls/sec 187.507111 mbits/sec, 250.009481 calls/sec 187.513474 mbits/sec, 250.017965 calls/sec
Speed is stable at around 187.5Mbit/sec as expected.
I have tested Joker TV with high bandwidth USB isochronous transfers on the following platforms:
- Linux x86-64 – Intel NUC d54250wyk with Linux kernel 4.15.0-rc6
- Linux ARM on Raspberry Pi 3 – Linux raspberrypi 4.9.59-v7+ #1047 SMP Sun Oct 29 12:19:23 GMT 2017 armv7l GNU/Linux
- Windows 10 Home (Version 1709) on Microsoft Surface Tablet
- Macbook with macOS 10.12.6 (16G1114) Kernel Version: Darwin 16.7.0
All this systems works stable and shows maximum speed (187.5 Mbit/sec) of high bandwidth USB isochronous transfers.
Now Joker TV universal DTV receiver can handle high speed transponders. For example, on Eutelsat Hot Bird 13B/13C/13E at 13.0°E satellite there is high speed transponder “12539 H DVB-S2 30000-5/6 8PSK“. This transponder gives us about 72Mbit/sec of raw TS data. It does not fit into regular isochronous USB transfers (62.5Mbit/sec maximum speed) but easily handles with high bandwidth USB iscohronous transfers (187.5 Mbit/sec maximum).