Accessing Peripherals

Build with the dev initramfs image

To try out more peripherals, you can use sc-initramfs-image-dev as the initramfs image.

In kas, you can override the initramfs image by creating a file (e.g.: override.local.yml).

header:
  version: 19

local_conf_header:
  initramfs-image-name: |
    INITRAMFS_IMAGE = "sc-initramfs-image-dev"

Then, build the image with the override file.

$ kas build kas/scobc-v1.yml:override.local.yml
...
$ ls -F1 build/tmp/deploy/images/versal-scobc-v1-ve2302i-revb-sdt-full/*.wic
build/tmp/deploy/images/versal-scobc-v1-ve2302i-revb-sdt-full/sc-image-ramroot-versal-scobc-v1-ve2302i-revb-sdt-full-yyyyMMddHHmmss.wic
build/tmp/deploy/images/versal-scobc-v1-ve2302i-revb-sdt-full/sc-image-ramroot-versal-scobc-v1-ve2302i-revb-sdt-full.wic@

Ethernet

You can use ip command to assign an IP address. Once the device is up, you can use any network applications.

# ip addr flush dev end0
# ip addr add 10.30.0.123/24 dev end0
# ip route add default via 10.30.0.1 dev end0
# ip link set dev end0 up

USB

If you have a USB memory, you can mount it like this:

# mount /dev/sda1 /mnt

GPIO

In sc-initramfs-image-dev, you can use the gpiod tools to control GPIOs.

Set GPIO(PMC_MIO12)

# gpioset -c 1 12=1

Clear GPIO(PMC_MIO12)

# gpioset -c 1 12=0

Read GPIO(PMC_MIO12)

# gpioget -c 1 12
active

It also has libgpiod python3 bindings.

eMMC

If Linux detected the eMMC, you can see the device file:

# ls /dev/mmcblk1
/dev/mmcblk1

If you want to make partitions on the eMMC, you can use fdisk:

# fdisk /dev/mmcblk1

The number of cylinders for this disk is set to 1942528.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): n
Partition type
   p   primary partition (1-4)
   e   extended
p
Partition number (1-4): 1
First sector (16-124321791, default 16):
Using default value 16
Last sector or +size{,K,M,G,T} (16-124321791, default 124321791):
Using default value 124321791

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table
[  159.487171]  mmcblk1: p1

If you want to make a filesystem on the partition, you can use mkfs:

# mkfs.vfat /dev/mmcblk1p1

If the device is formatted with a supported filesystem, you can mount and use it.

# mount /dev/mmcblk1p1 /mnt
# df -h | grep mmcblk1
/dev/mmcblk1p1           59.3G     16.0K     59.3G   0% /mnt
# ls /mnt

Power control

Radiation can cause the eMMC, particularly its internal controller, to malfunction or hang. In such cases, turning the eMMC power off and on may help restore operation.

You can control the eMMC power from Linux using the sdhci-arasan driver’s unbind and bind interfaces for the f1050000.mmc controller.

eMMC power control is supported only on Rev.B boards.
Before unbinding the controller, stop all applications and other access to the eMMC, and unmount all filesystems on it. Unbinding while the eMMC is in use can cause data loss or filesystem corruption.

For example, if the eMMC partition is mounted at /mnt as shown above, unmount it before turning the power off:

# umount /mnt

Turn the eMMC power off by unbinding the controller:

# echo f1050000.mmc > /sys/bus/platform/drivers/sdhci-arasan/unbind
[90438.604347] mmc1: card 0001 removed

Turn the eMMC power on again by binding the controller:

# echo f1050000.mmc > /sys/bus/platform/drivers/sdhci-arasan/bind
[90463.084593] mmc1: SDHCI controller on f1050000.mmc [f1050000.mmc] using ADMA 64-bit
[90463.154259] mmc1: new HS200 MMC card at address 0001
[90463.159688] mmcblk1: mmc1:0001 MMC32G 29.1 GiB
[90463.166545]  mmcblk1: p1
[90463.169499] mmcblk1boot0: mmc1:0001 MMC32G 4.00 MiB
[90463.177776] mmcblk1boot1: mmc1:0001 MMC32G 4.00 MiB
[90463.186595] mmcblk1rpmb: mmc1:0001 MMC32G 4.00 MiB, chardev (237:0

After Linux detects the eMMC again, check that its device file is available before mounting the filesystem again:

# ls /dev/mmcblk1
/dev/mmcblk1
# mount /dev/mmcblk1p1 /mnt

microSD card

It’s the same as eMMC. If Linux detectec a SD card, you can see the device file:

# ls /dev/mmcblk0
/dev/mmcblk0
# mount /dev/mmcblk1 /mnt
# ls /mnt

Boot memory / High reliability memory

Under Linux, the boot memory and high reliability memory are MTD devices. If Linux detects the devices, they are displayed as follows:

# ls -1 /dev/mtd*
/dev/mtd0
/dev/mtd0ro
/dev/mtd1
/dev/mtd1ro
/dev/mtdblock0
/dev/mtdblock1

/dev/mtd:
by-name
Memory Board revision Device type Device name Erase before overwrite

Boot memory

Rev.B

MRAM

/dev/mtd0, /dev/mtd0ro, /dev/mtdblock0

No

High reliability memory

Rev.B

MRAM

/dev/mtd1, /dev/mtd1ro, /dev/mtdblock1

No

Boot memory

Rev.A

NOR flash

/dev/mtd0, /dev/mtd0ro, /dev/mtdblock0

Yes

High reliability memory

Rev.A

FRAM

/dev/mtd1, /dev/mtd1ro, /dev/mtdblock1

No

/dev/mtd0 and /dev/mtd1 are character devices, and /dev/mtdblock0 and /dev/mtdblock1 are block devices. Each pair points to the same device. The ro devices are read-only. The character devices are used for reading and writing data, while the block devices are used for formatting and writing data.

Write and read data

# echo "Boot memory" > /dev/mtdblock0
# hexdump -C -n 32 /dev/mtdblock0
00000000  42 6f 6f 74 20 6d 65 6d  6f 72 79 0a ff ff ff ff  |Boot memory.....|
00000010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000020
# echo "High reliability memory" > /dev/mtdblock1
# hexdump -C -n 32 /dev/mtdblock1
00000000  48 69 67 68 20 72 65 6c  69 61 62 69 6c 69 74 79  |High reliability|
00000010  20 6d 65 6d 6f 72 79 0a  ff ff ff ff ff ff ff ff  | memory.........|
00000020

The ff bytes show the unwritten part of the memory in this example.

Erase all sectors

Only the Rev.A boot memory uses NOR flash. It must be erased before changing a bit from 0 to 1. Erase all sectors before fully overwriting the memory. The following command erases all sectors of /dev/mtd0.

# flash_erase /dev/mtd0 0 0

RTC

# hwclock -s
# cat /sys/class/rtc/rtc0/date
2025-11-17
# cat /sys/class/rtc/rtc0/time
12:34:56