Do you have a question about the MyPi Industrial CM4 Integrator Board and is the answer not in the manual?
Questions and answers
Summary of Contents for Embedded MyPi Industrial CM4 Integrator Board
Page 1
MyPi Industrial CM4 Integrator Board User Guide Issue : 2.1 Dated : June 2023 Prepared By : Andrew O’Connell Page 1...
Page 2
FEATURES Supports All Raspberry Pi Compute Module 4 variants 1 x 10/100/1000 LAN 1 x 10/100 LAN 2 x USB 2.0 (external access) 1 x uSD Card Storage (USB Interfaced) 1 x mPCIe Interface (USB Interfaced) + SIM ...
Page 4
HARDWARE CONFIGURATION LINKS RESET This LED indicates when the Pi unit is in reset condition and has asserted an external reset signal, which is routed to parts 3, 8 & 13 This GPIO driven LED indicates ‘power’ functionality on a Raspberry Pi and can be repurposed for general usage, signal also connected the bottom red LED.
Page 5
WIFI DIS Fitted Forces CM4 module to disable WiFi RF Output Open Default EEPROM DIS Fitted Indicates to CM4 module to disable EEPROM (Facility not enabled in firmware by default) Open Default WD EN Fitted Connect External Watchdog Enable Line to GPIO16 Open Default Fitted...
Page 6
WATCHDOG RESET OUT Fitted Connect External Watchdog Reset Out to CM4 RUN/RESET Line Open Default Page 6...
Page 7
RASPBERRY PI COMPUTE MODULE PROGRAMMING The unit as shipped is configured to allow the eMMC flash on the compute module to be re- programmed without removing the PCB from the enclosure. Units come pre-programmed with the demo Raspbian OS pre-installed, this section describes how to write a new disk image to the Compute Module.
Page 8
Making sure you have the unit powered off start up RPi Boot, this is easiest done via the start menu, we have found this needs to be run as ‘Administrator’ privilege mode for correct operation When the RPi-Boot starts up it’ll sit and wait for the attached board to boot up : Power up the unit and RPi-Boot will configure the unit to appear as a flash drive : When done the compute module will alternate into mass storage mode (so behaving just as though it's a USB memory stick) and windows will then recognise the module as an external drive.
Page 9
If the compute module eMMC already contains an OS Windows will recognise the FAT partition and assign that (at least) a drive letter, this is useful in the event that a configuration error with the boot files is made (e.g. dt-blob.bin or config.txt) and needs recovery actions to be performed. After drive letter assignment Windows may indicate that partitions need scanning or fixing, these can be ignored/cancelled.
Page 10
CM4 BOOT EEPROM FIRMWARE UPDATE On the CM4 it is not possible to update the boot firmware EEPROM from the command line To find the current boot loader version run vcgencmd bootloader_version For best USB and Camera support we recommend installing version July 6 2021 or later To update the firmware on a CM4 device the same rpiboot program is used, but with a different syntax to usual.
Page 11
CM4 SECURE BOOT Secure boot facilities on the CM4 are currently in beta release, see below website link for examples and notes on how to create a signed boot image https://github.com/raspberrypi/usbboot#secure-boot---image-creation See also TPM Hardware Security Module notes following Page 11...
Page 12
SYSTEM GPIO In order to minimise CM4 GPIO line usage an I2C interfaced PCA9536 GPIO expander has been included These present as gpio500-503 on the OS and are configured via the system device tree overlays : # I2C Bus (Note : Also need to add i2c-dev to /etc/modules) dtparam=i2c_arm=on dtoverlay=pca953x,addr=0x41,pca9536 A bash script /etc/init.d/mypi-init.sh which is called from /etc/rc.local during boot-up which creates...
Page 13
USB INTERFACE There are two critical settings that determine the USB controller active on the CM4, without these steps the system will either disable the USB port or enable the low bandwidth port controller. 1. Firmware version This should be version dated July 6th 2021 or later, needed to enable the internal controller 2.
Page 14
USB SD CARD INTERFACE The on-board micro SD Card is interfaced to the Raspberry Pi Compute Module using on-board Microchip USB2240 SD card interface controller, this provides fast access to secondary storage for datalogging. configuration file /etc/udev/rules.d/8-sdcard.rules creates the below /dev shortcuts for the main SD Card and any partitions contained This SD card cannot be booted from however can be auto mounted at boot (via /etc/fstab) so offers a low cost method of expanding the core eMMC filesystem...
Page 15
USB 10/100 LAN + USB CONTROLLER Integrated on-board is an Microchip LAN9514 device, this is connected to the Raspberry Pi via USB port and provides 4 additional downstream USB ports, two of which are used for the on-board mPCIe interface and USB2240 SD Card controller and the remaining two are brought out to the front face USB ports.
Page 16
USB MINI-PCIE INTERFACE The Integrated mPCIe socket installed on the base board are wired to the below standard : Signals in RED are not available The below GPIO connections are made to the connector mpcie-reset -> /sys/class/gpio/gpio500/value mpcie-wdisble -> /sys/class/gpio/gpio501/value The WWAN LED is connected to the front top green bi-colour LED to indicate modem network registration/data transmission status.
Page 17
Modem Compatibility/Operation See the below link to pages from the main modem documentation section for details on how to operate modems : http://www.embeddedpi.com/documentation/3g-4g-modems The system has been pre-installed with modem helper status script modemstat which supports Sierra Wireless, Quectel and Simcom See web page below for more details https://embeddedpi.com/documentation/3g-4g-modems/mypi-industrial-raspberry-pi-3g-4g- modem-status...
Page 18
QMI Network Connection example : Page 18...
Page 19
QUECTEL-CM example Quectel Modems have a utility provided by Quectel to manage the connection process and which will automatically configure any raw-ip settings First install the all-in-one quectel-cm connection helper program; this will automatically configure any raw-ip settings https://github.com/mypiandrew/quectel-cm/releases/download/V1.6.0.12/quectel-CM.tar.gz The command has the below syntax quectel-CM [-s [apn [user password auth]]] [-p pincode] [-f logfilename] -s [apn [user password auth]] Example 1: ./quectel-CM...
Page 20
Sample Connection output, note the fall back to raw-ip is automatic. Killing the process or issuing Ctrl-C results in the connection to be disconnected and interface disabled. Page 20...
Page 21
mPCIe IO Cards Also available are our range of pre-certified RF modules : LoRa (Microchip RN2483/RN2903) Bluetooth 4.0 BLE (Silicon Labs/BlueGiga BLE112) Bluetooth 5 (Laird BL652) enOcean TCM310 ZIGBEE/802.15.4 (Silicon Labs/Telegesis RX357 Module L.R. UFL) ...
Page 22
SPI TRUSTED PLATFORM MODULE Integrated on-board is an Infineon SLB9670 TPM 2.0 device, this is connected to the Raspberry Pi via the SPI-1 bus. Support for this device was included in mainline Kernel 4.14.85 and the device is configured via the files below /boot/config.txt /boot/overlays/tpm-spi1.dtbo...
Page 23
I2C USER EEPROM A 256Byte EEPROM for user ID storage The lower 128Byte has read/write access for user storage, the first 4 hex bytes have been programmed with an ID code visible on the barcoded sticker affixed to the PCB. The upper 128byte is read only with the last 32bits (6 hex bytes) containing a unique ID code.
Page 24
For convenience a script to create two bash environment variables has been created in /etc/profile.d setup-e2id-vars.sh creates e2idsettings.sh on first run These environment variables can be used in scripting by any user Also included on the factory Raspbian OS image is the eeprog command line utility that can also be used to read/write the EEPROM (source code in /root/eeprom) Page 24...
Page 26
I2C FAN CONTROLLER Integrated onto the main board is a Microchip EMC2301 PWM Fan controller This device occupies address 0x2F and can be operated by either basic I2C commands or a more comprehensive kernel driver I2C Method Turn fan off: i2cset -y 1 0x2f 0x30 0x00 Turn fan on 100%: i2cset -y 1 0x2f 0x30 0xff...
Page 27
I2C REAL TIME CLOCK A DS1338Z-33+ Real Time Clock with battery backup cell is integrated onto the board, this is configured by the below device tree overlay dtoverlay=i2c-rtc,ds1307,addr=0x68 Further OS integration to remove the fake-hwclock functionality, and ensure the system reads/writes to the hwclock, has also been done.
Page 28
WATCHDOG The on-board external watchdog with a 60 Second delay timer, provided by a Texas Instruments TPS3431 part, the reset output of this is connected to the Raspberry Pi Compute module’s reset pin. This is provided to give an extra layer of resilience over a system lockup in the event that the user considers the RPi on-chip watchdog is unsuitable for their application.
Page 29
Watchdog integration can be directly done inside application code by writing directly to the GPIO lines or can be done via a kernel GPIO watchdog process via the watchdog package which provides more varied sources for monitoring. The OS files for the CM4 setup have been placed in the /root/watchdog folder on the demo OS image.
Page 30
External Watchdog OS Integration Integrated into the Raspbian OS there are pre-built utilities for configuring and managing watchdogs, in this example we will show how to configure the OS to use the on board external watch dog such that a file's last update timestamp can trigger a watchdog time out. In this configuration if the target file is not updated the system will attempt an “orderly”...
Page 31
Copy the device tree overlay for this module to the /boot/overlays folder if not already done so to configure the kernel to add a GPIO watchdog to the system Add the below line to the end of /boot/config.txt to enable the overlay dtoverlay=ext-watchdog Install the configuration files for the watchdog service and the service file that starts the watchdog OS service then enables the watchdog.
Page 32
Finally we need to remove the reference to the watchdog from /etc/init.d/mypi-init.sh to allow the watchdog and service file to claim the relevant IO lines. Do this by adding a # to the start of of each of the lines highlighted below Page 32...
Page 33
On reboot you should be able to issue the command shown below to check the services have started correctly. # systemctl status watchdog Page 33...
Page 34
/etc/watchdog.conf contains the configuration for the external watchdog process, this has been configured in this example to monitor the file /var/log/data and check to see its timestamp updates at least once every 30 seconds Other options are available : https://manpages.debian.org/testing/watchdog/watchdog.8.en.html https://manpages.debian.org/testing/watchdog/watchdog.conf.5.en.html Note that the watchdog device we have configured is /dev/watchdog1 and not /dev/watchdog0 which is the internal Pi CPU watchdog)
Page 35
If the file /var/log/data we have configured as the test for watchdog time out is not written to for a period of 3 x the change value (in seconds) then the system will attempt a managed restart, by shutting as many services down as possible etc and then stopping the watchdog timer, causing a hard reset At any point up to this final time out writing/touching the file will reset the counter.
Page 36
GPIO CARD SLOT The IO Card slot on the board supports a variety of interface cards NOTE : Use of CAM 0 and GPIO0/1 (TX2/RX2) are mutually exclusive Note that the green 8 way plug in screw terminal connector is uncommitted and is defined by the signals connected to IO-OUT on the 20way connector giving rise to a truly flexible IO interface solution.
Page 38
Full Pi GPIO Function Listing GPIO Pull ALT0 ALT3 ALT4 ALT5 Notes GPIO0 High SDA0 TXD-2 SDA6 CAMERA 0 | IO SLOT GPIO1 High SCL0 RXD-2 SCL6 CAMERA 0 | IO SLOT GPIO2 High SDA1 SDA3 I2C1 (IO SLOT) GPIO3 High SCL1 SCL3...
Page 39
DUAL CAMERA Dual Camera support has the below pre-requisites 1. Boot EEPROM Firmware version should be 6 July or later 2. System config.txt configuration settings for camera usage 3. System dt-blob.bin file configuring the camera setup This file is located in /boot and configures the control lines and interfaces used for camera setup Reboot the system to complete the changes Page 39...
Page 40
With this in place the command below should report back accordingly after the system has rebooted. Note : If 2 cameras are configured (as per default image) but only 1 camera is connected it will always be detected as camera 0 regardless of which physical port the camera is plugged into. Page 40...
Page 41
10/100/1000 ETHERNET INTERFACE The integrated Gigabit has been brought out to the main face of the card, this takes the place of the RJ45 Serial port on the CM3 Integrator board, so as to allow easy hardware migration. Note that the Gigabit interface takes its MAC address from the CM4’s serial number. Page 41...
Page 42
POWER IN DIGITAL INPUT The Power input connector has an integrated opto-isolated digital input allowing any voltage from 5V up to 48V to be registered as a 3V digital signal on the CPU side. Here we are re-purposing the Analogue In 0 pin of the CM4s Power Management Controller IC We have created a simple bash script to make the process of reading this input easy and report the logical input state Page 42...
Page 43
OS CONFIGURATION FILES This is a list of the files altered from a base install to create the demo OS image /boot/dt-blob.bin /boot/config.txt /boot/cmdline.txt /boot/overlays/tpm-spi1.dtbo /boot/overlays/disablepcie.dtbo /boot/overlays/ext-watchdog.dtbo /usr/local/bin/camerastat /usr/local/bin/deleteallsmsmessages /usr/local/bin/deletemessage /usr/local/bin/digin.sh /usr/local/bin/eeprog /usr/local/bin/fanctl.sh /usr/local/bin/mbpoll /usr/local/bin/modemstat /usr/local/bin/openopc -> /opt/OpenOPC-1.3.1/src/openopc.py /usr/local/bin/qmi-network-raw /usr/local/bin/resetbyauthorized.sh /usr/local/bin/sendsms /usr/local/bin/smscmd /usr/local/bin/smscmddemo.sh...
Page 44
RASPBERRY PI DOCUMENTATION Raspberry Pi have produced a comprehensive knowledge base on how to configure and control various aspects of the Compute Module and it’s OS. https://www.raspberrypi.com/documentation Page 44...
Page 45
SCHEMATICS A reduced schematic set can be provided on request, please contact your technical support representative for more details. Page 45...
Page 46
Properly shielded and grounded cables and connectors must be used in order to meet FCC emission limits. Embedded Micro Technology is not responsible for any radio or television interference caused by using other than recommended cables and connectors or by unauthorized changes or modifications to this equipment.
Need help?
Do you have a question about the MyPi Industrial CM4 Integrator Board and is the answer not in the manual?
Questions and answers