Getting Started with TS-7553-V2

From embeddedTS Manuals
TS-7553-V2 with enclosure

A Linux workstation is recommended and assumed for development using this documentation. For users in Windows or OSX, we recommend virtualizing Linux. Most of our platforms run Debian, which is recommended for ease of use if there is no personal distribution preference.

Virtualization

Suggested Linux Distributions

Development using a Windows or OSX system may be possible but is not supported. Development will include accessing drives formatted for Linux and often Linux-based tools.

Getting started with the TS-7553-V2 single board computer involves making first connections and network setup before starting development. It's beneficial to have the TS-7553-V2 manual handy for more advanced topics and specific details. The only assumption as of this writing is that you’ve purchased the TS-7553-V2 with a development kit, including the pre-programmed microSD card and enclosure with 128×64 px LCD and 4 button keypad. There’s also a video tutorial on getting started in the embeddedTS YoutTube channel.

WARNING: Be sure to take appropriate Electrostatic Discharge (ESD) precautions. Disconnect the power source before moving, cabling, or performing any set up procedures. Inappropriate handling may cause damage to the board.

Out-of-the-Box Setup

TS-7553-V2 open enclosure

The basics start with the serial console, power, and Ethernet connections, followed by power to start using the TS-7553-V2. Most of these connections are available externally, but if there is an enclosure, unscrew the four screws on the bottom to get to the jumper block, microSD card, and other areas.

TS-7553-V2 jumpers

There are several jumpers on the TS-7553-V2, but we’re only interested in “SD Boot” and “No Charge” jumpers for this getting started guide. These should be set properly out of the box, but we want to double check that the “SD Boot” jumper is set, so that we boot from the microSD card (more about the bootup environments later). Then, if your unit has the TS-SILO supercapacitors, we want to disable them while we’re in development and activate them later closer to production (it can get in the way when testing). To disable, set the “No Charge” jumper. The others we can leave at factory settings. Your jumper block should end up looking like the picture. Note that the “U-Boot” jumper is not set, it is only on one pin and is considered to be “hanging.”

Nothing beats a good serial console for direct access to an embedded system. Where others like telnet and SSH might fail due to bad startup scripts or network issues, a direct serial console connection can provide direct insight. For this, you will need an A/B USB cable (included in development kit). There is no need to deal with NULL modem cables or USB to serial adapters here.

A Linux development machine is recommended. Not only are the serial port drivers already installed, but you’ll also need it if you plan on using embeddedTS' cross compile toolchains for a larger project later on. For now, if using a Windows or Mac OSX machine, you can obtain the serial port drivers from the Silicon Labs USB-to-UART drivers page.

The next step: connect the USB cable to the host computer and follow instructions given in the "First Linux Boot" section below. Typically, your serial device name may be:

  • Linux, /dev/ttyUSB0
  • Mac OSX, /dev/tty.SLAB_USBtoUART
  • Windows, use device manager to discover COM port

Ethernet

You will want to be able to connect to the network to get it to talk with the local network or Internet, or even accessing the device via SSH or booting to an NFS filesystem. There is only one Ethernet port on the TS-7553-V2, designated eth0 in Linux. You can read more about it in the Networking Quickstart section of the Debian 12 manual. So, plug in a standard Ethernet cable connected to your router or switch, and we should be good to proceed to the next section.

Power

The main way to power the TS-7553-V2 is through the 5 – 12 VDC barrel power connector. The power supply that comes with the development kit is the PS-5VDC-REG-1AMP-BC, 5 VDC @ 1 A. For a quick start, plug the barrel end of the power adapter into the TS-7553-V2 and the other into the wall outlet, and you’ll see status LEDs start blinking. If you have your console setup properly, you should see the bootup process roll through the console screen. You could also power the TS-7553-V2 using Power over Ethernet (PoE), available with the purchase of a daughter card.

