Difference between revisions of "CL-SOM-iMX8Plus: Yocto Linux: How-To Guide"

From Compulab Mediawiki
Jump to: navigation, search
Line 66: Line 66:
 
|-
 
|-
 
|}
 
|}
 +
 +
=Controller–area network (CAN)=
 +
CL-SOM-iMX8Plus features two Flexible Controller Area Network (FLEXCAN) modules.
 +
The FlexCAN module is a full implementation of the CAN protocol specification, the
 +
CAN with Flexible Data rate (CAN FD) protocol, and the CAN 2.0 version B protocol,
 +
which supports both standard and extended message frames and long payloads up to 64
 +
bytes, transferred at faster rates (up to 8 Mb/s).
 +
 +
==CAN interface configuration==
 +
It is recommended configure the CAN interface, with the {{filename|iproute2}} utilities.
 +
 +
* To make sure the right '''ip''' utility is used, run:
 +
<pre>
 +
ip -V
 +
ip utility, iproute2-v5.7.0-77-gb687d1067169
 +
</pre>
 +
* Configure both CAN interface bit-rate to 1 Mbit/sec:
 +
<pre>
 +
ip link set can0 type can bitrate 1000000
 +
ip link set can1 type can bitrate 1000000
 +
</pre>
 +
* Enable the CAN interface:
 +
<pre>
 +
ip link set can0 up
 +
ip link set can1 up
 +
</pre>
 +
 +
==Send/Receive packets==
 +
Use {{filename|cansend}} and {{filename|candump}} utilities to send and receive packets via CAN interface.
 +
 +
* Send standard CAN frame (on the first device):
 +
<pre>
 +
cansend can0 111#1122334455667788
 +
</pre>
 +
 +
* Send extended CAN frame (on the first device):
 +
<pre>
 +
cansend can0 11111111#1122334455667788
 +
</pre>
 +
 +
* CAN frames (extended mode) generator, random payload, interval between two successive flames 50 msec:
 +
<pre>
 +
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
 +
...
 +
</pre>
 +
 +
* Dump all received data frames as well as error frames (on the second device):
 +
<pre>
 +
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
 +
...
 +
</pre>
 +
 +
= WiFi =
 +
 +
CL-SOM-iMX8Plus features 802.11ac wireless connectivity solution implemented with an NXP 88W8997 module.
 +
 +
== WiFi Initialization ==
 +
WiFi requires no user interaction for being configured.
 +
* The driver gets loaded automatically.<br>Use this command to show the loaded drivers:
 +
'''lsmod | grep mwifiex'''
 +
<pre>
 +
mwifiex_sdio          40960  0
 +
mwifiex              274432  1 mwifiex_sdio
 +
</pre>
 +
* The WiFi driver can be loaded manually:
 +
'''modprobe mwifiex'''
 +
'''modprobe mwifiex_sdio'''
 +
<pre>
 +
              mwifiex_sdio mmc0:0001:1: info: FW download over, size 623240 bytes
 +
              mwifiex_sdio mmc0:0001:1: WLAN FW is active
 +
              mwifiex_sdio mmc0:0001:1: info: MWIFIEX VERSION: mwifiex 1.0 (16.68.1.p197)
 +
              mwifiex_sdio mmc0:0001:1: driver_version = mwifiex 1.0 (16.68.1.p197)
 +
</pre>
 +
* Browse the WiFi module configuration:
 +
'''iwconfig mlan0'''
 +
<pre>
 +
mlan0    IEEE 802.11  ESSID:off/any 
 +
          Mode:Managed  Access Point: Not-Associated  Tx-Power=0 dBm 
 +
          Retry short limit:9  RTS thr=2347 B  Fragment thr=2346 B 
 +
          Encryption key:off
 +
          Power Management:on
 +
</pre>
 +
* Activate the interface:
 +
'''ifconfig mlan0 up'''
 +
* Sample WiFi scanning:
 +
'''iw mlan0 scan'''
 +
The output will show the list of Access Points and Ad-Hoc cells in range.
 +
For more information about connecting to wireless networks and tuning WiFi interfaces refer to “wpa_supplicant” and “wireless-tools” man pages.
 +
 +
== wpa_supplicant ==
 +
* Create a {{cmd|wpa_supplicant}} configuration file:
 +
