# Interfaces

This chapter describes the hardware interfaces, and some hardware modules, including Pinout and some guides.

# Interface Diagram

# Top

# Bottom

# System Functions

# micro SDCard

CM4 Media support multiple-storage solutions, eMMC & SSD HD or SD Card & SSD HD can be used at the same time, but eMMC & SD Card can't be used at the same time because those two devices are used same data bus.

WARNING

eMMC and SD card cannot be used at the same time.

If you use the Desktop version of Raspberry Pi OS, the micro SDCard will be automatically mounted and a 'Disk' icon will be added to the Desktop. If you use the Lite version of Raspberry Pi OS, You can use lsblk to detect the block devices and mount to mount the device to a directory.

Detect the Block Device

lsblk

NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    0 111.8G  0 disk
└─sda2        8:2    0 111.5G  0 part /media/pi/eec87982-8b3e-402c-a25e-fda6c75b0cc9
mmcblk0     179:0    0  14.8G  0 disk
├─mmcblk0p1 179:1    0   256M  0 part /boot
└─mmcblk0p2 179:2    0  14.6G  0 part /

lsblk will list all the block devices, including eMMC, micro SDCard, U-Disks, SSD. in the above command:

  • mmcblk0 is the eMMC/SDCard device, and it has 2 partitions. mmcblk0p1 is the boot partition and mmcblk0p2 is the rootfs
  • sda1 is the SSD device. It has 1 partition and mountes to /media.

Mount SDCard partition

Before we read / write the micro SDCard, we should mount its parttions to a directory. Let's take /mnt for example:

sudo mount /dev/mmcblk2p1 /mnt

Then we can read from /mnt or write to /mnt to read write the SD card.

Unmount SDCard partition

sync
sudo umount /mnt

Automatically Mount when System Boot

We can modify fstab to automatically mount the block device when reboot. More details please refer to the manual of fstab.

Reference

# RTC (Real Time Clock)

There is a RTC on CM4 Media. To use it, please make sure a CR1220 RTC battery is installed.

In the pre-installed Raspberry Pi OS, the RTC sync service is enabled default. The service can automaticlly sync clock betweeen RTC and system clock:

  • When boot up, the service will get the clock from RTC and update the system clock with it
  • If CM4 Media has Internet accessing, the system clock will sync with the NTP server.
  • When system poweroff, the service write the system clock to RTC
  • Thanks to the CR1220 battery, the clock is continually running when the CM4 Media is turned on or off

In this way, we can get a reliable clock.

TIP

Note: If it is the first time boot up, there is no valid date in RTC, and this will result sync to system clock failed. Don't worry, Just reboot and it will be Okay.

If you don't want this service, you clould disable it manually:

sudo systemctl disable rtc
sudo reboot

Re-enable the service

sudo systemctl enable rtc
sudo reboot

# RTC Manually Operation

Read clock from RTC

sudo hwclock -r

Sync RTC clock to system clock

sudo hwclock -s

Write system clock to RTC

sudo hwclock -w

# Trouble Shooting

First, please check if the RTC device(/dev/rtc0) is loaded:

ls /dev/rtc0

If no, you may use the original Raspberry Pi OS without our BSP installed, Please refer to section: Intall BSP by apt-get to install the BSP package. You may also want to install ed-rtc package to enable RTC automatically sync service.

Some other possible doubts:

  • No CR1220 battery installed
  • Internet is necessary to sync time from Internet. Besides, you should enable UDP 123 port.

# Display

CM4 Media has Triple Display channels and could could feed 2 devices simultaneously.

  • If you use the Desktop version of Raspberry Pi OS, you can set it by Menu -> Preferences -> Screen Configuration
  • If you use Lite version of Raspberry Pi OS, please refer to xrandr (opens new window)

# Standard HDMI A

CM4 Media has a standard HDMI Type A port and a Micro-HDMI port. Just plug to a HDMI monitor and it will work.

# Wired Interfaces

# Gigabit-Ethernet