The TS-7553-V2 has an input voltage range of 5 V to 28 V DC through the main power connector which offers screw terminals for secure wiring or a barrel jack. Please note that while the TS-ENC820 endcap lists "5V-12V", the input voltage range is still 5 V to 28 V DC with the unit in the enclosure. See the P1 pin header diagram for screw terminal power locations. See the CN6 Barrel Jack section for details about the coaxial power connector.

The TS-7553-V2 will require approximately 1 W at idle. An ideal power supply for the TS-7553-V2 will allow up to 5 W to power additional peripherals without issue. See the Power Specifications section for more information on power input.

First Linux Boot

Once power has been applied, output will be available on the serial console. The next section of this manual provides information on getting the console port set up. The first output is from the bootrom and will look like the following:

U-Boot 2016.03-00305-g75344a5 (Dec 15 2017 - 13:53:14 -0800)

CPU:   Freescale i.MX6UL rev1.1 at 396 MHz
Reset cause: POR
Board: Technologic Systems TS-7553-V2
I2C:   ready
DRAM:  512 MiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
*** Warning - bad CRC, using default environment

Net:   FEC0 [PRIME]
Booting from the SD card ...
** File not found /boot/boot.ub **
34511 bytes read in 162 ms (208 KiB/s)
5460520 bytes read in 391 ms (13.3 MiB/s)
NO CHRG jumper is set, not waiting
Kernel image @ 0x80800000 [ 0x000000 - 0x535228 ]
## Flattened Device Tree blob at 83000000
   Booting using the fdt blob at 0x83000000
   Using Device Tree in place at 83000000, end 8300b6ce

Starting kernel ...



Welcome to Debian GNU/Linux 8 (jessie)!

[ SKIP ] Ordering cycle found, skipping D-Bus System Message Bus Socket
         Expecting device dev-ttymxc0.device...
[  OK  ] Reached target Remote File Systems (Pre).
...
[  OK  ] Started Update UTMP about System Runlevel Changes.

Debian GNU/Linux 8 ts-imx6ul ttymxc0

ts-imx6ul login:


The U-Boot build date reflects when U-Boot was built and serves as a revision indicator. A change to the kernel or filesystem will not affect this date.


Connect USB Console

Serial Console

The TS-7553-V2 includes a USB type B device port which uses a 8051 based microcontroller to create a serial device on a host PC. The serial console is provided through this port at 115200 baud, 8n1, with no flow control. The USB serial device is a CP210x Virtual COM Port. Most operating systems have built-in support for this device. If not however, drivers are available for the device here.

Note that this port can also be internally switched to connect to the CPU as a USB OTG/Gadget port.

Console from Linux

There are many serial terminal applications for Linux, three common used applications are picocom, screen, and minicom. These examples demonstrate all three applications and assume that the serial device is "/dev/ttyUSB0" which is common for USB adapters. Be sure to replace the serial device string with that of the device on your workstation.

picocom is a very small and simple client.

sudo picocom -b 115200 /dev/ttyUSB0

screen is a terminal multiplexer which happens to have serial support.

sudo screen /dev/ttyUSB0 115200

Or a very commonly used client is minicom which is quite powerful but requires some setup:

sudo minicom -s
  • Navigate to 'serial port setup'
  • Type "a" and change location of serial device to "/dev/ttyUSB0" then hit "enter"
  • If needed, modify the settings to match this and hit "esc" when done:
     E - Bps/Par/Bits          : 115200 8N1
     F - Hardware Flow Control : No
     G - Software Flow Control : No
  • Navigate to 'Save setup as dfl', hit "enter", and then "esc"

Console from Windows

Putty is a small simple client available for download here. Open up Device Manager to determine your console port. See the putty configuration image for more details.

Device Manager Putty Configuration

Wireless Module (Optional)

If you purchased the optional soldered down wireless and Bluetooth module, you’ll see it on the board, but there’s nothing else you need to do. The wireless antenna is integrated into the wireless module. It will be designated at wlan0 in Linux.

LCD Screen