<pre>
 +
cat << eof > /etc/wpa_supplicant.conf
 +
ctrl_interface=/var/run/wpa_supplicant
 +
update_config=1
 +
eof
 +
</pre>
 +
* Issue {{cmd|wpa_supplicant}}:
 +
'''ifconfig mlan0 up'''
 +
'''wpa_supplicant -B -Dnl80211 -c /etc/wpa_supplicant.conf -i mlan0'''
 +
* Configuring WiFi connection with {{cmd|wpa_cli}}:
 +
'''wpa_cli'''
 +
<pre>
 +
Selected interface 'mlan0'
 +
 +
Interactive mode
 +
 +
> scan
 +
> scan_results
 +
bssid / frequency / signal level / flags / ssid
 +
b8:08:cf:a0:7e:f4      5240    -83    [WPA2-PSK-CCMP][ESS]    MYSSID
 +
> add_network
 +
0
 +
> set_network 0 ssid "MYSSID"
 +
> set_network 0 psk "passphrase"
 +
> enable_network 0
 +
> save_config
 +
> quit
 +
</pre>
 +
* Browse the '''''/etc/wpa_supplicant.conf''''':
 +
'''cat /etc/wpa_supplicant.conf'''
 +
<pre>
 +
ctrl_interface=/var/run/wpa_supplicant
 +
update_config=1
 +
 +
network={
 +
        ssid="MYSSID"
 +
        psk="passphrase"
 +
}
 +
</pre>
 +
* Get an ip-address:
 +
'''udhcpc -i mlan0'''
 +
<pre>
 +
udhcpc: started, v1.33.1
 +
udhcpc: sending discover
 +
udhcpc: sending select for 172.16.11.28
 +
udhcpc: lease of 172.16.11.28 obtained, lease time 7181
 +
/etc/udhcpc.d/50default: Adding DNS 172.16.11.1
 +
</pre>
 +
* Get the connection status:
 +
'''wpa_cli status'''
 +
<pre>
 +
Selected interface 'mlan0'
 +
bssid=b8:08:cf:a0:7e:f4
 +
freq=5240
 +
ssid=MYSSID
 +
id=0
 +
mode=station
 +
pairwise_cipher=CCMP
 +
group_cipher=CCMP
 +
key_mgmt=WPA2-PSK
 +
wpa_state=COMPLETED
 +
ip_address=172.16.11.28
 +
p2p_device_address=ec:2e:98:d1:03:f7
 +
address=ec:2e:98:d1:03:f7
 +
uuid=3cb04c02-017b-5df7-af29-69f15c7449ed
 +
</pre>
  
 
=Gstreamer=
 
=Gstreamer=
Line 126: Line 324:
 
{{note|The operation below requires '''root''' access.}}
 
{{note|The operation below requires '''root''' access.}}
  
SOM-iMX8M-Plus features 1080p60 H.264, VP8 video decoding capabilities. Before starting video playback, please, ensure that the display is connected to the board.
+
CL-SOM-iMX8Plus features 1080p60 H.264, VP8 video decoding capabilities. Before starting video playback, please, ensure that the display is connected to the board.
  
 
The following commands can be used to start video playback ('''1.mov''' is a media file):
 
The following commands can be used to start video playback ('''1.mov''' is a media file):
Line 177: Line 375:
 
</pre>
 
</pre>
  
For hardware setup and camera connection instructions please refer to SOM-iMX8M-Plus Hardware Guide.
+
For hardware setup and camera connection instructions please refer to CL-SOM-iMX8Plus Hardware Guide.
  
 
===Examples===
 
===Examples===
Line 185: Line 383:
 
Write stream to a file. In this example the encoded output gets saved in the '''1.mov''' media file.
 
Write stream to a file. In this example the encoded output gets saved in the '''1.mov''' media file.
 
<pre>
 
<pre>
gst-launch-1.0 -v v4l2src ! vpuenc_h264 ! filesink location=1.mov
+
gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1280,height=720,format=NV12' ! vpuenc_h264 ! filesink location=/path/to/1.mov
 
</pre>
 
</pre>
  
Line 206: Line 404:
 
==Video streaming==
 
==Video streaming==
 
{{note|The operation below requires '''root''' access.}}
 
