Raspberry Pi CM5 carrier board (USB-C + M.2), designed as an iPad companion. Revision A.
  • Python 95.5%
  • Shell 2.4%
  • Makefile 1.3%
  • Roff 0.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Ric Harvey b14bb68e39
Some checks failed
CI / Test and build .deb (push) Failing after 0s
feat(power): add cm5-carrier-power package and Forgejo workflows
Power management for the rev B carrier as an arm64 .deb: a device tree
overlay for the MAX17048, the cm5-power service (USB-disconnect and
low-battery shutdown, hooks) and charger ship mode at poweroff.

ci/build.sh tests and packages it in a Debian container. CI runs it when
cm5-carrier-power/ changes; a v* tag attaches the .deb to a release.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 23:38:48 +00:00
.forgejo/workflows feat(power): add cm5-carrier-power package and Forgejo workflows 2026-11-22 23:38:48 +00:00
cm5-carrier-power feat(power): add cm5-carrier-power package and Forgejo workflows 2026-11-22 23:38:48 +00:00
docs Add CM5 USB-C + M.2 carrier, revision B 2026-11-22 23:38:48 +00:00
fab Add CM5 USB-C + M.2 carrier, revision B 2026-11-22 23:38:48 +00:00
lib Add CM5 USB-C + M.2 carrier, revision B 2026-11-22 23:38:48 +00:00
renders Add CM5 USB-C + M.2 carrier, revision B 2026-11-22 23:38:48 +00:00
scripts Add CM5 USB-C + M.2 carrier, revision B 2026-11-22 23:38:48 +00:00
.gitignore Add CM5 USB-C + M.2 carrier, revision A 2026-11-22 23:21:18 +00:00
cm5-usbc-m2-carrier.kicad_dru Add CM5 USB-C + M.2 carrier, revision A 2026-11-22 23:21:18 +00:00
cm5-usbc-m2-carrier.kicad_pcb Add CM5 USB-C + M.2 carrier, revision B 2026-11-22 23:38:48 +00:00
cm5-usbc-m2-carrier.kicad_pro Add CM5 USB-C + M.2 carrier, revision B 2026-11-22 23:38:48 +00:00
cm5-usbc-m2-carrier.kicad_sch Add CM5 USB-C + M.2 carrier, revision B 2026-11-22 23:38:48 +00:00
fp-lib-table Add CM5 USB-C + M.2 carrier, revision A 2026-11-22 23:21:18 +00:00
README.md Add CM5 USB-C + M.2 carrier, revision B 2026-11-22 23:38:48 +00:00
sym-lib-table Add CM5 USB-C + M.2 carrier, revision A 2026-11-22 23:21:18 +00:00

CM5 USB-C + M.2 carrier with LiPo power (rev B)

A carrier board with the same 55 × 40 mm outline as the Raspberry Pi Compute Module 5. The CM5 plugs onto the top; the USB-C port, an M.2 key M slot and a LiPo connector sit on the underside. Rev B adds a single-cell LiPo, a charger with power path, a 5 V boost converter and a fuel gauge, so the board keeps running when the USB source is weak (an iPad port) or unplugged.

Status: design files and software only. The board has not been built or tested. Review before ordering.

stack

This repository holds two things:

  • The board: the KiCad project, fab files, drawings and renders, in the repository root.
  • The software: cm5-carrier-power/, the power-management package for Raspberry Pi OS (arm64 .deb). See Software.

What changed from rev A

Area Rev A Rev B
CM5 5 V supply straight from USB VBUS from a boost converter (U4) fed by the charger's system rail
Battery none 1-cell LiPo on J5 (JST-PH) or solder pads TP2/TP3
Charger none BQ25896 (U3), input current limit 1.5 A, or 3 A with solder jumper JP1
Fuel gauge none MAX17048 (U5) on I2C, low-battery alert to GPIO4
Buttons BOOT, PWR BOOT, RST (new, on PMIC_ENABLE), PWR
CM5 pins used power, USB, CC, PCIe plus GPIO2/3 (I2C1), GPIO4, GPIO17, PMIC_ENABLE
Parts / nets 39 / 26 73 / 47

