Embedded product with Raspberry Pi Compute Module

Raspberry Pi is a good solution for creating low-cost, powerful embedded devices when you have no need of self powered solution.

I had to create a such device recently to make a programming machine for my IoT devices. I was looking for a compact solution, powered with PoE, industrial grade, able to run a Java program and host a custom HAT with my home-made chip programmer.

Here you see a picture of the first prototype of this product with the different components visible: The green board is a Rapsberry Pi compute module CM3+ with 16GB eMMc flash drive. The blue motherboard is a Waveshare PoE board for CM3+. The Black board is my custom HAT hosting the programming solution based on a STM32.

In this post, I’ll detail a bit these different components and the way they are configured to illustrate how to easily make a such system alive.

RaspberryPI – Compute Module

The compute modules are the industrial version of the well known RaspberryPi. Recently the compute node 4 with a new form factor has been announced. As the ecosystem for this new version with a different form factor and different connector is not yes available, my choice has been to make my project around the CM3+ version. This version of Raspberry Pi has a SODIMM form factor and connector. It can’t be use on its own and needs a motherboard to host it.

In terms of specifications it has a 1.2GHz quad core, 1GB of RAM and and embedded eMMC flash from 0GB to 32GB. The price is around 30-40€ depending on the eMMC flash size you selected.

Waveshare IO board for Compute Module

This compact mother board (11.5 x 8.5cm) hosts a compute module on the white SODIMM connector and propose different IOs. The first one I was interested in is the PoE / Ethernet connector. Thanks to that board you can limit the connectivity of the board to a single cable providing network and power. If you don’t have PoE network, you can use a PoE injector. This board supports active PoE (802.3af). You can also power it with an USB supply on the post 10.

In terms of configuration, this board have some jumpers like the 22th enabling / disabling the PoE supply or the 21 connecting the RaspberryPi UART to and external USB connector or not.

On the left side there are 3 interesting USB connector. We talked about the 10 (power source) and the 8 (Serial port). There is a third one, the 9th, this slave USB connector allows to access the eMMC flash as an external drive from a computer to flash it easily. An USB master connector and screen connector on the right side of the board.

The board also have 2 camera interfaces and 1 LCD interface available. A fan control system is also available on the board.

The price is under 40€, the board is available on waveshare website as Amazon.

Custom HAT

There is nothing really important on this component as it is dedicated to a specific application. HAT follows a standard design at least until the CM4. This standards includes the way to fix the boards all together. So, basically, there are on the Waveshare mother board the hole to screw the hat at the right place. This standard is the same for a CM3 as for a classical raspberryPi. Some years ago I’ve made a standard HAT reference design for kicad.

This HAT uses the CM3+ Serial port, on this point, I noticed with this experience that the Serial port cabling is changing from a raspberryPi version to another. On CM3+ (at least with the waveshare board), the pin 14,15, usually connected to ttyAMA0 are connected to ttyS0.

Setup the CM3+

I’ve made a capture of all this setup in a (long) live stream of my configuration if you want to watch all the steps in details. But you can directly jump to the text for the main phases.

To setup the Compute Module 3+, you need to install at first a software on it to make it an external drive accessible from a computer. This step is requiring a Windows environment and a dedicated tool : RPIBoot_setup.

When using a VM to execute this step, you need to know that the CM3+ will be seen avec a “Broadcom…” device and the installation of the bootloader requires two CM3+ reboot. So you need between the two to reconnect the USB device to the VM. Once the CM3+ has been setup the name of the device will change.

Alternate fashing process

There is an alternate way for this process: using another raspberry PI instead a windows machine. As I’m running windows on VM and broadcom discovery is not easy, particularly when I had a kernel panic, the RPI solution simplified my life.

Install rpiboot on linux / raspberryPi

[~] apt install libusb-1.0.0-dev
[~] git clone --depth=1 https://github.com/raspberrypi/usbboot
[~] cd usbboot
[~] make

Then you just need to execute it and it makes the job

[~] rpiboot

Setup Rapios

After this step you can access the CM3 as any not initialized external drive. Exactly like a SDCARD where you want to deploy your Linux distribution. My favorite tool for flashing Linux is now BalenaEtcher.

After flashing the device, I did not immediately reboot the CM3+: after this step you can access the flash drive and the boot directory. There are two things you can do on it:

  1. Create an empty file named ssh in the root of the flash drive: this will enable SSH automatically and let you access the CM3+ over the network.
  2. Modify the cmdline.txt file to add a default IP. You can do this by adding the following content at the end of the line:
... ip=172.16.0.1::172.16.0.254:255.255.255.0:rpi:eth0:off

This will make the CM3+ accessible with IP 172.16.0.254. What is also cool is that the CM3+ will also get a second IP from a DHCP, so you will be able to get this IP and access internet for the post configuration steps.

Once such setting made, you can reboot the CM3+. Linux distribution is starting and the Pi is accessible over the network with the given address. You can automate all the next steps with Ansible to release your product automatically.

Installing it in a box.

It’s not really easy to find a compact plastic box where to install all that stuff. I’ve been able to find a Hammond enclosure HM-1599TABMBK correctly fitting. You need to remove some screw location and create some 3D printed parts to fix it into the enclosure but it works. I’ll potentially later release the 3D parts I’ve made for the facade and the main board fixing.

This entry was posted in Systems and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

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