{{note|The operation below requires '''root''' access.}}
The following command should be executed on SOM-iMX8M-Plus to start video streaming:
+
The following command should be executed on CL-SOM-iMX8Plus to start video streaming:
 
  gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw, width=640, height=480 ! jpegenc ! udpsink host='''127.0.0.1''' port='''1234'''
 
  gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw, width=640, height=480 ! jpegenc ! udpsink host='''127.0.0.1''' port='''1234'''
 
'''127.0.0.1''' is the IP address of the host PC, and '''1234''' is the host PC port.
 
'''127.0.0.1''' is the IP address of the host PC, and '''1234''' is the host PC port.
Line 217: Line 415:
 
{{note|The operation below requires '''root''' access.}}
 
{{note|The operation below requires '''root''' access.}}
  
SOM-iMX8M-Plus features suspend mode, which allows to minimize power consumption.  
+
CL-SOM-iMX8Plus features suspend mode, which allows to minimize power consumption.  
  
 
The following command should be used to enter suspend mode:
 
The following command should be used to enter suspend mode:
Line 357: Line 555:
 
</pre>
 
</pre>
  
=Controller–area network (CAN)=
 
SOM-iMX8M-PLUS features two Flexible Controller Area Network (FLEXCAN) modules.
 
The FlexCAN module is a full implementation of the CAN protocol specification, the
 
CAN with Flexible Data rate (CAN FD) protocol, and the CAN 2.0 version B protocol,
 
which supports both standard and extended message frames and long payloads up to 64
 
bytes, transferred at faster rates (up to 8 Mb/s).
 
 
==CAN interface configuration==
 
It is recommended configure the CAN interface, with the {{filename|iproute2}} utilities.
 
  
* To make sure the right '''ip''' utility is used, run:
+
= Device Serial Number and Configuration =
 +
Product information is stored in on-board EEPROM.<br>
 +
* To read the product serial number, issue the folowing command:
 
<pre>
 
<pre>
ip -V
+
compulab@som-imx8plus:~$ cat /proc/device-tree/product-sn
ip utility, iproute2-v5.7.0-77-gb687d1067169
 
</pre>
 
* Configure both CAN interface bit-rate to 1 Mbit/sec:
 
<pre>
 
ip link set can0 type can bitrate 1000000
 
ip link set can1 type can bitrate 1000000
 
 
</pre>
 
</pre>
* Enable the CAN interface:
+
* To read the product configuration part number, issue the following command:
 
<pre>
 
<pre>
ip link set can0 up
+
compulab@som-imx8plus:~$ cat /proc/device-tree/product-options
ip link set can1 up
 
 
</pre>
 
</pre>
  
==Send/Receive packets==
 
Use {{filename|cansend}} and {{filename|candump}} utilities to send and receive packets via CAN interface.
 
 
* Send standard CAN frame (on the first device):
 
<pre>
 
cansend can0 111#1122334455667788
 
</pre>
 
 
* Send extended CAN frame (on the first device):
 
<pre>
 
cansend can0 11111111#1122334455667788
 
</pre>
 
 
* CAN frames (extended mode) generator, random payload, interval between two successive flames 50 msec:
 
<pre>
 
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
 
...
 
</pre>
 
 
* Dump all received data frames as well as error frames (on the second device):
 
<pre>
 
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
 
...
 
</pre>
 
 
= WiFi =
 
 
CL-SOM-iMX8Plus features 802.11ac wireless connectivity solution implemented with an NXP 88W8997 module.
 
 
== WiFi Initialization ==
 
WiFi requires no user interaction for being configured.
 
* The driver gets loaded automatically.<br>Use this command to show the loaded drivers:
 
'''lsmod | grep mwifiex'''
 
<pre>
 
mwifiex_sdio          40960  0
 
mwifiex              274432  1 mwifiex_sdio
 
</pre>
 
* The WiFi driver can be loaded manually:
 
'''modprobe mwifiex'''
 
'''modprobe mwifiex_sdio'''
 
<pre>
 
              mwifiex_sdio mmc0:0001:1: info: FW download over, size 623240 bytes
 
              mwifiex_sdio mmc0:0001:1: WLAN FW is active
 
              mwifiex_sdio mmc0:0001:1: info: MWIFIEX VERSION: mwifiex 1.0 (16.68.1.p197)
 
              mwifiex_sdio mmc0:0001:1: driver_version = mwifiex 1.0 (16.68.1.p197)
 
