UCM-iMX93: 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-imx93.dtb | default hardware configuration + mipi dsi display | P11/P12 mipi iface/touch is in use |
ucm-imx93-lvds.dtb | default hardware configuration + lvds display | P7/P8 lvds iface/touch is in use |
ucm-imx93-headless.dtb | default hardware configuration w/out any display |
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-iMX93 provides serial console on UART1.
SB-UCMIMX93 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-iMX93 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
Display
MIPI-DSI
The UCM-iMX93 evaluation kit includes the Startec KD050HDFIA 5" MIPI-DSI LCD panel.
Connect the MIPI-DSI display to connectors P11 and P12 on the SB-UCMIMX93 carrier-board.
The MIPI-DSI display is described in the following device tree include file (included in the default ucm-imx93.dtb device tree): arch/arm64/boot/dts/compulab/ucm-imx93-mipi.dtsi The Linux device node for the MIPI-DSI display:
/sys/class/drm/card0/card0-DSI-1/
This device node contains information about the display, such as its supported modes and its current configuration.
LVDS
SB-UCMIMX93 supports direct connection with the Startec KD070HDTLA020 7" LVDS LCD panel. Connect the display data cable to connector P7. Connect the display touch-panel cable to connector P8.
LVDS display requires the following device tree: ucm-imx93-lvds.dts.
The Linux device node for the display is described in: arch/arm64/boot/dts/compulab/ucm-imx93-lvds.dtsi.
Display Manager
UCM-iMX93 Yocto uses Weston as the default display manager. It can be configured in /etc/xdg/weston/weston.ini.
For example the transform setting can be set to rotate-90, rotate-180, rotate-270, or commented out.
In order to apply the configuration, you need to restart the weston display manager:
systemctl stop weston systemctl start weston
Camera
The UCM-iMX93 evaluation kit supports the e-con e-CAM131_CURB 13MP 4K camera module.
Connect the camera to connector P9 on the SB-UCMIMX93 carrier-board.
The following device tree file should be used for camera operation: ucm-imx93-mipi-csi.dtb
Verify that the mxc-isi-cap driver is registered correctly:
root@ucm-imx93:~# v4l2-ctl --list-devices mxc-isi-cap (platform:4ae40000.isi:cap_devic): /dev/video0 FSL Capture Media Device (platform:mxc-md): /dev/media0
The camera device tree nodes are described in: arch/arm64/boot/dts/compulab/ucm-imx93.dtsi.
The Linux video device node used for capturing: /dev/video0
Video Capturing
Single image capturing:
gst-launch-1.0 v4l2src num-buffers=1 ! jpegenc ! filesink location=single_buffer.jpg
Output to wayland surface:
gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1280,height=720,format=BGRA' ! textoverlay text="CLAB UCM-iMX93" ! waylandsink window-width=1280 window-height=720
To find a pipe element run:
gst-inspect-1.0 | grep sink -i
Detailed information on a specific pipe element:
gst-inspect-1.0 <name>
To learn more please refer to:
https://linuxtv.org/wiki/index.php/V4L_capturing
https://en.wikipedia.org/wiki/GStreamer
USB
UCM-IMX93 features two USB2.0 ports that are derived from the i.MX93 USB sub-system.
On SB-UCMIMX93 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-iMX93 features two Flexible Controller Area Network (FLEXCAN) modules. SB-UCMIMX93 evaluation carrier-board exposes one CAN bus interface on connector J21.
CAN interface configuration
It is recommended configure the CAN interface, with the iproute2 utilities.
- To make sure the right ip utility is used, run:
ip -V ip utility, iproute2-v5.7.0-77-gb687d1067169
- Configure both CAN interface bit-rate to 1 Mbit/sec:
ip link set can0 type can bitrate 1000000
- Enable the CAN interface:
ip link set can0 up
Send/Receive packets
Use cansend and candump utilities to send and receive packets via CAN interface.
- Send standard CAN frame (on the first device):
cansend can0 111#1122334455667788
- Send extended CAN frame (on the first device):
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 1F193DF9#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 ...
- Dump all received data frames as well as error frames (on the second device):
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 1F193DF9 [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 ...
WiFi
UCM-iMX93 features 802.11ac wireless connectivity solution implemented with an NXP 88W8997 module.
The NetworkManager can be used to manage WiFi interface.
Before working with WiFi, please ensure that WiFi antenna is connected to the SOM. |
Enable/Disable WiFi Interface
- To enable WiFi interface:
nmcli radio wifi on
- To disable WiFi interface:
nmcli radio wifi off
Network Scanning
- Sample WiFi scanning:
nmcli dev wifi list
- The output will show the list of Access Points and Ad-Hoc cells in range.
Connecting to Access Point
In the following example:
- Replace <SSID> and <PASSWORD> with the actual access point parameters:
nmcli device wifi connect <SSID> password <PASSWORD> name WifiCon
- Disconnect wireless network:
nmcli connection down WifiCon
- Connect wireless network again:
nmcli connection up WifiCon
Creating Access Point
In the following example:
- Replace <SSID> and <PASSWORD> with desired access point parameters:
nmcli device wifi hotspot ssid <SSID> password <PASSWORD> con-name HotspotCon
- Disable wireless AP:
nmcli connection down HotspotCon
- Enable wireless AP again:
nmcli connection up HotspotCon
Bluetooth
UCM-iMX93 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
UART
The following table outlines default UART routing when UCM-iMX93 is used with the SB-UCMIMX93 carrier-board:
UCM-iMX93 port | Linux device | on SB-UCMIMX93 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-UCMIMX93 to create a loop-back.
- Run the following commands:
# stty -F /dev/ttyLP4 115200 # 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-iMX93 is used with the SB-UCMIMX93 carrier-board:
Device | I2C bus in Linux | Address | HW port in UCM-iMX93 |
UCM-iMX93 EEPROM | 0 | 0x50 | I2C1 (internal) |
UCM-iMX93 RTC | 0 | 0x69 | I2C1 (internal) |
UCM-iMX93 PMIC | 1 | 0x25 | I2C2 (internal) |
GPIO extender on SB-UCMIMX93 for on-board control signals | 2 | 0x20 | I2C3 |
Camera module control on SB-UCMIMX93 connector P9 | 2 | 0x42 | I2C3 |
SB-UCMIMX93 EEPROM | 2 | 0x54 | I2C3 |
Touch-screen controller of MIPI-DSI or LVDS panel on SB-UCMIMX93 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
The following command displays listing of all of SPI devices in the system:
root@ucm-imx93:~# find /proc/device-tree/ -name *spi*|grep soc /proc/device-tree/soc@0/bus@44000000/spi@44370000 /proc/device-tree/soc@0/bus@44000000/spi@44360000 /proc/device-tree/soc@0/bus@42000000/spi@42560000 /proc/device-tree/soc@0/bus@42000000/spi@42700000 /proc/device-tree/soc@0/bus@42000000/spi@425e0000 /proc/device-tree/soc@0/bus@42000000/spi@426f0000 /proc/device-tree/soc@0/bus@42000000/spi@42710000 /proc/device-tree/soc@0/bus@42000000/spi@42720000 /proc/device-tree/soc@0/bus@42000000/spi@42550000
GPIO
The following table outlines default GPIO assignments when UCM-iMX93 is used with the SB-UCMIMX93 carrier-board:
Signal Name | On SB-UCMIMX93 | GPIO # in Linux |
GPIO_IO04 | P3-20 | 32+4 |
GPIO_IO05 | P3-18 | 32+18 |
GPIO_IO07 | P3-6 | 32+7 |
GPIO_IO14 | P5-4 | 32+14 |
GPIO_IO15 | P5-2 | 32+15 |
GPIO_IO16 | P3-4 | 32+16 |
These GPIOs belong to gpiochip0 which numbering space starts at 32. Therefore it is required to add 32 to the GPIO number.
Other signals that are reserved for peripheral controls can be reassigned to function as GPIOs in arch/arm64/boot/dts/compulab/ucm-imx93-pinctrl.dtsi.
Example: controlling pin GPIO_IO16
Exporting the pin in sysfs
Create a file system export entry:
cd /sys/class/gpio/ echo $((32+16)) > export
Now pin GPIO_IO16 is assigned to sysfs. You can view the newly created entry in line 16 by running:
gpioinfo 0
Writing to a pin
Go to GPIO_IO16 sysfs folder:
cd /sys/class/gpio/gpio$((32+16))
Set pin direction to output:
echo out > direction
Set pin value to high or low:
echo 1 > value echo 0 > value
Reading from a pin
Go to GPIO_IO16 sysfs folder:
cd /sys/class/gpio/gpio$((32+16))
Set pin direction to input:
echo in > direction
Read the value of the pin from the value file:
cat value
Suspend / Resume
The operation below requires root access. |
UCM-iMX93 features suspend mode, which allows to minimize power consumption.
The following command should be used to enter suspend mode:
echo mem >/sys/power/state
To resume normal operation press shortly the ON/OFF button SW5.
CPU temperature
i.MX93 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-iMX93 features two RTC devices:
- i.MX93 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.935876+00:00