There are two ribbon cables and a power cable that attaches the TS-7553-V2 to the 128×64 px LCD screen mounted on the enclosure. These should be already attached from the factory. The brown cable is attached by an FFC connector and is latched in place. The blue cable is a simple pin connector, but be sure to take note of the orientation. Some earlier revisions require a twist in the cable while later revisions don’t. The power cable is a simple push in with locking tab. A small screwdriver makes quick and easy work of disconnecting and reconnecting these cables should you need to separate the enclosure.

LCD screen connections

Setup Networking

Wired

If you recall, we’re going to be setting up our eth0 network interface. For this, we’re going to follow the Networking Quickstart section of the Debian 12 for i.MX6UL manual. First, we’ll enable the network interface, and then we’ll go about obtaining an IP address. The easiest way to get an IP address is dynamically using DHCP. For some applications, like a web server, a static IP address is better to use. We’ll take a look at both.

Dynamic IP (Optional)

Out of the box, the TS-7553-V2 will automatically attempt to obtain an IP address via DHCP on eth0. There isn’t anything you should have to do, but it’s good practice to know how it works. You can skip this if you’d like, but we’re going to manually go through the steps. First, we need to enable the eth0 network interface by issuing the following command:

root@ts-imx6ul:~# ifconfig eth0 up root@ts-imx6ul:~#

Then, in order to get an IP address, we issue the command: root@ts-imx6ul:~# dhclient eth0 root@ts-imx6ul:~#

Issuing the ifconfig command should show us our connection information, which in this case the board was assigned the IP address of 192.168.1.121:

root@ts-imx6ul:~# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:d0:69:4d:8c:3a  
          inet addr:192.168.1.121  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::2d0:69ff:fe4d:8c3a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:13875 errors:0 dropped:0 overruns:0 frame:0
          TX packets:312 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2178801 (2.0 MiB)  TX bytes:26402 (25.7 KiB)

You should now be able to ping an external URL to test your connection:

root@ts-imx6ul:~# ping debian.org
PING debian.org (140.211.15.34) 56(84) bytes of data.
64 bytes from busoni.debian.org (140.211.15.34): icmp_req=1 ttl=57 time=26.8 ms
64 bytes from busoni.debian.org (140.211.15.34): icmp_req=2 ttl=57 time=31.9 ms
64 bytes from busoni.debian.org (140.211.15.34): icmp_req=3 ttl=57 time=25.6 ms
64 bytes from busoni.debian.org (140.211.15.34): icmp_req=4 ttl=57 time=26.1 ms
^C
--- debian.org ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 25.657/27.640/31.936/2.518 ms
root@ts-imx6ul:~#

Next time we bootup the system with the Ethernet cable plugged in, we should automatically be connected to our network via DHCP. For this, we rely on systemd. Let’s take a look really quick at how that works. First, let’s take a look at the file responsible for setting up our Ethernet device at /etc/systemd/network/eth.network

root@ts-imx6ul:~# cat /etc/systemd/network/eth.network [Match] Name=eth*

[Network] DHCP=yes

What we’re saying here is any Ethernet device (eth* ) will obtain an IP address via DHCP. We’ll want to change the [Network] section to enable static IP address, which we’ll talk about in the next section. For now, let’s take a look at the status of systemd-resolved.service.

root@ts-imx6ul:~# systemctl status systemd-resolved.service 
⚫ systemd-resolved.service - Network Name Resolution
   Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled)
   Active: active (running) since Thu 2017-06-15 17:20:49 UTC; 3min 5s ago
     Docs: man:systemd-resolved.service(8)
 Main PID: 354 (systemd-resolve)
   Status: "Processing requests..."
   CGroup: /system.slice/systemd-resolved.service
           └─ /lib/systemd/systemd-resolved
 
Jun 15 17:20:49 ts-imx6ul systemd[1]: Started Network Name Resolution.

If it doesn’t say loaded and active, then we’ll need to issue the commands below. Otherwise, skip this part.

systemctl start systemd-resolved.service systemctl enable systemd-resolved.service ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf Perfect. We should be good to go now. Give your system a reboot and make sure it comes back up with an DHCP assigned IP address.

