Skip to main content

Developing with Radxa ROCK CM3 + Raspberry Pi IO

If you have the Raspberry Pi Compute Module 4 IO Board and want to try out the superior graphics performance of the Radxa ROCK CM3 Module (249-3155) , it's easy to swap your RPi CM4 module for a ROCK CM3 version.

There is a custom ROCK Compute Module IO Board that provides access to more CM3 features through the third connector on the ROCK CM3 module. We cover using this board in this project: 

Developing with Radxa ROCK CM3 + Radxa ROCK 3 Compute Module I/O Board

This project guides you through setting up and configuring a build environment for the ROCK CM3 System-on-Module (SoM) using the Raspberry Pi Compute Module 4 IO Board.

We show how to setup and configure a complete Linux host build environment with the Radxa rbuild toolchain and build a KDE image based on Debian that will boot on the Raspberry Pi Compute Module 4 IO Board.

Unlike with the ROCK Compute Module IO Board, the Raspberry Pi Compute Module 4 IO Board doesn’t support booting from an SD card if your module has eMMC storage, so we will just flash the image to eMMC media and test the video performance.

CM3 SoM is based on the powerful Rockchip RK3566 System on Chip (SoC) with a Quad‑core Arm® Cortex®‑A55 (ARMv8) 64‑bit @ 2.0GHz CPU & Arm Mali™-G52-2EE GPU.

Modules are available with 2GB / 4GB RAM and None / 16GB / 32GB eMMC flash storage variants.

Full details are in the Datasheet: Radxa Compute Module 3 (rs-online.com)

With simplified schematics:

[rm116]cm3_v1.31a__20221010 (rs-online.com)

Raspberry Pi Compute Module 4 IO Board

Difficulty: Medium Time: 4 Hrs Steps: 8 Credits: None License: None

Parts Needed:

Part Description RS Stock Number
ROCK CM3 OKdo ROCK 3 Compute Module (CM3) 4GB/32GB with WiFi/Bluetooth (249-3155)
Raspberry Pi Compute Module 4 IO Board Raspberry Pi Compute Module 4 IO Board  
USB-to-Serial Debug Cable TTL-232R-Rpi Debug Cable For Raspberry Pi (767-6200)
15.6″ Portable Monitor OKdo 15.6″ Portable Monitor with USB-C & HDMI Support and Full HD 1080P Resolution LCD Screen (231-4565)
USB-C Power supply (5V / 3A) USB-C Power supply (5V / 3A)  
12V / 1A Power Supply 12V / 1A Power Supply 2.1mm DC tip positive +12V input.  
MicroUSB to USB-A Cable MicroUSB to USB-A Cable  
PC Linux Host computer with Ubuntu 22.04  

Step 1: Development Environment

The image below shows my development environment including the laptop host and monitor running Ubuntu 22.04.

The CM3 is attached to the carrier board and powered with a 12V / 1A PSU. The power requirement depends on the types of peripherals attached to the board.

I also attached the OKdo 15” Portable Monitor and a USB keyboard to the I/O carrier board so I can log in directly. There is also a USB-to-Serial cable attached to the GPIO header and a console Terminal running Minicom on the host to capture kernel boot messages.

This gives a comfortable environment for effective development.

Development Environment

Step 2: Host Setup

There are no pre-built images for the combination of CM3 modules on the Raspberry Pi IO Board so we need to build our own using the Radxa build tool, rbuild.

This is fairly easy to set up as it runs in a container. Currently only hosts running Debian 12 (Bookworm) or Ubuntu 22.04 (Jammy) are Officially Supported but it is possible to configure a Virtual Machine on other OS’s. I recommend keeping it simple to reduce the system dependencies for a smooth experience.

Full details are available here: Radxa rbuild

The build runs in a containerized environment with two options, Podman and Docker. I used Docker as this was already installed and running successfully on my host. I didn’t install docker.io as recommended as my default Docker installation worked successfully.

Here’s a snapshot of the Docker packages installed under Ubuntu 22.04 which you will need to install if you don’t already have them: 

Docker packages installed under Ubuntu 22.04

