IOT-GATE-iMX7 and SBC-IOT-iMX7: Linux: Debian
Contents
Overview
The example run-time Linux filesystem image for the CompuLab IOT-GATE-iMX7 Internet of Things Gateway and SBC-IOT-iMX7 Internet of Things Single Board Computer is based on Debian GNU/Linux Sid. The CompuLab Linux package for IOT-GATE-iMX7 and SBC-IOT-iMX7 includes ready to run image, Linux kernel configuration and source code patches, and an archive of the root filesystem, used to create the image.
The default Debian Wheezy Linux image includes more than 400 software packages. Among them:
- Core system
- Debian package management system
- X11 Windowing System
- Fluxbox desktop manager
- SSH server and client
- PulseAudio configuration and usage utilities
- Bluez5 Bluetooth tools and daemons
The Automatic Linux installation on IOT-GATE-iMX7 and SBC-IOT-iMX7 page provides a brief introduction on how to install the run-time Linux image. This article describes package structure and peripheral device options specific to IOT-GATE-iMX7 and SBC-IOT-iMX7.
Using Debian Linux on SBC-IOT-iMX7
Connection and Logging In
This Debian rootfs comes with a default sudo user compulab:
Debian GNU/Linux 10 cl-debian ttymxc0 cl-debian login: compulab Password: compulab
This Debian rootfs comes without default root password. The root password has to be set at the very first login:
Debian GNU/Linux 10 cl-debian ttymxc0 cl-debian login: root You are required to change your password immediately (administrator enforced) New password: Retype new password:
To login into the Linux system, you may use a serial console, or connect through the network (ssh), or use a keyboard and display.
Networking
To configure networking, edit /etc/network/interfaces, /etc/resolv.conf, /etc/hostname and /etc/hosts. For more information about Debian Linux network configuration read:
- Network setup chapter in the Debian Reference
- Network chapter in the Debian Wiki
The majority of network setup can be done via the interfaces configuration file at /etc/network/interfaces.
auto line is required for interfaces that have to be brought up at boot time. |
- Using DHCP to automatically configure the interface
auto eth0 allow-hotplug eth0 iface eth0 inet dhcp
- Configuring the interface manually
auto eth0 iface eth0 inet static address 192.168.1.170 netmask 255.255.0.0 gateway 192.0.0.1
Consoles
The Linux file system image is designed to suit different kernel versions and configurations. Therefore, during the operating system startup, consoles at several serial ports and LCD display are enabled. Some of these devices may not be supported, either because of kernel versions incompatibilities, or because the kernel was not configured to support these devices. systemd is able to configure most of them. Detail information can be found here:
- Systemd getty generator [systemd-getty-generator]
- Gettys on Serial Consoles [serial-console]
X Windows system
The CompuLab distribution contains full featured X Windows system with Fluxbox window manager. Before starting X Windows, connect USB mouse and keyboard to the system. You can run X Windows by typing startx.
Software Management
The Debian Linux image for CL-SOM-iMX7 and derived products includes all the information required to use Debian package management utilities. You can use apt-get and dpkg out of the box.
Analog Audio
Use aplay -l to list all sound cards and digital audio devices registered on the system:
root@cl-rootfs:~# aplay -l **** List of PLAYBACK Hardware Devices **** card 0: clsomimx7 [cl-som-imx7], device 0: 308a0000.sai-wm8731-hifi wm8731-hifi-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0
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@cl-rootfs:~# aplay -L null Discard all samples (playback) or generate zero samples (capture) default:CARD=clsomimx7 cl-som-imx7, Default Audio Device sysdefault:CARD=clsomimx7 cl-som-imx7, Default Audio Device dmix:CARD=clsomimx7,DEV=0 cl-som-imx7, Direct sample mixing device dsnoop:CARD=clsomimx7,DEV=0 cl-som-imx7, Direct sample snooping device hw:CARD=clsomimx7,DEV=0 cl-som-imx7, Direct hardware device without any conversions plughw:CARD=clsomimx7,DEV=0 cl-som-imx7, Hardware device with all software conversions
The next command can be used for audio play back:
root@cl-rootfs:~# aplay -D sysdefault <wav-file>
Audio Input Settings
CL-SOM-iMX7 provides an audio capturing feature from either Mic or Line In input sources. alsamixer or amixer can be used in order to switch between these inputs.
Mic
- alsamixer
- Capture Volume => 100
- Line Capture Switch => off
- Mic Capture Switch => on
- Input Mux => Mic
- amixer
amixer cset numid=1 65536 amixer -c 0 cset numid=3 31,31 amixer -c 0 cset numid=4 0 amixer -c 0 cset numid=6 1 amixer -c 0 cset numid=14 1
Line In
- alsamixer
- Capture Volume => 100
- Line Capture Switch => on
- Mic Capture Switch => off
- Input Mux => Line In
- amixer
amixer cset numid=1 65536 amixer -c 0 cset numid=3 31 amixer -c 0 cset numid=4 1 amixer -c 0 cset numid=6 0 amixer -c 0 cset numid=14 0
Sample Audio Recording
As soon as the correct input values have been set, audio signal can be captured. Here is a sample command that shows the arecord usage for capturing audio signal from the selected input line.
root@cl-rootfs:~# arecord -D sysdefault -d 10 -f dat -t wav /tmp/out.wav
WiFi
CL-SOM-iMX7 features 802.11b/g/n wireless connectivity solution, implemented with a TI WiLink8 Combo module.
WiFi Initialization
- WiFi requires no user interaction for being configured. The driver gets loaded automatically.
Make sure that the WiFi driver is loaded:
root@cl-rootfs:~# lsmod | grep wl18xx wl18xx 70950 0
The WiFi driver can be loaded manually:
root@cl-rootfs:~# modprobe wl18xx wlcore: ERROR could not get configuration binary ti-connectivity/wl18xx-conf.bin: -2 wlcore: WARNING falling back to default config wlcore: wl18xx HW: 183x or 180x, PG 2.2 (ROM 0x11) wlcore: loaded
- iwconfig command from wireless-tools package can be used to retrieve detailed information about the WiFi interfaces:
root@cl-rootfs:~# iwconfig wlan0 wlan0 IEEE 802.11abgn ESSID:off/any Mode:Managed Access Point: Not-Associated Tx-Power=0 dBm Retry short limit:7 RTS thr:off Fragment thr:off Encryption key:off Power Management:on
- Activate the interface:
root@cl-rootfs:~# ifconfig wlan0 up
- Sample WiFi scanning:
root@cl-rootfs:~# iwlist wlan0 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
- Configuration sample
Please open a wpa_supplicant configuration file bellow and put a network name and a password into the "ssid" and "psk" fields respectively.
root@cl-rootfs:~# cat /etc/wpa_supplicant.conf ctrl_interface=/var/run/wpa_supplicant network={ ssid="wireless_network_name" key_mgmt=WPA-PSK psk="wireless_network_password" }
- Sample run
root@cl-rootfs:~# ifconfig wlan0 up root@cl-rootfs:~# wpa_supplicant -B -Dwext -c /etc/wpa_supplicant.conf -i wlan0 root@cl-rootfs:~# dhclient wlan0
Bluetooth
CL-SOM-iMX7 features Bluetooth 4.1 BLE interface, implemented with a TI WiLink8 Combo module.
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@cl-debian:~# lsmod | grep hci_uart hci_uart 10445 1
The Bluetooth driver can be loaded manually:
root@cl-rootfs:~# modprobe hci_uart
- HCI device configuration utility can be run to retrieve detailed information about the Bluetooth interfaces:
root@cl-rootfs:~# hciconfig hci0 -a hci0: Type: Primary Bus: UART BD Address: 3C:A3:08:A8:03:B9 ACL MTU: 1021:6 SCO MTU: 180:4 UP RUNNING RX bytes:746 acl:0 sco:0 events:49 errors:0 TX bytes:3441 acl:0 sco:0 commands:49 errors:0 Features: 0xff 0xfe 0x2d 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: 'cl-debian' Class: 0x0c0000 Service Classes: Rendering, Capturing Device Class: Miscellaneous, HCI Version: 4.1 (0x7) Revision: 0x0 LMP Version: 4.1 (0x7) Subversion: 0xac03 Manufacturer: Texas Instruments Inc. (13)
- If the HCI device is not running, use the below command to enable the HCI device:
root@cl-rootfs:~# hciconfig hci0 up
- HCI Inquire remote devices.
root@cl-rootfs:~# hcitool scan Scanning ...
3G Cellular Modem
Both IOT-GATE-iMX7 Internet of Things Gateway and SBC-IOT-iMX7 Internet of Things Single Board Computer are equipped with on-board micro-SIM card socket and support cellular communication using 3G cellular modem with USB interface in mini-PCIe form-factor. Following 3G cellular modules have been tested:
Installing Debian packages
In order to use 3G cellular modem the several software packages have to be installed.
root@cm-debian:~# apt-get install libpcap0.8 libuniconf4.6 libwvstreams4.6-base libwvstreams4.6-extras ppp wvdial
Loading kernel modules
Device driver modules require no user interaction and get loaded automatically. If for some reason device driver modules are not loaded automatically, please load them manually:
- USB Driver for GSM modems and Qualcomm MSM Interface (QMI) WWAN driver are required for SIMcom SIM5360:
root@cl-som-imx7-sid:~# modprobe option root@cl-som-imx7-sid:~# modprobe qmi_wwan
- USB Abstract Control Model driver is required for Telit HE910-D:
root@cl-som-imx7-sid:~# modprobe cdc-acm
Point-to-Point protocol (PPP) drivers must be loaded manually prior to dialing:
root@cl-som-imx7-sid:~# modprobe ppp_generic root@cl-som-imx7-sid:~# modprobe ppp_async root@cl-som-imx7-sid:~# modprobe ppp_synctty root@cl-som-imx7-sid:~# modprobe bsd_comp root@cl-som-imx7-sid:~# modprobe ppp_deflate
WvDial
WvDial is a Point-to-Point Protocol dialer that automatically detects modem, and can log into almost any Internet Service Provider without a complicated configuration. First, overwrite the wldial configuration file. Please use the a correct ISP APN instead of YOUR_ISP_APN stub:
root@cl-som-imx7-sid:~# cat << eof > /etc/wvdial.conf [Dialer cellular] # Your modem device. Usually /dev/ttyUSB0 or /dev/ttyACM0 #Modem = /dev/ttyACM0 Modem = /dev/ttyUSB3 # Port speeds that're worth testing: # 921600 # 460800 # 115200 # 57600 Baud = 115200 # If your SIM card has a PIN, comment this line, uncomment the next one, and # change the PIN shown to your PIN. Init = ATZ # Init = ATZ+CPIN="0000" # If you know your ISP's APN, specify it instead of YOUR_ISP_APN below. # If you don't, you may be able to find out on the 'net, or from tech # support. # # There's also an APN table at https://wiki.ubuntu.com/NetworkManager/Hardware/3G . # # If you can't find it, you might be able to dial out without setting an APN # (especially from a mobile phone). Just comment this line and uncomment # the next one. Init2 = AT+CGDCONT=1,"IP","YOUR_ISP_APN" #Init2 = AT+CGDCONT=1,"IP" # Most services/devices dial with *99# . A few seem to require *99***1# Phone = *99# # These often suffice, but your ISP might require different details. They're # often dummy details used for all users on the ISP, frequently the ISP's # name, but some ISP's do require you to use a real username and password. Username = dummy Password = dummy eof
The following command can be used for dialing:
root@cm-debian:~# wvdial cellular &
MMC/SD
The support for MMC/SD card on Compulab devices based on the NXP iMX7 SoC is built into the Linux kernel. To mount a memory card, monitor /proc/partitions to see what partitions were detected on the MMC/SD card. For example, suppose an MMC/SD partition you'd like to mount is mmcblk0p1 then:
if [ ! -d /mnt/mmcblk0p1 ]; then mkdir /mnt/mmcblk0p1; fi mount /dev/mmcblk0p1 /mnt/mmcblk0p1
GPIO access
Linux provides simple and convenient GPIO access via sysfs interface. A GPIO should be exported using /sys/class/gpio/export. After the GPIO is exported it is possible to change its direction and value using /sys/class/gpio/gpioX/direction and /sys/class/gpio/gpioX/value attributes.
Example
The following example demonstrates how to configure GPIO 140 as output and set value to high:
root@cl-rootfs:~# echo 140 > /sys/class/gpio/export root@cl-rootfs:~# echo out > /sys/class/gpio/gpio140/direction root@cl-rootfs:~# echo 1 > /sys/class/gpio/gpio140/value
The above example assumes that the pinmux configuration of the corresponding pin is set to GPIO mode and the GPIO 140 is not requested in the Linux kernel. |
See also
- IOT-GATE-iMX7 and SBC-IOT-iMX7: Linux: Automatic Installation
- IOT-GATE-iMX7 and SBC-IOT-iMX7: Linux: Manual Installation
- IOT-GATE-iMX7 and SBC-IOT-iMX7: Linux: Package contents
- IOT-GATE-iMX7 and SBC-IOT-iMX7: Linux: Kernel
- Linux: Development for ARM modules
- Linux: Debian: Minimal ARM filesystem
- Debian Reference.