Static IP

For this, we’ll create the

/etc/systemd/network/eth0.network

file and add the following text to it. Make sure to modify it to fit your specific network settings. Here, I want to assign the IP address of 192.168.1.122.

root@ts-imx6ul:~# cat /etc/systemd/network/eth0.network [Match] Name=eth0

[Network] Address=192.168.1.122/24 Gateway=192.168.1.1 DNS=192.168.1.1

And so that we don’t confuse dynamic and static IP address settings, let’s remove or move the eth.network file.

root@ts-imx6ul:~# mv /etc/systemd/network/eth.network /etc/systemd/network/eth.network.bak

Now, restart the system. Once we’ve logged back in, we’ll do a quick test by issuing the ifconfig eth0 command and double check that our IP address has now changed.

root@ts-imx6ul:~# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:d0:69:4d:8c:3a  
          inet addr:192.168.1.122  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::2d0:69ff:fe4d:8c3a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:94 errors:0 dropped:0 overruns:0 frame:0
          TX packets:19 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:15590 (15.2 KiB)  TX bytes:1466 (1.4 KiB)

That’s it! You should now be good to go. Next, we’ll talk about wireless connections.

Wireless

The wireless module of the TS-7553-V2, the Microchip ATWILC3000, is not only capable of connecting to a wireless access point, but it can also behave as an access point itself (aka master mode). We’ll concentrate on connecting to an access point in this guide. If you’d like to use it as an access point, you’ll want to review the “Host a WIFI Access Point” section of the TS-7553-V2 manual.

We’ll need to repeat the step of creating the interface configuration file like we did in the wired section above. So, create the file /etc/systemd/network/wlan0.network and populate it with the following:

root@ts-imx6ul:~# cat /etc/systemd/network/wlan0.network [Match] Name=wlan0

[Network] DHCP=yes Next, we’ll enable the interface, scan for an access point, and then associate with it. Enabling the wireless interface is a simple command:

ifconfig wlan0 up Then, we’ll want to scan for access points using iw like so:

iw dev wlan0 scan The output can be overwhelming, so you may want to filter out just the essid names using the command:

iw dev wlan0 scan | grep "SSID" Okay, so once you’ve identified an access point you want to connect to, you’ll need to associate with it. Now, there are open access points that don’t require any credentials to associate and there are protected ones using WEP or WPA security types.

Connect to an Open Network

This is the easiest. You’ll be able to simply issue the following command to associate: Home

iw dev wlan0 connect "default" Now, make sure you’ve associated with the access point (you could also use iw dev wlan0 link ):

root@ts-imx6ul:~# iwconfig wlan0
wlan0   IEEE 802.11bgn  ESSID:"default"  
          Mode:Managed  Frequency:2.417 GHz  Access Point: c0:ff:ee:c0:ff:ee  
          Bit Rate=1 Mb/s   Tx-Power=20 dBm  
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality=70/70  Signal level=-34 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Finally, run dhclient wlan0 to get an IP address.

Connecting to a WEP Secured Network

Very similar to ‘Open Access Point’ section above except you’ll need to specify a password:

iw dev wlan0 connect “default” key 0:”yourpassword”

Same as above, follow up with iwconfig wlan0 and dhclient wlan0.

Connecting to a WPA Secured Network

For this, we’re going to use the wpa_passphrase and wpa_supplicant utilities which make life easier. First, we use wpa_passphrase to generate a passphrase configuration file. Replace ‘the_essid‘ and ‘the_password‘ with the essid and password to connect to the access point.

wpa_passphrase the_essid the_password >> /etc/wpa_supplicant/wpa_supplicant-wlan0.conf

You can take a look at this file, but essentially it contains information and a hashed password for the association. Next step is to start the wpa_supplicant service which will run in the background. Create the file /lib/systemd/system/wpa_supplicant@.service with this content:

[Unit]
Description=WPA supplicant daemon (interface-specific version)
Requires=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device