CM4 Media has a 10 / 100 / 1000Mbsp Ethernet. We suggest to use Cat6 Ethernet cable. In Raspberry Pi OS, it uses DHCP to get IP address default. If you want to set a static IP address, please refer to the usage of dhcpcd: manual of dhcpcd (opens new window)

# USB 2.0 Host

CM4 Media has 1 USB 2.0 Type A ports.

# USB 3.0 Host

CM4 Media has 2 USB 3.0 Type A ports.

# 3.5mm Jack

CM4 Media have a 3.5mm Headphone Jack, and supports external microphone input

# Wireless

CM4 Media provide rich wireless network support, including Dual-band WiFi, Bluetooth 5.0 and optional 4G LTE.

# Dual-band WiFi

The CM4 Media can be supplied with an onboard wireless module supporting both:

  • 2.4 GHz, 5.0 GHz IEEE 802.11 b/g/n/ac wireless
  • Bluetooth 5.0, BLE

The CM4 Media has an onboard antenna. If used it should be positioned in the product such that it is not surrounded by metal, including any ground plane. Alternatively, the CM4 Media has an external antenna which is certified when you purchase CM4 Media with WiFi and metal case.

# Enable WiFi

You should set the country code for your wireless network before you use. If you use a Desktop OS, please refer to: Raspberry pi Documentation - Configuring Networking - Using the Desktop (opens new window), If you use a Lite version OS, please refer to: Raspberry pi Documentation - Configuring Networking - Using the Command Line (opens new window).

# Internal or External Antenna

WARNING

the default WiFi antenna setting of pre-intalled OS is internal antenna. If you purchase CM4 Media WiFi metal case and external antenna, you should update the settings.

Edit /boot/config.txt

sudo nano /boot/config.txt

For external antenna, add:

dtparam=ant2

For internal antenna, add:

dtparam=ant1

# AP

WiFi can also be configured to AP mode.

a Routed Wireless Access Point

                                        +- RPi -------+
                                     +---+ 10.10.0.2   |          +- Laptop ----+
                                     |   |     WLAN AP +-)))  (((-+ WLAN Client |
                                     |   | 192.168.4.1 |          | 192.168.4.2 |
                                     |   +-------------+          +-------------+
                 +- Router ----+     |
                 | Firewall    |     |   +- PC#2 ------+
(Internet)---WAN-+ DHCP server +-LAN-+---+ 10.10.0.3   |
                 |   10.10.0.1 |     |   +-------------+
                 +-------------+     |
                                     |   +- PC#1 ------+
                                     +---+ 10.10.0.4   |
                                         +-------------+

a Bridged Wireless Access Point

                                         +- RPi -------+
                                     +---+ 10.10.0.2   |          +- Laptop ----+
                                     |   |     WLAN AP +-)))  (((-+ WLAN Client |
                                     |   |  Bridge     |          | 10.10.0.5   |
                                     |   +-------------+          +-------------+
                 +- Router ----+     |
                 | Firewall    |     |   +- PC#2 ------+
(Internet)---WAN-+ DHCP server +-LAN-+---+ 10.10.0.3   |
                 |   10.10.0.1 |     |   +-------------+
                 +-------------+     |
                                     |   +- PC#1 ------+
                                     +---+ 10.10.0.4   |
                                         +-------------+

More details please refer to open source project: github: garywill/linux-router (opens new window)

# Bluetooth 5.0

Customers can use bluetoothctl to discover, pair and connect a bluetooth device. Please refer to: ArchLinux - Wiki - Bluetooth (opens new window)

# Expansion Interfaces

# IMX219 8-megapixel sensor

There is an 8-megapixel camera on the CM4 Media, which is fully capable of everyday needs There are native camera usage commands on RaspOS. For specific usage, please refer to the official Raspberry Pi documentation libcamera (opens new window)

# Mini PCIe

There is a Mini PCIe slot on CM4 Media. It can be installed some moudles like 4G, 5G and NPU etc. There's 1-lane PCIe Gen2, up to 5Gbps(default is used for SSD).