Embedded module TQMa93xxCA - YOCTO Linux BSP documentation


CAN

The MBa93xxCA provides the CAN interfaces CAN0 and CAN1.

CAN configuration

DIP switchs S4 and S5 are used to configure the CAN interfaces CAN0 and CAN1.

Function S4-1 S4-2
CAN-Bus not terminated OFF OFF
not defined (illegal state) OFF ON
not defined (illegal state) ON OFF
CAN-Bus terminated with 120 Ohm ON ON
Function S5-1 S5-2
CAN-Bus not terminated OFF OFF
not defined (illegal state) OFF ON
not defined (illegal state) ON OFF
CAN-Bus terminated with 120 Ohm ON ON

CAN Loopback

CAN FD can not be automatically configured by systemd machine units due to a limitation in the systemd version in Yocto Zeus,
it can be enabled by the following commands in the shell:
ip link set can0 down
ip link set can0 up type can bitrate 500000 sample-point 0.75 dbitrate 4000000 dsample-point 0.8 fd on
ip link set can1 down
ip link set can1 up type can bitrate 500000 sample-point 0.75 dbitrate 4000000 dsample-point 0.8 fd on

CAN0 -> CAN1

candump can0&
cansend can1 5A1#11.2233.44556677.88

CAN1 -> CAN0

candump can1&
cansend can0 5A1#11.2233.44556677.88

CPU

