UCM-iMX93: Yocto Linux: How-To Guide

From Compulab Mediawiki
Revision as of 11:50, 19 June 2023 by Benjamin (talk | contribs) (Created page with "=Device Tree= == Available Device Tree Files == The current release includes the following '''dtb''' files: {| class="wikitable" style="text-align:left;" |- | align="center" |...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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>


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

Controller–area network (CAN)

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.

Admolition note.png 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 solution implemented with an NXP 88W8997 module.


Admolition note.png 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


Suspend / Resume

Admolition note.png 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 Power On 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

See Also