Getting up and running with the Raspberry Pi Compute Module 4

Given how easy it is to get the board version of the Raspberry Pi 4 up and running, I figured that getting started with the compute module would be a walk in the park.  Not so.  The Compute Module 4 (CM) and Compute Module 4 IO Board are designed for more industrial usage, so there are more knobs and switches if you will.

I hope I can save you some time.  

Main caveats

  • The USB host on the Compute Module 4 IO board are disabled by default.
  • The MiniUART is disabled by default
  • Bluetooth is disabled by default
  • The SD Card only works for Lite (no eMMC) models of the compute modules
  • As an aside, Compute Modules dissipate heat less than Raspberry Pi boards, so some level of at least passive cooling will be needed.  It's a good idea to at least add heat sinks to the CPU and other components before proceeding.
So there are two main tasks ahead:
  1. Imaging the eMMC or SD Card
  2. Gaining terminal or desktop access

Flashing your module

If you have a Compute Module 4 Lite (no eMMC), this job is easy, just follow the usual instructions for writing an OS image onto an SD card on your PC.  Otherwise, you'll need to do the following, officially described here:
Start with your module installed on the IO board but no power applied:
  1. Add a jumper to J2 (labeled "Fit Jumper to disable eMMC Boot"). 

  2. Install RpiBoot utility
    1. Windows Installer
    2. Mac and Linux instructions
  3. Connect a micro-USB cable to your Linux, Mac, or Windows PC
  4. Apply power to the IO board
  5. Run the installed RpiBoot utility - at this point your module's eMMC should mount as a storage device on your PC
  6. Write a raspberry pi OS image to that drive, per the usual instructions (TL;DR: install and use the Raspberry Pi Imager utility from here).
At this point your module would theoretically boot, but don't disconnect your cable yet.  If you reboot now, the USB ports won't function and the bluetooth and TTYs are even disabled, so unless you happen to flash an OS image that already has your network and SSH already setup you won't be able to interact with the module yet.

Enabling USB

After writing the OS image, you should see in the newly written drive a config.txt in the boot folder.  Edit this file and add this line to the end:
    dtoverlay=dwc2,dr_mode=host

After this, be sure to unplug your power and your Micro USB cable, remove the J2 jumper, then plug in power.  If you have a screen and keyboard attached, you should be able to login (pi\raspberry) and run sudo raspi-config to connect to your network, enable SSH, and whatever you might have planned. 

If you are considering a custom Compute Module 4 board, be sure to read the datasheet

Happy compute moduling!

Comments

Popular posts from this blog

Don't Repeat Yourself... Really!

Enough software patent madness!

Virtual Appliances... poodoo