The STKa93xxCA supports DVFS (dynamic voltage and frequency scaling, by default the governor ondemand is set. Governors are power schemes for the CPU. Only one may be active at a time.

Governor description
performance Run the CPU at the maximum frequency.
powersave Run the CPU at the minimum frequency.
userspace Run the CPU at user specified frequencies.
ondemand Scales the frequency dynamically according to current load. Jumps to the highest frequency and then possibly back off as the idle time increases.
conservative Scales the frequency dynamically according to current load. Scales the frequency more gradually than ondemand.
schedutil Scheduler-driven CPU frequency selection

You can change the actual governor with the following command:

cpufreq-set -g <governor>
(e.g. cpufreq-set -g performance)

At runtime it is possible to disable multiple CPU cores via the Linux sysfs. On a system that has four CPU cores, the maximum of three cores can be disabled. To disable the a CPU core value 0 must be written to the CPU core specific file /sys/devices/system/cpu/cpu<N>/online where <N> is the number of the Core, the counting starts at zero.
e.g. disable CPU core 4:

echo 0 > /sys/devices/system/cpu/cpu3/online

To check which CPU core(s) are currently enabled the following command can be used:

grep "processor" /proc/cpuinfo

The CPU core can be enabled again by writing the value 1 to /sys/devices/system/cpu/cpu<N>/online.

e.g. enable CPU core 4:

echo 1 > /sys/devices/system/cpu/cpu3/online

It is possible to limit the maximium amount of cores with the the maxcpus= parameter in the kernel command line. To add the new parameter a new U-boot variable addcpu has to be created.

setenv addcpu maxcpus=${cpu_num}

The amount of cores is set by the cpu_num variable, for example if cpu num is set to 2 only two cores will be started.

setenv cpu_num 2

Ethernet

The TQMa93xxCA Starterkit provides two Gigabit Ethernet interfaces.

U-Boot

In U-Boot eth0 is configured as default interface. The IP configuration can be done statically or by a DHCP server in the network.

IP configuration via DHCP

For a configuration via a DHCP server, use the dhcp command in U-Boot.

Static IP configuration For a static IP configuration the following, U-Boot environment variables must be set:

setenv ipaddr <ipaddr> 
(e.g.: setenv ipaddr 192.168.100.111)
setenv netmask <netmask> 
(e.g.: setenv netmask 255.255.255.0)

Linux

Both Ethernet interfaces are activated and configured by systemd-networkd. The configuration files for the interfaces are located in /lib/systemd/network/ these configuration files can be altered to customize the default interface configuration. A documentation of the configuration files can be found here.

eth0 10-eth0.network
eth1 10-eth1.network

For a temporary static configuration the ip command can be used, below some useful ip commands are listed:

Activate a specific interface
e.g. eth0

ip link set eth0 up


Disable a specific interace
e.g. eth0

ip link set eth0 down


Show ip address for a specific interface
e.g. eth0

ip addr show eth0


Show statistic for a specific interface
e.g. eth0

 
ip -s link show eth0 


Set ip address for a specific interface
e.g. eth0

ip addr add 192.168.1.100/24 dev eth0


Show statistic of all interfaces

ip -s link


Set default gateway for a specific interfaces
e.g. set gateway ip 192.168.1.1 for eth0

ip route add default via 192.168.1.1 dev eth0

If a DHCP server is available in the network environment the ip configuration can be received from it. To do so execute the udhcpc command, by default eth0 is used.
To configure another interface via dhcp the parameter -i followed by the interface name e.g. eth1 must be given.
e.g. eth1

udhcpc -i eth1 

I2C

An overview of the onboard i2c devices is available here

U-Boot

Select i2c bus device

i2c dev 0

Show all devices connected to the i2c bus currently selected:

i2c probe

Linux

Detect all devices connected to a i2c bus:

i2cdetect 0

LVDS

TQ offers an optional LVDS Display kit for the STKa93xxCA. Each Display can be used on its own by using the corresponding device tree. To allow reusage, the support for each display is separated in a dtsi fragment.

To bring up the display the U-Boot environment has to be adapted accordingly.

  1. Interrupt boot process in U-boot
  2. Set U-Boot environment variable fdt_file with the command setenv fdt_file imx93-tqma9352-mba93xxca-lvds-tm070jvhg33.dtb
  3. Save the envrionment by executing the saveenv command

RTC

To set the hardware clock to the actual time and date use the following commands:

date -s [YYYY.]MM.DD-hh:mm[:ss]
hwclock -w

SPI

The MBa93xxCA has one SPI interfaces. They can be found on the extension headers and can be tested with a loopback test.

SPI Overview

Interface linux filesystem
SPI6 /dev/spidev1.0
/dev/spidev1.1

Loopback Test SPI Interface

For the loopback test you need a bridge between SPI_MOSI and SPI_MISO:

  • SPI6: bridge between X1_29 (SPI1_MISO) and X1_31 (SPI1_MOSI)
echo -n -e "\x01\x0F" | spi-pipe -d <spi interface> -s 10000000 | hexdump
(e.g. echo -n -e "\x01\x0F" | spi-pipe -d /dev/spidev1.0 -s 10000000 | hexdump)

Temperature Sensors

The STKa93xxCA has two temperature sensors, one is located on the TQMa93xxCA SOM and the other is located on the MBa8MPxL baseboard.

Device I²C Bus I²C Address
TQMa93xxCA I2C-0 0x1C
MBa93xxCA I2C-1 0x1B

Read TQMa93xxCA Temperature Sensor

cat /sys/devices/platform/soc@0/30800000.bus/30a20000.i2c/i2c-0/0-001b/hwmon/hwmon0/temp1_input

Read MBa93xxCA Temperature Sensor

cat /sys/devices/platform/soc@0/30800000.bus/30a20000.i2c/i2c-2/0-001c/hwmon/hwmon1/temp1_input

Read CPU internal Temperature Sensor
The i.MX93 CPU has an internal TMU that supports one thermal zones, it can be read by the command below:

Thermal zone0

cat /sys/devices/virtual/thermal/thermal_zone0/temp
The temperature is shown in millidegrees Celsius.

USB

With lsusb you can see all connected usb devices. To mount a partition of an usb stick you can excute mount /dev/<partition> <mount dir> (e.g. mount /dev/sdb1 /mnt). This will mount the first partition of sdb to /mnt. To unmount the device execute umount <mount dir> (e.g. umount /mnt).

User LED

The MBa93xxCA has two user controllable LEDs, the behavior of these LEDs can be selected by several triggers.

User LED Overview

Reference LED name color linux filesystem
V2 led1 green /sys/class/leds/green
V3 led2 orange /sys/class/leds/amber

User LED Location

The user LED's are located in /sys/devices/platform/gpio-leds/leds/.
To change the behaviour a specific LED, the value in the file trigger must be overwritten.

The following values are valid:

For example set the trigger of led2 to heartbeat

echo heartbeat > /sys/class/leds/green/trigger

  • Last modified: 2024/01/24 13:34