</pre>
 
* Browse the WiFi module configuration:
 
'''iwconfig mlan0'''
 
<pre>
 
mlan0    IEEE 802.11  ESSID:off/any 
 
          Mode:Managed  Access Point: Not-Associated  Tx-Power=0 dBm 
 
          Retry short limit:9  RTS thr=2347 B  Fragment thr=2346 B 
 
          Encryption key:off
 
          Power Management:on
 
</pre>
 
* Activate the interface:
 
'''ifconfig mlan0 up'''
 
* Sample WiFi scanning:
 
'''iw mlan0 scan'''
 
The output will show the list of Access Points and Ad-Hoc cells in range.
 
For more information about connecting to wireless networks and tuning WiFi interfaces refer to “wpa_supplicant” and “wireless-tools” man pages.
 
 
== wpa_supplicant ==
 
* Create a {{cmd|wpa_supplicant}} configuration file:
 
<pre>
 
cat << eof > /etc/wpa_supplicant.conf
 
ctrl_interface=/var/run/wpa_supplicant
 
update_config=1
 
eof
 
</pre>
 
* Issue {{cmd|wpa_supplicant}}:
 
'''ifconfig mlan0 up'''
 
'''wpa_supplicant -B -Dnl80211 -c /etc/wpa_supplicant.conf -i mlan0'''
 
* Configuring WiFi connection with {{cmd|wpa_cli}}:
 
'''wpa_cli'''
 
<pre>
 
Selected interface 'mlan0'
 
 
Interactive mode
 
 
> scan
 
> scan_results
 
bssid / frequency / signal level / flags / ssid
 
b8:08:cf:a0:7e:f4      5240    -83    [WPA2-PSK-CCMP][ESS]    MYSSID
 
> add_network
 
0
 
> set_network 0 ssid "MYSSID"
 
> set_network 0 psk "passphrase"
 
> enable_network 0
 
> save_config
 
> quit
 
</pre>
 
* Browse the '''''/etc/wpa_supplicant.conf''''':
 
'''cat /etc/wpa_supplicant.conf'''
 
<pre>
 
ctrl_interface=/var/run/wpa_supplicant
 
update_config=1
 
 
network={
 
        ssid="MYSSID"
 
        psk="passphrase"
 
}
 
</pre>
 
* Get an ip-address:
 
'''udhcpc -i mlan0'''
 
<pre>
 
udhcpc: started, v1.33.1
 
udhcpc: sending discover
 
udhcpc: sending select for 172.16.11.28
 
udhcpc: lease of 172.16.11.28 obtained, lease time 7181
 
/etc/udhcpc.d/50default: Adding DNS 172.16.11.1
 
</pre>
 
* Get the connection status:
 
'''wpa_cli status'''
 
<pre>
 
Selected interface 'mlan0'
 
bssid=b8:08:cf:a0:7e:f4
 
freq=5240
 
ssid=MYSSID
 
id=0
 
mode=station
 
pairwise_cipher=CCMP
 
group_cipher=CCMP
 
key_mgmt=WPA2-PSK
 
wpa_state=COMPLETED
 
ip_address=172.16.11.28
 
p2p_device_address=ec:2e:98:d1:03:f7
 
address=ec:2e:98:d1:03:f7
 
uuid=3cb04c02-017b-5df7-af29-69f15c7449ed
 
</pre>
 
  
 
=See Also=
 
=See Also=

Revision as of 09:23, 28 December 2022

Device Tree

The current release come with these dtb files:

DTB HW Feature Jumpers'/Interface Settings
som-imx8m-plus.dtb default hardware configuration; mipi dsi, lvds and hdmi enabled
som-imx8m-plus_mipi-csi1.dtb default hardware configuration + mipi csi1 enabled + ar1335_af sensor on the P48; E18 is on
som-imx8m-plus_mipi-csi2.dtb default hardware configuration + mipi csi2 enabled + ar1335_af sensor on the P47; E23 is on
som-imx8m-plus-usbdev.dtb default hardware configuration + USB1 as a peripheral; J5 is in use
som-imx8m-plus-hdmi.dtb default hardware configuration w/out lvds and mipi dsi; hdmi display only; P14 is in use
som-imx8m-plus-lvds.dtb default hardware configuration w/out hdmi and mipi dsi; lvds display only; P11/P5 lvds iface/touch is in use
som-imx8m-plus-mipi.dtb default hardware configuration w/out hdmi and lvds; mipi dsi display only; P22/P45 mipi iface/touch is in use

