How-To USB
Description
The Pi-Tron CM4 uses the Raspberry Pi Compute Module 4 as its central component. Besides many connection options the CM4 offers, like PCIe, SPI, I2C and much more. It also has a built-in USB 2.0 Hub, but by default the USB 2.0 Hub is disabled, except if you are using the newest Raspberry Pi OS named Bullseye or later.
The reason why it's important that the USB 2.0 Hub is active is, it is responsible for connecting the second ethernet port to the CM4 as well as the serial interfaces. Without it those devices will be inaccessible and cannot be used.
Note
This How-To is primarily intended for those who already have an existing SD card image, based on Raspberry Pi OS Buster for example, and wish to continue using that image on the Pi-Tron CM4.
Requirements
- Development computer with USB Debug Adapter connected the Pi-Tron CM4 Debug-Console port. For more information see How-To Debug Console
- Alternatively connect an HDMI monitor, mouse and keyboard
- Alternatively connect an SD card reader to the development computer or if the CM4 only has eMMC memory use the rpiboot program. For more information see How-To Write eMMC
- 24 volts power supply with 2 pin power plug for the Pi-Tron CM4.
- The login details are by default: username: pi and password: raspberry
- Note: Newer Raspberry Pi OS versions require the user to create their own login credentials during first boot. See this blog post.
How-To
Fresh SD card or eMMC memory
If you have just created a new SD card or written a new copy of the Raspberry Pi OS to the CM4s eMMC memory. You can check that USB 2.0 ports of the CM4 will be activated on the first boot.
- Insert the SD card back into the card reader and re-connect the card reader to the development computer or re-mount the CM4's eMMC memory using the rpiboot program.
- Go into the boot partition
-
Open the file "config.txt" with your favorite text editor and look for the line
otg_mode=1OR
dtoverlay=dwc2,dr_mode=host -
If one of the 2 lines is present, then everything is in order.
- Insert the SD card into the Pi-Tron and connect power or eject the eMMC removable drive from the development computer, unplug the USB cable and do a power cycle of the Pi-Tron CM4 to get started.
Existing SD card or eMMC memory
The CM4 in the Pi-Tron CM4 uses similar hardware to the Raspberry Pi 4B, this means only Raspberry Pi OS Buster (latest version) or later runs on the device.
Create a Backup
Before proceeding with this How-To: Make a backup of the SD card or the eMMC memory!
- Boot your existing Raspberry OS (SD card or eMMC memory) on the Pi-Tron CM3+.
- If you are changing devices, i.e. you currently have a Raspberry Pi 3B or 3B+, boot your existing SD card on that Raspberry Pi first.
- Update and upgrade the Raspberry Pi OS Buster version to the latest available version
- If the current system is still based on Raspberry Pi OS Stretch you will have to upgrade the entire system to Raspberry Pi Buster first. Have a look here if you want to know more: https://www.raspberrypi.com/news/buster-the-new-version-of-raspbian
-
Run the following commands:
sudo apt update sudo apt full-upgrade -
Once the upgrade is done, reboot and check that everything is still working as expected.
-
As the final step, the config.txt file has to be altered. For Buster and Bullseye use:
sudo nano /boot/config.txt -
Starting with Bookworm, the config.txt has moved:
sudo nano /boot/firmware/config.txt -
At the end of the file add the line
otg_mode=1
This will enable the USB 2.0 Hub on the CM4
- Save the changes and leave the editor with Ctrl+O → Enter → Ctrl+X
-
Now shutdown the system
sudo poweroff -
Switch off the power of the device
-
Take out the SD card from the Pi-Tron CM3+/Raspberry Pi and make a backup copy using one of the popular imaging tools.
- If your system resides on eMMC memory, mount the memory using the rpiboot program and then make a backup copy. The image created here is needed in any case as it is used to transfer the system either to an SD card or the eMMC memory of the target Pi-Tron CM4.
-
Insert the SD card into or restore the backup image to the eMMC memory of the Pi-Tron CM4.
- eMMC memory users know the drill by now. Use the rpiboot program to mount the eMMC memory from the CM4 as a removable drive.
- Use one of the popular SD card imaging tools to write the backup image on to the removable media. Note: This can take some time depending on the size of the image
- When done, unplug the USB cable from the Pi-Tron CM4 and power off the device.
-
Power on the Pi-Tron CM4 and see what happens.
- Optional: Hook up a monitor before powering on the Pi-Tron CM4 to be able to see what's going on during the first boot or if the CM4 is booting at all.
- Optional: Alternatively or additionally connect the development PC to the Pi-Tron CM4's Debug Console, to be able to see the boot/system messages when the device is starting. For more information on this topic take look at the How-To for the Debug Console.
This concludes the How-To for the Pi-Tron CM4's USB 2.0 Hub and controller. An existing system should now be running on the Pi-Tron CM4 and the second ethernet port as well as the serial and USB ports should be available for use.
Restrictions
- No known Restrictions
Related documentation
- Covering all aspects of the Raspberry Pi, the official documentation: https://www.raspberrypi.com/documentation
- Raspberry Pi Compute Module 4 datasheet, see chapter USB 2.0 (Highspeed): https://datasheets.raspberrypi.com/cm4/cm4-datasheet.pdf
- Raspberry Pi news, release of the CM4: https://www.raspberrypi.com/news/raspberry-pi-compute-module-4
- Raspberry Pi news, release of Raspberry Pi OS Buster. Includes upgrade advice for Raspberry Pi OS Stretch users: https://www.raspberrypi.com/news/buster-the-new-version-of-raspbian
- Raspberry Pi OS now requires users to create their own login credentials on first boot: https://www.raspberrypi.com/news/raspberry-pi-bullseye-update-april-2022