[Service]
Type=simple
ExecStart=/sbin/wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant-%I.conf -i%I

[Install]
Alias=multi-user.target.wants/wpa_supplicant@%i.service

Then, we’re going to enable to service to start on boot:

systemctl enable wpa_supplicant@wlan0

Next, we’ll start the wpa_supplicant service for wlan0:

systemctl start wpa_supplicant@wlan0 systemctl restart systemd-networkd

Finally, same as the other sections above, follow up with dhclient wlan0 . As always, feel free to review the “WIFI Client” section of the TS-7600 manual for more information.

LCD Example Code

TS-7553-V2 with enclosure

There are some very basic LCD demos available and preloaded on the board. For more information, please see the “LCD + Keypad” section of the TS-7553-V2 manual. For the sake of convenience, you can see the “Hello, World!” demo shown in the image above by issuing the following commands:

modprobe ts-st7565p-fb lcd-helper cairo-test

This will draw the “Hello, World!” screen above. If you want to play around with the keypad, issue the command:

keypad-test

Then, you’ll be able to press the keypad buttons and get instant feedback on the LCD screen.

TS-SILO Example Script

TS-SILO capacitors

Quite possibly the neatest feature of the TS-7553-V2 is the TS-SILO on-board backup power solution. TS-SILO provides around 20 seconds of backup power, allowing a custom script to run in the case of a power failure.

A preloaded example script will issue the shutdown -r now command upon power failure to gracefully reboot the system to prevent filesystem corruption. Then, a microcontroller responsible for power management will hold the TS-7553-V2 in a reset state until power is restored or until the TS-SILO completely drains, browning out the whole system. Once power is restored, the system will boot back up again.

Optionally, you can set a variable in the U-Boot environment to pause system startup until TS-SILO reaches a user defined charge percentage. For more information about TS-SILO, see the “SuperCaps” section of the TS-7553-V2 manual. For now, let’s take a look at the script located at /usr/local/bin/tssilomon:

#!/bin/bash
 
# Conservative value to wait for until shutting down
RESET_PCT=90
 
# Set up the power_fail input pin to use sysfs gpio interrupt
echo 128 > /sys/class/gpio/export 2>/dev/null
echo rising > /sys/class/gpio/gpio128/edge
 
while true; do
    gpioctl --waitfor 128
    while eval $(gpioctl --getin 128); [ "$gpio128" -eq "1" ] ; do
        eval $(tsmicroctl -i)
        echo "Supercaps at $supercap_pct"
 
        if [ $supercap_pct -le $RESET_PCT ]; then
            # Code can be added below in order to turn off power-hungry
            # devices, or start other shutdown procedures required.
            # For example:
            # Turn off cell modem:
            #   echo 0 > /sys/class/leds/en-modem-5v/brightness
            #
            # Disable relay:
            #   echo 136 > /sys/class/gpio/export 2>/dev/null
            #   echo low > /sys/class/gpio/gpio136/direction
            #
            # The wall command can be removed if wanted.
 
            wall The script /usr/local/bin/tssilomon has detected main power has been lost!  Shutting down safely to prevent filesystem damage
 
            shutdown -r now
            exit
        else
            sleep .5
        fi
    done
    sleep .5
done

Of course, you can insert your own code here if you’d like. It runs in the background as “TS SuperCap Monitor Daemon” as part of systemd services startup. You can see this by looking at /etc/systemd/system/tssilomon.service:

root@ts-imx6ul:~# cat /etc/systemd/system/tssilomon.service
[Unit]
Description=TS-SILO SuperCap Monitor Daemon

[Service]
Type=simple
ExecStart=/bin/bash /usr/local/bin/tssilomon

[Install]
WantedBy=multi-user.target

Conclusion

In this getting started guide, we took a quick look at how to get everything connected, how to communicate with the board, and how to setup networking. You should be well on your way in developing your application. Once you’ve finished with development and are ready to move into production, be sure to enable TS-SILO charging again and move your application into the eMMC flash storage for extra reliability in the field.