Set a 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 cl_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/EFI/BOOT/grubenv set fdtfile=<fdt_file_name>

Controller–area network (CAN)

CL-SOM-iMX8Plus features two Flexible Controller Area Network (FLEXCAN) modules. The FlexCAN module is a full implementation of the CAN protocol specification, the CAN with Flexible Data rate (CAN FD) protocol, and the CAN 2.0 version B protocol, which supports both standard and extended message frames and long payloads up to 64 bytes, transferred at faster rates (up to 8 Mb/s).

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
ip link set can1 type can bitrate 1000000
  • Enable the CAN interface:
ip link set can0 up
ip link set can1 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

CL-SOM-iMX8Plus features 802.11ac wireless connectivity solution implemented with an NXP 88W8997 module.

WiFi Initialization

WiFi requires no user interaction for being configured.

  • The driver gets loaded automatically.
    Use this command to show the loaded drivers:
lsmod | grep mwifiex
mwifiex_sdio           40960  0
mwifiex               274432  1 mwifiex_sdio
  • The WiFi driver can be loaded manually:
modprobe mwifiex
modprobe mwifiex_sdio
               mwifiex_sdio mmc0:0001:1: info: FW download over, size 623240 bytes
               mwifiex_sdio mmc0:0001:1: WLAN FW is active
               mwifiex_sdio mmc0:0001:1: info: MWIFIEX VERSION: mwifiex 1.0 (16.68.1.p197) 
               mwifiex_sdio mmc0:0001:1: driver_version = mwifiex 1.0 (16.68.1.p197) 
  • Browse the WiFi module configuration:
iwconfig mlan0
mlan0     IEEE 802.11  ESSID:off/any  
          Mode:Managed  Access Point: Not-Associated   Tx-Power=0 dBm   
          Retry short limit:9   RTS thr=2347 B   Fragment thr=2346 B   
          Encryption key:off
          Power Management:on
  • Activate the interface:
ifconfig mlan0 up
  • Sample WiFi scanning:
iw mlan0 scan

The output will show the list of Access Points and Ad-Hoc cells in range. For more information about connecting to wireless networks and tuning WiFi interfaces refer to “wpa_supplicant” and “wireless-tools” man pages.

wpa_supplicant

  • Create a wpa_supplicant configuration file:
cat << eof > /etc/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
update_config=1
eof
  • Issue wpa_supplicant:
ifconfig mlan0 up
wpa_supplicant -B -Dnl80211 -c /etc/wpa_supplicant.conf -i mlan0
  • Configuring WiFi connection with wpa_cli:
wpa_cli
Selected interface 'mlan0'

Interactive mode

> scan
> scan_results 
bssid / frequency / signal level / flags / ssid
b8:08:cf:a0:7e:f4       5240    -83     [WPA2-PSK-CCMP][ESS]    MYSSID
> add_network
0
> set_network 0 ssid "MYSSID"
> set_network 0 psk "passphrase"
> enable_network 0
> save_config
> quit
  • Browse the /etc/wpa_supplicant.conf:
cat /etc/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
update_config=1

network={
        ssid="MYSSID"
        psk="passphrase"
}
  • Get an ip-address:
udhcpc -i mlan0
udhcpc: started, v1.33.1
udhcpc: sending discover
udhcpc: sending select for 172.16.11.28
udhcpc: lease of 172.16.11.28 obtained, lease time 7181
/etc/udhcpc.d/50default: Adding DNS 172.16.11.1
  • Get the connection status:
wpa_cli status
Selected interface 'mlan0'
bssid=b8:08:cf:a0:7e:f4
freq=5240
ssid=MYSSID
id=0
mode=station
pairwise_cipher=CCMP
group_cipher=CCMP
key_mgmt=WPA2-PSK
wpa_state=COMPLETED
ip_address=172.16.11.28
p2p_device_address=ec:2e:98:d1:03:f7
address=ec:2e:98:d1:03:f7
uuid=3cb04c02-017b-5df7-af29-69f15c7449ed

