Page 1 of 4 The CM5 with the CM5IO development board is slightly more complicated to set up than other members of the Pi family - find out more. This is an extract from the newly-published Raspberry Pi Compute Module 5 IoT In C
Raspberry Pi Compute Module 5 IoT In C Using Linux Drivers and Gpio5
By Harry Fairhead
 Buy from Amazon.
Contents
- The CM5 For The IoT
- Setting Up the CM5 ***NEW!!
- C and Visual Studio Code
- Drivers: A First Program
- The GPIO Character Drive
- GPIO Using I/O Control
- GPIO Events
- GPIO Hardware With Gpio5
- Some Electronics
- The Device Tree
- Pulse Width Modulation
- SPI Devices
- I2C Driver and Gpio5
- Sensor Drivers – Linux IIO & hwmon
- 1-Wire Bus
- The PIO
- Going Further With Drivers
- Almost Real-Time Linux
- Appendix I Gpio5
<ASIN:1871962951>
Setting Up the CM5
The CM5 is a little different to the other members of the Pi family and setting it up before you get started on software development is a little more complicated. In particular, you need to put a CM5 and a CM5IO together. If you haven’t bought a CM5 Lite then you have to find a way of installing the OS into the eMMC and there is the problem of how to deal with the boot loader stored in EPROM.
The CM5IO
Although you can use a CM4IO board with the CM5, new projects should always select the CM5IO board. It’s specification is given as:
-
HAT footprint with 40-pin GPIO connector
-
PoE header
-
2× HDMI ports
-
2× USB 3.0 ports
-
Gigabit Ethernet RJ45 with PoE support
-
M.2 M key PCIe socket compatible with the 2230, 2242, 2260, and 2280 form factors
-
MicroSD card slot (only for use with Lite variants with no eMMC; other variants ignore the slot)
-
2× MIPI DSI/CSI-2 combined display/camera FPC connectors (22-pin 0.5 mm pitch cable)
-
Real-time clock with battery socket
-
4-pin JST-SH PWM fan connector
-
USB-C power using the same standard as Raspberry Pi 5 (5V, 5A (25W) or 5V, 3A (15W) with a 600mA peripheral limit)
-
Jumpers to disable features such as eMMC boot, EEPROM write, and the USB OTG connection
 You can see the connectors and jumpers in the image above. They are mostly self explanatory, but there are a few things to note:
-
CAM/DISP 0 at the left is always ready to be used but CAM/DISP 1 needs two jumpers to be fitted to J6.
-
The GPIO connector, labeled Raspberry PI HAT on the board, can be used to fit a standard Pi 40-way HAT and there are four mounting holes to let you position the expansion cards.
-
You can select 1.8V or the standard 3.3V GPIO lines by moving the resistor at R5 to R4 – as this is a surface mount resistor it requires a soldering iron and skill.
-
The RTC battery holder takes a CR2032 battery and if fitted it supplies power to the onboard RTC.
-
The PoE Power over Ethernet connector J9 supplies the raw PoE signals and needs to be connected to a PoE hat to make use of it.
-
If the board has eMMC Flash installed then the SD card reader is ignored.
-
J2 at the top left of the board sets a number of useful defaults using jumpers:
Pin
|
Function
|
|
1-2
|
nRPIBOOT
|
If fitted, disables eMMC Boot
|
3-4
|
EEPROM_nWP
|
If fitted, write-protects the EEPROM
|
5-6
|
USB_OTG
|
If fitted, enables OTG mode
|
8
|
SYNC_OUT
|
IEEE1588 timing pin - can be configured as input
|
12
|
PMIC_ENABLE
|
Enable power control
|
13-14
|
Wake up
|
Connects a push button to wake up or shut down CM5
|
|