This practical guide gives us an opportunity to take a relaxed approach to getting started with the TS-7553-V2 single board computer. We’re going to take a look at how to make our first connections, and setup the network. These are usually the first things we do before starting development. In the grand scheme of things, this is just a friendlier extrapolation from the official TS-7553-V2 manual, so be sure to keep it handy for more advanced topics and specific details. The only assumption being made 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. Right then, let’s get started!
Connections and Jumpers
Let’s take a look at the most basic of connections: serial console, power, and Ethernet. Follow along in order and we’ll be ready for the next section when we actually apply power and start using the TS-7553-V2.
Most of these connections are available externally, but you’ll want to unscrew the four screws on the bottom of the enclosure to get to the jumper block, microSD card, and other guts.
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 in their factory settings. Your jumper block should end up looking like the picture above. 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 ‘ol serial console for direct access to an embedded system. Where others like telnet and SSH might fail due to bad startup scripts or network snafus, a direct serial console connection will always be there to bail you out. For this, you’ll simply need an A/B USB cable (included in development kit). No need to deal with NULL modem cables or USB to serial adapters in this case. Just a clean, single cable solution.
It’s recommended that you work from a Linux development machine. Not only are the serial port drivers already installed, but you’ll also need it if you plan on using our cross compile toolchains for a larger project later on. For now, if you’re on a Windows or Mac OSX machine, you can obtain the serial port drivers from the Silicon Labs USB-to-UART drivers page.
Next step is to connect the USB cable to your computer and follow the instructions given in the “Get a Console” section of the TS-7553-V2 manual. This author’s preference is minicom , a no-frills, cross-platform serial communications program. Basically, we’re setting the baud rate to be 115200 with 8N1 parity, no hardware or software flow control. Typically, your serial device name may be:
- Linux, /dev/ttyUSB0
- Mac OSX, /dev/tty.SLAB_USBtoUART
- Windows, use device manager to discover COM port
For reference, here’s a screenshot from Mac OSX using minicom:
As for now, that’s all there is to getting the serial console setup. We’ll actually use the serial console in the next section or after power is applied. Let’s move on to talking about the power connections.
Pro Tip: Running minicom alone will constrain the terminal row and column count to something pretty small that will never take up the whole terminal window. To take advantage of all the real estate your terminal window has to offer, run TERM=linux minicom instead. Remember to setup an alias as a shortcut for yourself!
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. Simply 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 pictured below.
You could also power the TS-7553-V2 using Power over Ethernet (PoE), available with the purchase of a daughter card.
Naturally, we’ll want to be able to connect this to the network so we can 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 “Configuring the Network” section of the TS-7553-V2 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!
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, so this is the easiest step in this guide so far. It will be designated at wlan0 in Linux.
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.
If you recall, we’re going to be setting up our eth0 network interface. For this, we’re going to follow the “Configuring the Network” section of the 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)
Nothing to it! You should now be able to ping an external URL to test your connection:
root@ts-imx6ul:~# ping debian.org PING debian.org (126.96.36.199) 56(84) bytes of data. 64 bytes from busoni.debian.org (188.8.131.52): icmp_req=1 ttl=57 time=26.8 ms 64 bytes from busoni.debian.org (184.108.40.206): icmp_req=2 ttl=57 time=31.9 ms 64 bytes from busoni.debian.org (220.127.116.11): icmp_req=3 ttl=57 time=25.6 ms 64 bytes from busoni.debian.org (18.104.22.168): 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 ?└?─354 /lib/systemd/systemd-resolved Jun 15 17:20:49 ts-imx6ul systemd: 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.
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.
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 before this. 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:
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
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:
Then, you’ll be able to press the keypad buttons and get instant feedback on the LCD screen.
TS-SILO Example Script
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
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.
Is there anything else you’d like to see added to this practical getting started guide for the TS-7553-V2? Be sure to comment below, and we’ll get it added!
- None Found