Gstreamer

Yocto Linux uses Gstreamer as a default multimedia framework. Here are some useful Gstreamer features:

Execute the following command to check all the source options:

gst-inspect-1.0 | grep source

Execute the following command to check all the sink options:

gst-inspect-1.0 | grep sink

Analog Audio

List of available sound cards

  • aplay
aplay -l

**** List of PLAYBACK Hardware Devices ****
card 0: imxaudioxcvr [imx-audio-xcvr], device 0: XCVR PCM snd-soc-dummy-dai-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: audiohdmi [audio-hdmi], device 0: imx8 hdmi i2s-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: somimx8mplus [som-imx8m-plus], device 0: 30c30000.sai-wm8731-hifi wm8731-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
  • procfs
cat /proc/asound/cards

 0 [imxaudioxcvr   ]: imx-audio-xcvr - imx-audio-xcvr
                      compulab-som_imx8m_plus-
 1 [audiohdmi      ]: audio-hdmi - audio-hdmi
                      compulab-som_imx8m_plus-
 2 [somimx8mplus   ]: som-imx8m-plus - som-imx8m-plus
                      compulab-som_imx8m_plus-

Switch between the available output

  • cl-oselect allows select an output device:
cl-oselect

1) alsa_output.platform-sound-hdmi.stereo-fallback
2) alsa_output.platform-sound-xcvr.iec958-stereo
3) alsa_output.platform-sound.analog-stereo
4) <<
Sound sink [ alsa_output.platform-sound.analog-stereo ] > 3

Audio playback

  • gplay-1.0 allows playing back media files:
gplay-1.0 /path/to/media.file

Video Playback

Admolition note.png The operation below requires root access.

CL-SOM-iMX8Plus features 1080p60 H.264, VP8 video decoding capabilities. Before starting video playback, please, ensure that the display is connected to the board.

The following commands can be used to start video playback (1.mov is a media file):

  • gst-play
gst-play /path/to/1.mov
  • gplay-1.0
gplay-1.0 /path/to/1.mov
  • gst-launch

This method is for advanced users. Please study this document before the start: i.MX8GStreamerUserGuide.pdf

gst-launch-1.0 -v filesrc location=/path/to/1.mov ! qtdemux name=d.video_0 ! h264parse ! avdec_h264 ! autovideosink

Video Capturing

Admolition note.png The operation below requires root access.

Requirements

  • hw: an ar1335 sensor is connected to either P47 (MIPI_CSI2) or P49+E18 (MIPI_CSI1) port
  • sw: a correct device tree is in use:
Interface Device Stree
MIPI_CSI1 som-imx8m-plus_mipi-csi1.dtb
MIPI_CSI2 som-imx8m-plus_mipi-csi2.dtb
  • sw: the mxc-isi-cap is registered:
v4l2-ctl --list-devices

 ():
        /dev/v4l-subdev0

mxc-isi-cap (platform:32e00000.isi:cap_devic):
        /dev/video0

FSL Capture Media Device (platform:mxc-md):
        /dev/media0

For hardware setup and camera connection instructions please refer to CL-SOM-iMX8Plus Hardware Guide.

Examples

The following commands should be used to start video capturing:

  • filesink

Write stream to a file. In this example the encoded output gets saved in the 1.mov media file.

gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1280,height=720,format=NV12' ! vpuenc_h264 ! filesink location=/path/to/1.mov
  • waylandsink

Output to wayland surface.

gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1280,height=720,format=NV12' ! waylandsink window-width=1280 window-height=720
  • autovideosink

Wrapper video sink for automatically detected video sink.

gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1280,height=720,format=NV12' ! autovideosink
  • Single Image Capturing
gst-launch v4l2src num-buffers=1 ! jpegenc ! filesink location=single_buffer.jpg

Video streaming

Admolition note.png The operation below requires root access.

The following command should be executed on CL-SOM-iMX8Plus to start video streaming:

gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw, width=640, height=480 ! jpegenc ! udpsink host=127.0.0.1 port=1234

127.0.0.1 is the IP address of the host PC, and 1234 is the host PC port.

The following command should be executed on host PC (Linux) to receive the video stream:

gst-launch-1.0 udpsrc port=1234 ! jpegdec ! autovideosink

1234 is the host PC port.

Suspend / Resume

Admolition note.png The operation below requires root access.

CL-SOM-iMX8Plus 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 frequency

Admolition note.png The operation below requires root access.

CPU frequency current settings

Execute the following command to get the current settings:

grep -ir . /sys/devices/system/cpu/cpufreq/policy0/ 2>/dev/null

/sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq:1200000
/sys/devices/system/cpu/cpufreq/policy0/scaling_available_governors:conservative ondemand userspace powersave performance schedutil 
/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq:1200000
/sys/devices/system/cpu/cpufreq/policy0/scaling_governor:ondemand
/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_max_freq:1600000
/sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies:1200000 1600000 
/sys/devices/system/cpu/cpufreq/policy0/related_cpus:0 1 2 3
/sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq:1200000
/sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed:<unsupported>
/sys/devices/system/cpu/cpufreq/policy0/stats/trans_table:   From  :    To
/sys/devices/system/cpu/cpufreq/policy0/stats/trans_table:         :   1200000   1600000 
/sys/devices/system/cpu/cpufreq/policy0/stats/trans_table:  1200000:         0        65 
/sys/devices/system/cpu/cpufreq/policy0/stats/trans_table:  1600000:        65         0 
/sys/devices/system/cpu/cpufreq/policy0/stats/total_trans:130
/sys/devices/system/cpu/cpufreq/policy0/stats/time_in_state:1200000 643
/sys/devices/system/cpu/cpufreq/policy0/stats/time_in_state:1600000 474
/sys/devices/system/cpu/cpufreq/policy0/affected_cpus:0 1 2 3
/sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq:1600000
/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_transition_latency:182000
/sys/devices/system/cpu/cpufreq/policy0/scaling_driver:cpufreq-dt
/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_min_freq:1200000

Changing the scaling governor

Execute the following command to change the scaling governor:

echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor

Where perfomance is name of the scaling governor.

Execute the following command to see available scaling governors:

cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_governors

Execute the following command to see current scaling governor:

cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor

Changing CPU frequency

Admolition note.png CPU frequency can be changed only when the scaling governoris set to userspace.

Execute the following command to set CPU frequency:

echo 1200000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed

1200000 is one of the available CPU frequencies.

Execute the following command to see available CPU frequencies:

cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies

Execute the following command to see current CPU frequency:

cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq

CPU temperature

i.MX8M-Plus 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

There two rtc on the device:

rtc0 (snvs-rtc-lp)

  • System information
udevadm info -p /sys/class/rtc/rtc0

P: /devices/platform/soc@0/30000000.bus/30370000.snvs/30370000.snvs:snvs-rtc-lp/rtc/rtc0
N: rtc0
L: -100
S: rtc
E: DEVPATH=/devices/platform/soc@0/30000000.bus/30370000.snvs/30370000.snvs:snvs-rtc-lp/rtc/rtc0
E: DEVNAME=/dev/rtc0
E: MAJOR=251
E: MINOR=0
E: SUBSYSTEM=rtc
E: USEC_INITIALIZED=8188223
E: DEVLINKS=/dev/rtc
  • Wake up:

This rtc 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

rtc1 (ab1805)

  • System information
udevadm info -p /sys/class/rtc/rtc1

P: /devices/platform/soc@0/30800000.bus/30a30000.i2c/i2c-1/1-0069/rtc/rtc1
N: rtc1
L: 0
E: DEVPATH=/devices/platform/soc@0/30800000.bus/30a30000.i2c/i2c-1/1-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 "12 SEP 2019 10:00:00"

Thu Sep 12 10:00:00 UTC 2019
hwclock --systohc --rtc /dev/rtc1
  • Read the RTC time and date:
hwclock --show --rtc /dev/rtc1

Thu Sep 12 10:00:48 2019  0.000000 seconds


Device Serial Number and Configuration

Product information is stored in on-board EEPROM.

  • To read the product serial number, issue the folowing command:
compulab@som-imx8plus:~$ cat /proc/device-tree/product-sn
  • To read the product configuration part number, issue the following command:
compulab@som-imx8plus:~$ cat /proc/device-tree/product-options


See Also