CM-T43: Yocto Linux: User Space

From Compulab Mediawiki
Jump to: navigation, search

Overview

The example run-time Yocto Linux filesystem image for the CompuLab CM-T43 System-on-Module / Computer-on-Module is based on Texas Instruments Arago project.

The Automatic Installation page provides a brief introduction on how to install the run-time Yocto Linux image.

Using Yocto Linux on CM-T43

Connection and Logging In

Use the following username to login:

root@cm-t43: root

To login into the Linux system, you may use a serial console (ttyO0) at 115200 bps, or connect through the network.

Networking

CM-T43 can operate in two modes: dual MAC mode, or as a 3 port ethernet switch. The default mode of operation is dual MAC mode. A user guide for both operation modes can be found in the Linux Core CPSW User's Guide article in the TI wiki. To configure networking, edit /etc/network/interfaces, /etc/resolv.conf, /etc/hostname and /etc/hosts. For more information about Linux network configuration read Network setup chapter in the Debian Reference.

Switching to 3-port switch mode

To enable 3-port switch mode, the device tree blob must be modified to remove the dual_emac property before Linux boots. This can be done using the following U-Boot commands:

# fdt addr <address fdt was loaded to>
# fdt rm /ocp/ethernet@4a100000 dual_emac

Wayland display server

The Arago root filesystem image contains fully featured display server system Wayland/Weston. Wayland is a protocol that specifies the communication between a display server (called Wayland compositor) and its clients, as well as a reference implementation of the protocol. The Wayland project includes a demo Wayland compositor, called Weston. It's fast, small, and runs on embedded and mobile devices. On start-up Wayland and the Texas Instruments Matrix is started. Connect USB mouse and keyboard for interaction with Wayland and the Texas Instruments Matrix.

  • Use the following commands to stop the matrix:
/etc/init.d/matrix-gui-2.0 stop
  • Use the following commands to start the matrix:
/etc/init.d/matrix-gui-2.0 start
  • Use the following commands to stop the Weston:
/etc/init.d/weston stop
  • Use the following commands to start the Weston:
/etc/init.d/weston start

Display options

CM-T43 evaluation platform has three video output interfaces: LCD, DVI, and LVDS. Default configuration of Yocto Linux for CM-T43 uses LCD as primary video output.

USB Dual-Role-Device

CM-T43 has USB DWC3 based controller. It features USB 2.0 Dual-Role-Device (DRD) subsystem with integrated HS/FS (USB2.0) PHY. CM-T43 DRD port is USB host and USB device (gadget) capable. USB Device Gadget drivers are compiled as modules with default CM-T43 kernel configuration. Current Linux kernel support of DWC3 features does not allow dynamic role (host/device) switching during runtime. By default, host role is assigned to CM-T43 DRD port.

Device mode can be enabled by running the following U-Boot commands before boot:

# fdt addr <address fdt was loaded to>
# fdt resize
# fdt set /ocp/omap_dwc3@48380000/usb@48390000 dr_mode peripheral

Testing Device (gadget) mode

Default CM-T43 kernel configuration enables g_serial, g_mass_storage, g_ether, g_audio, and g_hid gadget drivers. More gadget drivers can be enabled in the kernel configuration.

  • Connect USB OTG micro B-cable (ID pin Float) to P3 USB DRD port of SB-SOM baseboard.
  • Connect other side Standard-A connector to Linux Host PC USB Host port.
Emulate a serial link
  • Load gadget driver on CM-T43 Eval board:
root@cm-t43:~# modprobe g_serial
[   56.306729] g_serial gadget: Gadget Serial v2.4
[   56.311433] g_serial gadget: g_serial ready
[   56.758367] g_serial gadget: high-speed config #2: CDC ACM config
  • Ensure the connection is established on the Host PC:
user@linux-host:~$ dmesg
...
[72415.607738] cdc_acm 2-1.8.2:2.0: ttyACM0: USB ACM device
[72415.608446] usbcore: registered new interface driver cdc_acm
[72415.608447] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
  • Receive data on CM-T43 Eval board:
root@cm-t43:~# cat /dev/ttyGS0
  • Send data from Host PC:
user@linux-host:~$ echo "Test message" > /dev/ttyACM0

Analog Audio

CM-T43 provides an analog audio interface, which is registered as a standard ALSA sound card. Use aplay -l to list all soundcards and digital audio devices registered on the system:

root@cm-t43:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: CMT43SoundCard [CM-T43-Sound-Card], device 0: davinci-mcasp.0-wm8731-hifi wm8731-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Analog Audio Settings

To enable the Analog audio playback, alsamixer or amixer applications can be used.

  • alsamixer - set the “Output Mixer” control on.

or

  • amixer - set the “Output Mixer HiFi Playback Switch” control on using command line interface:
root@cm-t43:/# amixer cset numid=13 1
numid=13,iface=MIXER,name='Output Mixer HiFi Playback Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on

Analog Audio Playback

In order to play back a sound file make use of the aplay application.

  • aplay -L can be used for listing of all pcm devices.

Here is a sample output of aplay -L command:

root@cm-t43:/# aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
pulse
    PulseAudio Sound Server
default:CARD=CMT43SoundCard
    CM-T43-Sound-Card, 
    Default Audio Device
sysdefault:CARD=CMT43SoundCard
    CM-T43-Sound-Card, 
    Default Audio Device

WiFi

CM-T43 features 802.11b/g/n wireless connectivity solution, implemented with a Marvell wireless controller module.

WiFi Initialization

  • The driver gets loaded automatically. Make sure that the WiFi driver is loaded:
root@cm-t43:/# lsmod | grep mwifi
mwifiex_sdio           26039  0
mwifiex               256669  1 mwifiex_sdio
cfg80211              259154  1 mwifiex
  • iwconfig command from wireless-tools package can be used to retrieve detailed information about the WiFi interfaces:
mlan0     IEEE 802.11abgn  ESSID:off/any  
          Mode:Managed  Access Point: Not-Associated   
          Retry short limit:9   RTS thr=2347 B   Fragment thr=2346 B   
          Encryption key:off
          Power Management:on
  • WLAN interface activating:
root@cm-t43:/# ifconfig mlan0 up
  • Sample WiFi scanning:
root@cm-t43:/# iwlist 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.

Bluetooth

Host Controller Interface (HCI) Initialization

  • HCI requires no user interaction for being configured. The driver gets loaded automatically unless this option has been disabled by putting a black list rule for this device.

Make sure that the Bluetooth driver is loaded:

root@cm-t43:/# lsmod | grep btmrvl
btmrvl_sdio            14518  0
btmrvl                 12690  1 btmrvl_sdio
bluetooth             326343  16 bnep,btmrvl,btmrvl_sdio
  • HCI device configuration utility can be run to retrieve detailed information about the Bluetooth interfaces:
root@cm-t43:/# hciconfig -a
hci0:	Type: BR/EDR  Bus: SDIO
	BD Address: 80:D2:1D:5F:45:18  ACL MTU: 1021:7  SCO MTU: 120:6
	UP RUNNING PSCAN 
	RX bytes:1704 acl:0 sco:0 events:76 errors:0
	TX bytes:1459 acl:0 sco:0 commands:75 errors:0
	Features: 0xff 0xfe 0x8f 0xfe 0xdb 0xff 0x7b 0x87
	Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 
	Link policy: RSWITCH HOLD SNIFF 
	Link mode: SLAVE ACCEPT 
	Name: 'cm-t43-0'
	Class: 0x000100
	Service Classes: Unspecified
	Device Class: Computer, Uncategorized
	HCI Version:  (0x8)  Revision: 0x8300
	LMP Version:  (0x8)  Subversion: 0x7270
	Manufacturer: Marvell Technology Group Ltd. (72)
  • If the HCI device is not running, use the below command to enable the HCI device:
root@cm-t43:/# hciconfig hci0 up
  • HCI inquire remote devices
root@cm-t43:/# hcitool scan
Scanning ...

RTC

Accessing and setting the RTC

To access the RTC time and date run:

root@cm-t43:/# hwclock
Sat Jun 17 13:36:35 2017  0.000000 seconds

To set the date and write it into the RTC do the following:

root@cm-t43:/# date -s "2015-02-11 10:00:00"
Wed Feb 11 10:00:00 UTC 2015
root@cm-t43:/# hwclock -w
root@cm-t43:/# hwclock
Sat Jun 17 13:39:09 2017  0.000000 seconds

Touchscreen

Touchscreen calibration runs on first boot. To rerun it, execute the following commands:

rm /etc/udev/rules.d/ws-calibrate.rules
rm /run/media/mmcblk0p1/ws-calibrate.rules
reboot

CAN bus

Install can-utils using:

# apt-get install can-utils

CAN interface configuration

  • Load the can bus modules:
root@cm-t43:~# modprobe can-raw
[  123.114470] can: controller area network core (rev 20120528 abi 9)
[  123.120993] NET: Registered protocol family 29
[  123.155278] can: raw protocol (rev 20120528)
root@cm-t43:~# modprobe can-bcm
[  145.749470] can: broadcast manager protocol (rev 20120528 t)

It is recommended configure the CAN interface, with the iproute2 utilities.

  • To make sure the right ip utility is used, run:
root@cm-t43:~# ip -V
ip utility, iproute2-ss160111
  • Configure the CAN interface bit-rate to 125 Kbits/sec (values of up to 1Mbit/sec are supported):
root@cm-t43:~# ip link set can0 type can bitrate 125000
  • Enable the CAN interface:
root@cm-t43:~# ip link set can0 up
[  184.948857] net can0: c_can_hw_raminit_wait_syscon: time out
[  184.954781] c_can_platform 481d0000.can can0: setting BTR=0518 BRPE=0000
Send/Receive packets

Use cansend and candump utilities to send and receive packets via CAN interface.

  • Send standard CAN frame (on the first device):
root@cm-t43:~# cansend can0 111#1122334455667788
  • Send extended CAN frame (on the first device):
root@cm-t43:~# cansend can0 11111111#1122334455667788
  • Dump all received data frames as well as error frames (on the second device):
root@cm-t43:~# 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

GPIO

To use a GPIO:

  • Select a pin you wish to use as GPIO by consulting the CM-T43 reference manual. The reference manual contains a list of pins and the possible functions each pin can support, many of which include GPIO signals as one of the possible functions.
  • Setup the pinmux so that the GPIO function is selected for the pin you chose in the previous step. This may require you to edit the device tree for CM-T43. Consult the device tree article in the CM-T43 Linux wiki.
  • Export the GPIO in Linux sysfs and cd into it
root@cm-t43:/# echo <gpio_num> > /sys/class/gpio/export
root@cm-t43:/# cd gpio<gpio_num>
  • Select GPIO input/output function:
root@cm-t43:/# echo in > direction

or

root@cm-t43:/# echo out > direction
  • To read GPIO input (or determine what value is being output):
root@cm-t43:/# cat value
0
  • To output a value on the GPIO pin:
root@cm-t43:/# echo 1 > value

PRU

CM-T43 Yocto Linux has PRU support. For usage instructions, consult the TI PRU wiki.

See also