Unchanged: board outline, layer stack, CM5 and M.2 connector positions, USB-C position, the PCIe routing and the 3.3 V M.2 regulator. The CC lines and the J1-side signals were re-routed to make room.

How the power works

USB-C VBUS ──► U3 BQ25896 ──► SYS 3.5–4.4 V ──► U4 TPS61022 ──► +5V ──► CM5, and U1 ──► 3.3 V for M.2
                  ▲  │
                  │  ▼
        Q1 ◄── battery (J5 or TP2/TP3)        U5 MAX17048 measures the battery
  • USB plugged in: U3 takes no more than the input limit from the port. If the CM5 needs more, the battery supplies the difference; if it needs less, the surplus charges the battery.
  • USB unplugged: the battery carries the load with no switch-over gap, because the CM5 always runs from U4.
  • No battery fitted: the board still runs from USB, but only up to the input limit. At the 1.5 A setting that is about 6 W at the CM5, which is not enough for a busy CM5 with an SSD. Bridge JP1 and use a 3 A source, or fit a battery.
  • Input limit: R10 sets 1.5 A maximum (1.36 A typical), chosen for an iPad port. Bridging JP1 puts R11 in parallel for 3.0 A maximum. Software can lower the limit over I2C.
  • Charging defaults (no software needed): 2.05 A, 4.208 V, 12 h safety timer. Use a protected cell of 2000 mAh or more, or lower the charge current over I2C first.
  • USB PD: CC1/CC2 still go to the CM5 (pins 94/96) and its PMIC negotiates with the source, as in rev A. VBUS stays at 5 V.
  • Charge LED (D3): on while charging, off when done or unplugged, blinking on a fault.

Functions

Function How
CM5 with eMMC Two Amphenol 10164227-1004A1RLF connectors (4.0 mm stack, 2.5 mm clearance under the module). No SD slot.
USB-C data USB 2.0 D+/D- to CM5 pins 105/103 through a USBLC6-2P6 ESD array (gadget mode and rpiboot).
Flashing Hold BOOT and tap RST, then run rpiboot. With no battery connected, holding BOOT while plugging in USB also works.
M.2 key M TE 1-2199230-6 socket on the underside, PCIe x1, 2230 or 2242 modules (NVMe SSD or Hailo).
M.2 power TPS82130 3 A buck module, 5 V to 3.3 V, switched by the CM5's PCIe_PWR_EN.
Battery J5: JST-PH 2-pin, pin 1 = + (Adafruit / SparkFun / Pimoroni polarity). TP2 (+) / TP3 (−): solder pads on the underside next to the 2242 standoff, for battery leads above about 2 A.
Reverse battery Q1 (P-MOSFET) blocks a reversed pack. With USB plugged in as well, a small trickle current still flows into a reversed pack, so do not leave one connected.
I2C devices BQ25896 at 0x6B and MAX17048 at 0x36 on I2C1 (GPIO2/GPIO3). Charger INT on GPIO17, gauge ALRT on GPIO4, both with 10 k pull-ups.
Reset SW3 pulls PMIC_ENABLE low: a hard power cycle of the CM5.
Extras Power button, activity / power / charge LEDs, /QON test pad (TP1), six fiducials.

Software

cm5-carrier-power/ is the power-management software for the board, packaged as an arm64 .deb. The board charges and runs without it; the package adds:

  • a device tree overlay that binds the MAX17048 to the kernel driver, so the battery level shows up in /sys/class/power_supply/battery;
  • cm5-power, a service that powers the CM5 off when USB power is unplugged (after a delay, cancelled if it comes back) or the battery runs low, and runs your hook scripts on power events;
  • ship mode at the end of a low-battery poweroff, so a halted board stops draining the cell.
