UCM-iMX91: Yocto Linux: How-To Guide
Contents
Device Tree
Available Device Tree Files
The current release includes the following dtb files:
| DTB | Hardware Configuration and Features | Jumpers/Connectors Settings |
| ucm-imx91.dtb | default hardware configuration |
Set device tree
The current release provides two methods to switch between dtb files:
- U-Boot environment
The U-boot fdtfile variable contains the device tree name that will be loaded into the RAM. This variable can be changed by:
| Environment | Command |
| U-Boot | setenv fdtfile <fdt_file_name>; saveenv; |
| Linux | fw_setenv fdtfile <fdt_file_name> |
- GRUB environment (if the image was created with the meta-compulab-uefi layer)
| Environment | Command/Procedure |
| GRUB Boot Menu | Goto "Advanced Boot Options" and choose a device tree from the provided dtb list. |
| Linux | grub-editenv /boot/grub/grubenv set fdtfile=<fdt_file_name> |
Serial Console
UCM-iMX91 provides serial console on UART1.
SB-UCMIMX91 evaluation carrier-board exposes the console UART via CP2104 serial-to-USB bridge on connector P16.
Connecting to a host PC
- Use a micro-USB cable to connect the console connector P16 to a USB port on your host PC.
- Make sure the CP2104 driver is available with your operating system, otherwise install CP2104 driver onto the host PC from https://www.silabs.com/documents/public/software/CP210x_Windows_Drivers_with_Serial_Enumeration.zip
- Identify the host PC interface and port number that will be used for communication with the UCM-iMX91 evaluation kit:
- In most Linux PCs, the serial port will be denoted as one of the following (where n is a positive integer): /dev/ttyUSB0, /dev/ttyUSB1 ... /dev/ttyUSBn
- In Windows PCs, the serial port usually will be denoted as one of the following (where n is a positive integer): COM1, COM2 ... COMn
- Start a terminal emulation program (such as PuTTY on Windows or minicom on Linux).
- In the port configuration section of the terminal emulation program select the port identified in previous step and set the following serial port parameters:
Baud Rate Data Bits Stop Bits Parity Flow Control 115200 8 1 none none
USB
UCM-IMX91 features two USB2.0 ports that are derived from the i.MX91 USB sub-system.
On SB-UCMIMX91 evaluation carrier-board USB ports are available on the following connectors:
| USB port# | HW setting | Connector | Mode |
| 1 | P21 is not used | type-A J5 | host |
| 1 | P21 connected to USB host | micro-USB P21 | device |
| 2 | jumper E11 is open | type-A J6 | host |
| 2 | jumper E11 is closed | mini-PCIe P18 | host |
USB #1 in device mode
USB #1 port can be operated in device mode when connected to a host machine using connector P21.
Available gadgets for the UBS #1 in device mode:
| USB gadget | SOM command |
| usb serial device | modprobe g_serial |
| usb network device | modprobe g_ether |
| usb mass storage device | modprobe g_mass_storage file=/dev/sdX |
CAN bus
UCM-iMX91 features two Flexible Controller Area Network (FLEXCAN) modules. SB-UCMIMX91 evaluation carrier-board exposes one CAN bus interface on connector J21.
- Configure both CAN interface bit-rate to 1 Mbit/sec:
ip link set can0 up type can bitrate 1000000
- On one system, dump all received data frames as well as error frames:
candump any,0:0,#FFFFFFFF can0 111 [8] 11 22 33 44 55 66 77 88 can0 11111111 [8] 11 22 33 44 55 66 77 88 ... can0 03FF0983 [8] D7 61 FF 03 C1 F7 C1 34 can0 19C34D32 [8] F7 5A C2 73 AD 0E 3F 0B can0 0675E391 [4] 2B 2D D3 49 can0 13091C55 [8] 99 32 EC 77 27 81 49 0B can0 098D67CF [8] 22 50 AB 48 AD 7F F4 26 can0 05263FEC [5] 1B 4C 02 45 6E can0 12B30E20 [0] can0 1F191DF9 [1] C5 can0 1EB0B18F [8] 3E 3F DA 57 C2 FE 73 58 can0 1E5C64D9 [5] 6F 0D B3 63 6A can0 1E1DE3F9 [8] 96 48 AC 79 4E 00 27 71 can0 0E1A11B7 [8] 75 81 70 7C 86 79 A7 77 can0 05F8FD8B [7] 33 F9 9B 1E 77 3D 1F can0 1E155FCD [8] E6 BA F8 58 ED 6D C8 10 can0 1D91DF9E [8] 5D 29 82 7B 97 1D AB 5C can0 11FB3CDA [3] 14 65 C3 can0 091352C0 [2] 2C ED ...
On second system:
- Send standard CAN frame:
cansend can0 111#1122334455667788
- Send extended CAN frame:
cansend can0 11111111#1122334455667788
- CAN frames (extended mode) generator, random payload, interval between two successive flames 50 msec:
cangen -g 50 -e -D r -v can0 can: raw protocol (rev 20170425) ... can0 03FF0983#D7.61.FF.03.C1.F7.C1.34 can0 19C34D32#F7.5A.C2.73.AD.0E.3F.0B can0 0675E391#2B.2D.D3.49 can0 13091C55#99.32.EC.77.27.81.49.0B can0 098D67CF#22.50.AB.48.AD.7F.F4.26 can0 05263FEC#1B.4C.02.45.6E can0 12B30E20# can0 1F191DF9#C5 can0 1EB0B18F#3E.3F.DA.57.C2.FE.73.58 can0 1E5C64D9#6F.0D.B3.63.6A can0 1E1DE3F9#96.48.AC.79.4E.00.27.71 can0 0E1A11B7#75.81.70.7C.86.79.A7.77 can0 05F8FD8B#33.F9.9B.1E.77.3D.1F can0 1E155FCD#E6.BA.F8.58.ED.6D.C8.10 can0 1D91DF9E#5D.29.82.7B.97.1D.AB.5C can0 11FB3CDA#14.65.C3 can0 091352C0#2C.ED ...
Bluetooth
UCM-iMX91 features Bluetooth connectivity implemented with an NXP 88W8997 module.
| Before working with Bluetooth, please ensure that Bluetooth antenna is connected to the SOM. |
To start bluetoothctl use the following command:
bluetoothctl
To start the scan process use the following commands:
[bluetooth]# default-agent [bluetooth]# power on [bluetooth]# scan on
Bluetooth device should be turned on and visible. Its MAC-adress and name should appear in bluetoothctl in following format:
[CHG] Device AA:BB:CC:DD:EE:FF Name: Device_Name
To pair with the Bluetooth device use the following command:
pair AA:BB:CC:DD:EE:FF
Where AA:BB:CC:DD:EE:FF is MAC-adress of the Bluetooth device.
To quit bluetoothctl use the following command:
[Device_Name]# quit
Cellular Modem
UCM-IMX91 Yocto includes support for Quectel EC25 mini-PCIe cellular modem that can be installed into the evaluation kit.
- Install the modem module into the mini-PCIe socket P18
- Close jumper E11
- Connect a cellular antenna to the main antenna connector on the modem
- Install an active SIM card into SIM socket P20
- Boot to linux
Run the following command to verify that the modem is detected correctly:
root@ucm-imx91:~# lsusb
Bus 001 Device 002: ID 2c7c:0125 Quectel Wireless Solutions Co., Ltd. EC25 LTE modem
root@ucm-imx91:~# mmcli -L
/org/freedesktop/ModemManager1/Modem/0 [QUALCOMM INCORPORATED] QUECTEL Mobile Broadband Module
Obtain <apn> of your sim card company ,e.g. rl.internet
Establish connection:
root@ucm-imx91:~# nmcli connection add type gsm ifname '*' con-name CellularCon apn <apn> root@ucm-imx91:~# nmcli connection NAME UUID TYPE DEVICE CellularCon a1620622-8588-4349-b3fc-66be79fbbede gsm cdc-wdm0
Allow up to a minute to connect to wireless network and make sure modem state is connected:
root@ucm-imx91:~#mmcli -m 0
To test the wireless interface run:
root@ucm-imx91:~#ping -c 5 dns.google -I wwan0
UART
The following table outlines default UART routing when UCM-iMX91 is used with the SB-UCMIMX91 carrier-board:
| UCM-iMX91 port | Linux device | on SB-UCMIMX91 carrier-board |
| UART1 | /dev/ttyLP0 | converted to serial-over-USB debug console, micro-USB connector P16 |
| UART2 | /dev/ttyLP1 | converted to RS232, DB9 connector P17 |
| UART5 | /dev/ttyLP4 | routed to 100-mil header P3 |
| UART7 | /dev/ttyLP6 | converted to RS485, terminal block J22 |
Example: testing UART5
- Short pin P3-1 (UART5-RX) with P3-3 (UART5-TX) on SB-UCMIMX91 to create a loop-back.
- Run the following commands:
stty -F /dev/ttyLP4 1:0:1cb2:0:3:1c:7f:15:4:5:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0 cat /dev/ttyLP4 & echo hello > /dev/ttyLP4
The "hello" string should appear on the terminal.
I2C
The following I2C buses and devices are present when UCM-iMX91 is used with the SB-UCMIMX91 carrier-board:
| Device | I2C bus in Linux | Address | HW port in UCM-iMX91 |
| UCM-iMX91 EEPROM | 0 | 0x50 | I2C1 (internal) |
| UCM-iMX91 RTC | 0 | 0x69 | I2C1 (internal) |
| UCM-iMX91 PMIC | 1 | 0x25 | I2C2 (internal) |
| GPIO extender on SB-UCMIMX91 for on-board control signals | 2 | 0x20 | I2C3 |
| Camera module control on SB-UCMIMX91 connector P9 | 2 | 0x42 | I2C3 |
| SB-UCMIMX91 EEPROM | 2 | 0x54 | I2C3 |
| Touch-screen controller of MIPI-DSI or LVDS panel on SB-UCMIMX91 connector P8 or P12 | 2 | 0x5d | I2C3 |
To list all mapped devices:
# ls /proc/device-tree/soc@0/bus@*/i2c@*/*@* -d -w 1 /proc/device-tree/soc@0/bus@42000000/i2c@42530000/goodix@5d /proc/device-tree/soc@0/bus@42000000/i2c@42530000/mipi2@42 /proc/device-tree/soc@0/bus@42000000/i2c@42530000/pca9555@20 /proc/device-tree/soc@0/bus@44000000/i2c@44340000/rtc@69 /proc/device-tree/soc@0/bus@44000000/i2c@44350000/pmic@25
Note how:
- each node is appended with its address.
- I2C buses order corresponds to the order of their addresses.
e.g. to inspect bus 0, in which we have RTC, run:
# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 51 52 53 -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- UU -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
In the above output numbers mark unused devices, UU marks a device that is used by a driver.
Indeed we see RTC in use at offset 0x69.
An example how to dump EEPROM contents:
hexdump -C /sys/devices/platform/soc@0/44000000.bus/44340000.i2c/i2c-0/0-0050/eeprom
SPI
Loopback example:
In order to enable SPI device, it needs to be added to the device tree in the following manner:
Set up the kernel source repository by following the instructions in this guide: https://github.com/compulab-yokneam/meta-bsp-imx9/blob/mickledore-6.1.55-2.0/Documentation/linux_kernel_build.md
However, stop before the final command that builds the kernel.
Instead of building the full kernel, run:
make dtbs
Locate the compiled device tree:
arch/arm64/boot/dts/compulab/ucm-imx91-lpspi.dtb
On the UCM-IMX91, identify your boot partition by running:
lsblk
Then, copy the .dtb file to that partition.
Restart your device and interrupt the boot process to access U-Boot. Then run:
setenv fdtfile ucm-imx91-lpspi.dtb; boot
SPI signals location:
ECSPI3_MOSI - P3.14 ECSPI3_SCLK - P3.16 ECSPI3_MISO/UART7_RX - U25 pin 1 (beside RS485) ECSPI3_SSO/UART7_TX - U25 pin 4 (beside RS485)
Use jumper cable to connect MOSI and MISO.
On the module, run:
spidev_test -v -D /dev/spidev0.0 -p "hello"
You should see RX same as TX.
GPIO
The following table outlines default GPIO assignments when UCM-iMX91 is used with the SB-UCMIMX91 carrier-board:
| Signal Name | Pin on SB-UCMIMX91 |
| GPIO_IO04 | P3-20 |
| GPIO_IO05 | P3-18 |
| GPIO_IO07 | P3-6 |
| GPIO_IO14 | P5-4 |
| GPIO_IO15 | P5-2 |
| GPIO_IO16 | P3-4 |
Other signals that are reserved for peripheral controls can be reassigned to GPIOs in
arch/arm64/boot/dts/compulab/ucm-imx91-pinctrl.dtsi
Example: controlling pin GPIO_IO16
Checking the pin info
gpioinfo -c 0
This lists all GPIO lines in `gpiochip0`, including GPIO_IO16 (line offset 16).
Writing to a pin
Set to high:
gpioset -c 0 --toggle 0 16=1
Set to low:
gpioset -c 0 --toggle 0 16=0
Reading the logical level from a pin
gpioget -c 0 16
ADC
i.MX91 SoC features integrated 12 bit analog to digital converter.
To use the ADC, enable it in device tree e.g. in arch/arm64/boot/dts/compulab/sbc-mcm-imx91.dts:
&adc1 {
vref-supply = <®_vref_1v8>;
status = "okay";
};
Sysfs device controls will appear in:
cd /sys/bus/iio/devices/iio\:device0/
SB-UCMIMX91 exposes ADC signals on 100-mil header P3.
| Signal Name | pin on P3 | sysfs file |
| ADC_IN0 | 9 | in_voltage0_raw |
| ADC_IN1 | 11 | in_voltage1_raw |
| ADC_IN2 | 13 | in_voltage2_raw |
| ADC_IN3 | 15 | in_voltage3_raw |
For example, to read voltage from P3-9 run:
cat /sys/bus/iio/devices/iio\:device0/in_voltage0_raw
Expected output is a value in range 0 - 4095 which spans over the voltage range 0 - 1.8V
Suspend / Resume
| The operation below requires root access. |
- Suspend mode allows minimizing the power consumption.
- To enter suspend mode run:
echo mem >/sys/power/state
- To resume normal operation press shortly the power button SW5.
- To enter suspend mode with RTC as wakeup source that wakes after 5 seconds run:
rtcwake -s 5 -m mem -d /dev/rtc0
- WiFi device currently doesn't support suspension. see UCM-iMX91:_Yocto_Linux:_Known_Issues
CPU temperature
i.MX91 SoC features an internal temperature sensor which allows to measure the SoC temperature. Execute the following command to read the current CPU temperature:
cat /sys/class/thermal/thermal_zone0/temp
RTC
UCM-iMX91 features two RTC devices:
- i.MX91 internal RTC (rtc0) - can be used as wake-up source
- AB1805 external RTC (rtc1) - can be used for low current battery powered time keeping
Internal RTC - rtc0
System information:
udevadm info -p /sys/class/rtc/rtc0 P: /devices/platform/soc@0/44000000.bus/44440000.bbnsm/44440000.bbnsm:rtc/rtc/rtc0 N: rtc0 L: -100 S: rtc E: DEVPATH=/devices/platform/soc@0/44000000.bus/44440000.bbnsm/44440000.bbnsm:rtc/rtc/rtc0 E: DEVNAME=/dev/rtc0 E: MAJOR=251 E: MINOR=0 E: SUBSYSTEM=rtc E: USEC_INITIALIZED=14959708 E: DEVLINKS=/dev/rtc
Wake up:
rtc0 can be used as a wake up source, as a result an rtcwakeup can be used with this device:
rtcwake --device /dev/rtc0 -s 5 -m mem
External RTC - rtc1
System information:
udevadm info -p /sys/class/rtc/rtc1 N: rtc1 L: 0 E: DEVPATH=/devices/platform/soc@0/44000000.bus/44340000.i2c/i2c-0/0-0069/rtc/rtc1 E: DEVNAME=/dev/rtc1 E: MAJOR=251 E: MINOR=1 E: SUBSYSTEM=rtc
Set the date and write it into the RTC:
date -s "16 Jun 2023 12:00:00" Fri 16 Jun 2023 12:00:00 hwclock --systohc --rtc /dev/rtc1
Read the RTC time and date:
hwclock --show --rtc /dev/rtc1 2023-06-16 12:01:37.915876+00:00
Device Serial Number
Product information is stored in on-board EEPROM.
- To read the product serial number run:
cat /proc/device-tree/product-sn && echo
- To read the product configuration part number run:
cat /proc/device-tree/product-options && echo