Add your user to the docker group and reboot before moving on:

$ sudo adduser $USER docker
$ sudo reboot

Now test that docker runs successfully from your user without sudo:

$ docker run hello-world

Hello World - From Docker

Step 3: rbuild

To set up rbuild, clone it from the Radxa repo to a suitable working directory on your system and run it with no arguments to test and see the available parameters:

$ mkdir cm3-rpi-io && cd cm3-rpi-io
$ git clone --depth 1 https://github.com/radxa-repo/rbuild.git
$ cd rbuild
$ sudo chmod 0666 /dev/kvm
$ ./rbuild

If everything is successful you should see output like this displaying all the options:

rbuild

Once you are at this stage you can build your first image.

This will take a few minutes depending on the speed of your host machine and internet download speed. Once the first build has completed, subsequent runs are much faster. Mine takes about 10 mins on a 16 core thread ripper.

Parameters for rbuild follow this pattern:

rbuild [--options] <product> [suit] [flavour]

To build the default Debian Bullseye KDE image for the CM3 running in on the RPi I/O Board as a compressed image, issue the following command:

$ ./rbuild --compress radxa-cm3-rpi-cm4-io bullseye kde

Tip: Here are the other commands to build the CLI and XFCE images:

$ ./rbuild --compress radxa-cm3-rpi-cm4-io bullseye cli
$ ./rbuild --compress radxa-cm3-rpi-cm4-io bullseye xfce

Tip: If you get the following message make sure to run the chmod command above and rerun rbuild

KVM detected but the permission is not optimal.
You might need to run `sudo chmod 0666 /dev/kvm` to have rbuild working.

If all went well, you will have the compressed OS image in your working directory along with the checksum file like this:

radxa-cm3-rpi-cm4-io_debian_bullseye_kde.img.xz

rbuild complete

Step 4: rkdeveloptool

CM3 modules with on-board flash storage need to be mounted as a Mass Storage Device (MSD) so you can flash them. The RPi IO board has a dedicated OTG microUSB connector specially for this purpose.

Radxa provides a tool, rkdeveloptool for flashing eMMC media over USB from a host PC. Although there are instructions for doing this from a Mac or Windows PC, I always recommend flashing LInux from a Linux host. You are far less likely to have any issues if you do this. 

On the Linux host you have to build and install the software on your system. 

Documentation can be found here: Radxa rkdeveloptool

I used the following sequence to build rkdeveloptool successfully including adding the patches:

$ sudo apt-get update
$ sudo apt-get install -y libudev-dev libusb-1.0-0-dev dh-autoreconf pkg-config libusb-1.0 build-essential git wget
$ git clone https://github.com/rockchip-linux/rkdeveloptool
$ cd rkdeveloptool
$ wget https://patch-diff.githubusercontent.com/raw/rockchip-linux/rkdeveloptool/pull/73.patch
$ wget https://patch-diff.githubusercontent.com/raw/rockchip-linux/rkdeveloptool/pull/85.patch
$ git am *.patch
$ autoreconf -i
$ ./configure
$ make -j $(nproc)
$ sudo cp rkdeveloptool /usr/local/sbin/

Check version is at least 1.32:

$ rkdeveloptool -v
rkdeveloptool ver 1.32

Step 5: Flash eMMC

With rkdeveloptool installed successfully on the host, the next step is to flash the eMMC, where 2 stages are required. The first is to flash the Secondary Program Loader (SPL) which must be followed by flashing the OS image in the same Terminal session.

Download the SPL for the CM3 to the same location as your OS image: https://dl.radxa.com/rock3/images/loader/radxa-cm3-io/rk356x_spl_loader_ddr1056_v1.10.111.bin

Make sure the IO board is powered off. Remove all connections including USB-to-TTL cable.

Connect the host PC with a USB-A to microUSB cable to the socket next to the SD card slot on the IO board.

Tip: When flashing RPi CM4 modules a jumper is required on J2 - DO NOT install this when flashing ROCK CM3 modules

Connect the host PC

Open a Terminal on your host and change to your build directory then decompress the system image:

$ cd rbuild
$ unxz -k radxa-cm3-rpi-cm4-io_debian_bullseye_kde.img.xz

Now press and hold the tiny Maskrom button on the CM3 module whilst applying 12V power to the IO board.

Maskrom button on the CM3 module

Check that the CM3 module is visible as a MSD, run the SPL binary and flash the image as superuser, then reset the module:

$ rkdeveloptool ld
 DevNo=1	Vid=0x2207,Pid=0x350a,LocationID=303 Maskrom
$ sudo rkdeveloptool db rk356x_spl_loader_ddr1056_v1.10.111.bin
$ sudo rkdeveloptool wl 0 radxa-cm3-rpi-cm4-io_debian_bullseye_kde.img
$ sudo rkdeveloptool rd

The Green LED on the CM3 will turn on and after a few seconds the Green LED on the IO board will start to flash indicating the system has started successfully. 

Installation complete and system has started successfully

Step 6: Login

Once the system has booted, plug in your HDMI cable to HDMI0, keyboard, mouse and Ethernet cable and the desktop login should display on the monitor. You can then login:

username: rock

password: rock

hostname: radxa-cm3-rpi-cm4-io

Once you are in, you can setup SSH access:

Open Konsole from the Applications menu and enable ssh.socket

$ sudo systemctl enable ssh.socket
$ sudo systemctl start ssh.socket

You can login remotely from your host via SSH if you have Ethernet attached:

$ ssh rock@radxa-cm3-rpi-cm4-io

Login

Step 7: Poweroff

When you have finished investigating the build, power the system down properly with the Shutdown option in the menu or the poweroff command before removing the power supply:

$ sudo poweroff

Step 8: Debugging

Minicom is a serial console application that allows you to see the kernel boot messages and gives access to console login. It can help to debug any boot issues at system startup before the display is accessible.

Install the package on the host with:

$ sudo apt install minicom

Create a config file in your home directory with the following filename .minicom.rock and contents:

$ vi .minirc.pi
pu port /dev/ttyUSB0
pu baudrate	115200
pu bits 8
pu parity N
pu stopbits	1
pu rtscts No

Connect the USB-to-TTL cable to the GPIO header and the host USB-A socket.

Open a Terminal and start minicom:

$ minicom pi

Debugging - connect cable

Performance

The ROCK CM3 module will give superior performance over the RPi CM4 unit, so let’s test this out.

Tests were carried out using the same RPi Compute Module IO board by swapping the modules, using the 64-bit RPi OS Desktop version for the CM4 module and the custom built Bullseye KDE system from this project for the CM3 unit.

Running the 4k Bubbles screensaver on YouTube highlights graphics performance really well. Just set the screen resolution (cog icon) as high as possible to run the test.

eMMC storage read speeds were test by installing hdparm and running the following command several times:

$ sudo apt install hdparm
$ sudo -i
# hdparm -t /de/mmcblkN

Here’s the results for the RPi CM4 module, it can reach HD resolution (1080p) on YouTube and up to 84 MB/sec read speeds for eMMC storage:

results for the RPi CM4 module

The ROCK CM3 module gives much better results, with YouTube performance of 4K (2160p) and eMMC read performance of up to 170 MB / sec.

Results for ROCK CM3 module

Summary

The ROCK CM3 SoM makes a great drop-in replacement for the RPi CM4 module on the Raspberry Pi Compute Module 4 IO Board.

Radxa have made the building Operating Systems for this combination relatively straightforward with their build tool, rbuild. It runs in a containerised environment so all the required toolchain components are self contained and version controlled.

They also provide an effective tool for flashing the on-board eMMC storage on the ROCK CM3 using the dedicated rkdeveloptool which mounts the device as an MSD on the host system.

If you take the time to set up a Linux host with all the required tools, it makes easy work of developing for the ROCK CM3 module and flashing the on-board memory.

This gives you a system with true 4K video performance, better storage IO speeds and high product availability as an alternative to the RPi CM4 modules.

References:

Radxa rbuild

I'm an engineer and Linux advocate with probably more SBCs than a Odysseus moon lander

Comments