How-To SD Card
Description
The Pi-Tron CM5 has one micro SD card slot, which can only be used as storage media, however it must be activated via a software switch after the OS has started to make it accessible.

Requirements
- Development computer with Internet access for the Raspberry Pi Imager
- For CM5 eMMC models: USB-A to Micro USB cable
- 24 volts power supply with 2 pin power plug for the Pi-Tron CM5
- Micro SD Card min. 8 GB
How-To
Pi-Tron CM5 with CM5 and on-board eMMC memory
If the CM5 in the Pi-Tron CM5 has eMMC memory on-board, the SD card cannot be used right away, but can be activated later on via a software switch and can then be used as regular data storage. The mechanism is comparable to plugging in an SD card into a card reader. Once the OS has detected the SD card, it can be mounted and used just like any other removable media.
The following steps show how to activate the SD card. If no OS is installed yet, have a look at the How-To Write eMMC page for more information.
Step 1 - Enable the MCP23017
The software switch for the SD card is connected to the MCP23017 GPIO expander on-board of the Pi-Tron CM5, which means this device must be activated. For instructions on how to do this, look at the How-To Digital Input/Output (DIO) page. Then continue with this how-to.
Step 2 - Activate the SD card slot
The SD card software switch is connected to port GPB7 on the I/O expander, which corresponds to GPIO 15 when working with libgpiod.
To activate the switch enter in the command line or console:
gpioset 14 15=1
Assuming the I/O expander was registered as gpiochip14 device. The offset is 15 and set to equal 1. If the recommendations from the How-To Device Management page are used, replace the 14 with the full name of the new gpio device, e.g. pitroncm5gpio or /dev/pitroncm5gpio.
The activation of the SD card can be observed on the Pi-Tron CM5 board as well, as the green LED turns off and the blue LED turns on.

Step 3 - Insert SD card
Now insert an SD card and the OS will load the appropriate drivers and create a new /dev/sdXY device, e.g. /dev/sda.
Looking at the Kernel log should confirm this.
pi@raspberrypi:~ $ dmesg
.......
[ 123.108036] sd 0:0:0:0: [sda] 31116288 512-byte logical blocks: (15.9 GB/14.8 GiB)
[ 123.109558] sda: detected capacity change from 0 to 31116288
[ 123.114638] sda: sda1 sda2
Many messages will be shown, but at the end of the log it should say that a new device was found. In the above case there are also 2 partitions on the SD card, noted by the last line sda: sda1 sda2.
From this point on, the SD card can be used the same way as any other removable media on the Pi. Delete or create partitions as needed and format them with a file system suitable for the intended application. For example, if the SD card is holding logging information, it might be a good idea to format the SD card with the FAT32 file system, which allows the SD card to be read by many operating systems like Windows, Linux and macOS.
Restrictions
- No known Restrictions
Related documentation
- Covering all aspects of the Raspberry Pi, the official documentation: https://www.raspberrypi.com/documentation
- Manpages mount: https://manpages.debian.org/testing/mount/mount.8.en.html
- Manpages umount: https://manpages.debian.org/testing/manpages-dev/umount.2.en.html
- Manpages filesystems: https://manpages.debian.org/testing/manpages/filesystems.5.en.html
- Manpages mkfs: https://manpages.debian.org/testing/util-linux/mkfs.8.en.html
- Manpages parted: https://manpages.debian.org/testing/parted/parted.8.en.html
- Manpages fdisk: https://manpages.debian.org/testing/fdisk/fdisk.8.en.html