sudo apt install ./cm5-carrier-power_0.1.0_arm64.deb
sudo cm5-power setup-boot        # adds dtoverlay=cm5-carrier-power to config.txt
sudo reboot
cm5-power status

Get the .deb from the repository's releases page, or build it with cm5-carrier-power/ci/build.sh (needs only Docker). Configuration, events, hooks and the build are described in cm5-carrier-power/README.md. Like the board, it has not been run on hardware.

Forgejo Actions (.forgejo/workflows/) tests and builds the package when cm5-carrier-power/ changes, and attaches the .deb to a release when a v* tag is pushed.

Layout

  • 4 layers, 1.6 mm: F.Cu signals and power, In1 GND, In2 GND, B.Cu signals and power pours.
  • Top (under the CM5): both CM5 connectors, charger, boost, fuel gauge, 3.3 V regulator, USB ESD. Tallest parts are the two inductors at 2.1 mm; 2.5 mm is available.
  • Bottom: USB-C on one long edge; LiPo connector, three side-push buttons and LEDs on the other; M.2 socket on a short edge with the module lying across the board. Tallest underside part is the LiPo connector at about 5.5 mm (M.2 socket 4.2 mm, USB-C 3.2 mm). Leave J5 unfitted and use TP2/TP3 if that matters for the case.
  • Power flow on the top side runs left to right: VBUS band from the USB-C vias to U3, SYS band to L2/U4, 5 V pour to four vias, then the bottom 5 V pour to the CM5 supply pins. The battery band runs from U3 to Q1.
  • CC1/CC2 run down the left edge and between the two J1 pad rows. CC2 has a 2 mm hop on the bottom layer.
  • PCIe pairs are unchanged from rev A: 0.20 / 0.15 mm on the bottom layer, P/N matched to under 0.01 mm.

Checks that were run

Check Result
KiCad DRC (rules in the project file, 0.127 mm clearance, 0.3 mm copper to edge) 0 violations, 0 unconnected
Schematic netlist (exported by KiCad) vs PCB nets vs scripts/design.py identical, 47 nets, 73 parts
CM5 pin table datasheet RP-008180-DS-7 (rev A check, plus GPIO2/3 pull-ups, PMIC_ENABLE and 5 V limits for rev B)
BQ25896, TPS61022, MAX17048, SiA447DJ pin numbers manufacturer datasheets; BQ25896-family and TPS61022 also against the KiCad library symbols
Set points boost 5.10 V (4.97–5.23 V over the reference tolerance, CM5 accepts 4.75–5.25 V); input limit 1.49 A / 2.99 A maximum
Gerbers and drill files re-read with gerbv, all 13 files load and line up

Not done: KiCad ERC (the KiCad 7 command line has none; open the schematic and run it), any simulation of the converters or the PCIe link, thermal analysis, and any check on real hardware.

python3 scripts/verify.py . repeats the netlist, pin and set-point checks.

Things to check before ordering

  1. Charging with the CM5 shut down. A USB-C source only turns VBUS on when it sees Rd on a CC line. That Rd comes from the CM5's PMIC. It is there when the CM5 is unpowered or running; whether it is still there when the CM5 is shut down but powered from the battery is not documented and not tested. If the board will not charge in that state from a C-to-C cable, that is why. R6/R7 are unpopulated 5.1 k footprints for a fixed Rd, but fitting them alongside the PMIC changes what the source sees, so treat that as an experiment.
  2. Battery deep discharge. The boost converter runs until the charger disconnects the battery at about 2.2–2.5 V. Shut the CM5 down well before that and put the charger in ship mode afterwards; the cm5-carrier-power package does both. Also set POWER_OFF_ON_HALT=1 in the CM5 EEPROM. Use a cell with its own protection.
  3. JST-PH current. The connector is rated 2 A. A CM5 with an SSD at full load can pull 4–5 A from a nearly flat cell. For that, solder the battery leads to TP2/TP3 on the underside.
  4. Heat. The charger and boost sit under the CM5 and together lose about 1–1.5 W at full load.
  5. Land patterns. As rev A for the CM5 and M.2 connectors (checked against the Raspberry Pi IO board footprints, not the Amphenol and TE drawings). New parts use KiCad library footprints unchanged.
  6. Impedance. Ask PCBWay for 90 Ω differential impedance control; geometry assumes a 0.2 mm prepreg.
  7. Software. Nothing is needed for the board to charge and run. Reading the battery level and shutting down cleanly need the cm5-carrier-power package (see Software), which is untested until a board exists. It leaves the charge settings alone; changing limits over I2C is still up to you.
  8. Parts. Manufacturer part numbers in the BOM are suggestions; confirm stock and equivalents.

