Raspberry PI USB speed issue – FIXED

For those who don’t want to read all of this – here is the fix:
echo 0 > /sys/module/dwc_otg/parameters/nak_holdoff

I got new Raspberry PI 3 this week and started testing the TrueRNG and TrueRNGpro on it. The TrueRNGv3 worked right off the bat and was mounted on /dev/ttyACM0 (the udev script didn’t create the link to /dev/TrueRNG though) and gave about 45 KB/s which is a bit slower than on a PC (~50 KB/s) but I figured that the PI is slower and it is using write to flash so this might be ok. I then tried the TrueRNGpro which also worked right away but was giving a much lower than expected transfer rate of about 185 KB/s which is way slower than the ~420 KB/s that it does on a PC.


I then connected my ITIC 1480A USB analyzer to see what was going on and saw this:


Notice that the PI sends several IN requests which are promptly answered with 64 bytes of data and then is answered by a NAK. The NAK from the TrueRNGpro is saying that data isn’t ready yet and that the USB host should try again. The host is supposed to then ask again but on the PI, a NAK holdoff time has been implemented because certain devices don’t like being asked for data again in rapid succession. After the NAK, the PI waits for the nak_holdoff time – set by default to 8 which is 1mS. This basically adds 1mS to each NAK’d transaction and cuts the overall data rate in half.

After some research and googling, we found this post: Call for beta testers: FIQ_FSM USB driver rewrite

I then tried disabling the nak_holdoff with the below command and bingo – the TrueRNG and TrueRNGpro are now working at the full data rate.

echo 0 > /sys/module/dwc_otg/parameters/nak_holdoff


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.