How to fix Raspberry Pi 4 USB stack

How to fix Raspberry Pi 4 USB stack

Many users, including some of our customers, are beginning to use the Raspberry Pi 4 announced at the start of Summer. Unfortunately, the current firmware for Raspberry Pi 4 contains a bug which prevents our modules to work properly. This post is going to show you how to update your Raspberry Pi and correct this bug.





TL;DR


If you are only interested in the solution, here are the 4 commands that you must run on your Raspberry Pi 4 to fix the issue:

sudo apt-get update sudo apt-get install rpi-eeprom sudo rpi-eeprom-update -a sudo reboot



The bug


In some conditions, the Raspberry Pi 4 loses USB packets sent by a USB device. This issue systematically affects our modules, but probably other devices as well.

To be more precise, USB packets are correctly transmitted between the Yoctopuce modules and the USB controller of the Raspberry Pi, but then in some cases these packets are simply ignored. Consequently, the applications using Yoctopuce modules cannot properly communicate with them.

Fortunately, there is a solution.

The symptoms


For VirtualHubs or programming libraries before version 1.10.37780 (October 10, 2019), Yoctopuce modules are not properly detected and never appear in the list of available modules. A "Closing partially opened device XXXXX" message appears several times in the logs.

From version 1.10.37780 onwards, we added a workaround which enables the modules to work in degraded mode. Thus, USB packets are sent several times until the application acknowledges the packet. In this case, the VirtualHub and programming libraries can use Yoctopuce modules, but communications with the modules are very slow.

When this degraded mode is enabled, the following log message is displayed: "WARNING: Old boot EEPROM of Raspberry Pi 4 contains a bug that affects USB performance. Try to update boot EEPROM with command "sudo rpi-eeprom-update -a""

The message indicating that communications work in degraded mode
The message indicating that communications work in degraded mode



If you are in one of these two situations, it means that you have a version of the Raspberry Pi bootloader which contains a bug and you must update it.

The solution


To date, Raspberry Pi 4 have by default an old bootloader containing this USB bug. This bug was fixed in a more recent version (v0137ab) but we don't know when it will be deployed in production.

You must therefore manually update the Raspberry Pi bootloader. To do so, you must first install the rpi-eeprom package with the apt-get tool.

sudo apt-get update sudo apt-get install rpi-eeprom



When the package is installed, you can check if the bootloader is up-to-date with the command rpi-eeprom-update.

pi@raspberrypi:~ $ sudo rpi-eeprom-update BOOTLOADER: up-to-date CURRENT: Tue 10 Sep 10:41:50 UTC 2019 (1568112110) LATEST: Tue 10 Sep 10:41:50 UTC 2019 (1568112110) VL805: update required CURRENT: 00013701 LATEST: 000137ab pi@raspberrypi:~ $



If the installed firmware is older than 000137ab, you must update it. To do so, you must use the same command but with the -a option and restart the Raspberry Pi.

The sudo rpi-eeprom-update -a command updates the firmware.

pi@raspberrypi:~ $ sudo rpi-eeprom-update -a *** INSTALLING EEPROM UPDATES *** BOOTLOADER: up-to-date CURRENT: Tue 10 Sep 10:41:50 UTC 2019 (1568112110) LATEST: Tue 10 Sep 10:41:50 UTC 2019 (1568112110) VL805: update required CURRENT: 00013701 LATEST: 000137ab EEPROM updates pending. Please reboot to apply the update. pi@raspberrypi:~ $ sudo reboot



When the new firmware is installed, Yoctopuce modules work properly.

To conclude


Raspberry Pi are good machines which are very practical, but each new iteration brings its share of bugs that are fixed later on.

As we just saw, the Raspberry Pi 4 is no exception, but the fix is already available and is quite easy to apply.

As of now, we haven't detected any other issue, but we haven't much used this version. If we find other issues, we'll update this page.

A few useful links



EDIT: after a while, we noticed that though this firmware does improve the situation, it does not fully fix the issue :-(

Add a comment No comment yet Back to blog












Yoctopuce, get your stuff connected.