PCBWay order settings

Field Value
Size / layers 55 × 40 mm, 4 layers
Thickness 1.6 mm, FR-4 Tg 150
Min track / spacing 5 / 5 mil (drawn 0.15 / 0.15 mm)
Min hole 0.2 mm
Copper 1 oz outer, 0.5 or 1 oz inner
Finish ENIG
Vias tented
Impedance control yes, 90 Ω differential on L1 and L4

Upload fab/cm5-usbc-m2-carrier-revB-gerbers.zip. For assembly add the BOM and pick-and-place CSVs from fab/. Placement coordinates are in mm from the bottom-left board corner, seen from the top. JP1, TP1, TP2 and TP3 are bare copper and appear in neither file.

Files

Path Content
cm5-usbc-m2-carrier.kicad_pro / .kicad_sch / .kicad_pcb KiCad project (written with KiCad 7.0.11; newer versions open and convert it). The schematic is one A2 sheet.
cm5-usbc-m2-carrier.kicad_dru one custom DRC rule for locating holes inside library footprints
lib/ project footprints, symbols and simple 3D models
fab/ Gerbers + drill (zip and loose), BOM, pick-and-place
docs/ rev B spec sheet, schematic PDF, assembly drawings, fab notes, drill maps, copper layer images, DRC report
renders/ 3D renders: bare board, with CM5, with SSD, with both
scripts/ the generator: design.py is the netlist and BOM, build_pcb.py the layout
cm5-carrier-power/ power-management software: overlay, cm5-power service, Debian packaging, tests
.forgejo/workflows/ CI and release builds of the .deb

The footprints M1 (CM5) and M2 (M.2 2242 SSD) carry only 3D models so the KiCad 3D viewer shows the assembled stack. They are excluded from the BOM and placement files. The CM5 and SSD models are simple illustrative blocks, not manufacturer models. The battery is not modelled. J5, L1, L2, SW1–SW3, Q1, U1, U4 and U5 use simplified bodies from lib/3d (outline and height only) because the KiCad library has no model for them.

Regenerating

The board was laid out by script. scripts/run_all.sh rebuilds the PCB, gen_sch.py the schematic, make_fab.py the fab package, render_all.sh the renders and make_overview.py the overview image (needs KiCad 7 with Python, Blender and Pillow). Re-running overwrites edits made in the KiCad GUI, so pick one way of working.

Credits

  • KiCad standard libraries (symbols, footprints, 3D models), CC-BY-SA 4.0 with the KiCad library exception.
  • M.2 socket land pattern after the footprint in Dominik-Workshop/moducard-cm5-module (MIT).
  • CM5 connector land pattern cross-checked with david0ha/astra-cm5-nano (CERN-OHL-P-2.0) and the moducard project.
  • Geometry verified (read only, nothing copied) against piecol/CM5_MINIMA_REV2 (CERN-OHL-S-2.0), which uses the Raspberry Pi CM5 IO board footprints.
  • Raspberry Pi CM5 datasheet; Texas Instruments BQ25896 and TPS61022, Analog Devices MAX17048 and Vishay SiA447DJ datasheets for pinouts and component values.