This practical guide gives us an opportunity to take a relaxed approach to getting started with the TS-7800-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-7800-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-7800-V2 with a development kit, including the pre-programmed microSD card and necessary cables.
For you TS-7800 users upgrading to the TS-7800-V2, you’re in for a treat. There’s a migration guide specifically created to help you with some of the nuances in upgrading. For this, take a look at the “Migration Path” section of the TS-7800-V2 Manual.
When you’ve finished, be sure take a look at PWM Primer with the TS-7800-V2. Good stuff there about working with dimming LEDs and controlling servo motors.
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-7800-V2.
Out of the box, the TS-7800-V2 has it’s jumpers set to 1.) boot from the microSD card, 2.) enable serial console, and 3.) skip the U-Boot shell and boot straight into the Debian environment. This is great for development, so we’ll keep them that way.
A good ‘ol serial console provides a reliable and consistent connection to the single board computer. Other methods like SSH or Telnet are nice too, but a serial console isn’t prone to failure because of botched startup scripts or network snafus.
The TS-7800-V2 offers two port choices when it comes to serial console connections: USB and DB-9. It’s up to you which to choose, just don’t attempt to use both at once (undefined behavior). If you go the DB-9 route, you’ll need a null modem cable and possibly a Serial to USB adapter since computers don’t usually come with serial ports anymore. This author’s preference is to use the USB port to get a console, so that’s what we’ll cover in detail.
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 Silabs USB-to-UART drivers page.
Next step is to connect the micro USB cable to your computer and follow the instructions given in the “Get a Console” section of the TS-7800-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, 8N1, 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
After setting some jumpers and applying power, which we’ll talk about both next, you’ll see something similar to the screenshot below (Mac OSX Terminal running minicom):
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
<span class="lang:sh highlight:0 decode:true crayon-inline">TERM=linux minicom</span> instead. Remember to setup an alias as a shortcut for yourself!
Pro Tip: If you’d like to use SSH after setting up your network connection, you’ll need to set a password. Run passwd to create a password followed by dpkg-reconfigure openssh-server . Also, refer to the “Setting up SSH” section of the TS-7800-V2 manual.
The TS-7800-V2 has both variable input voltage of between 8 to 28 VDC from the TS-781 (TS-ENC720-7260 enclosure) pictured below and fixed input voltage of 5 VDC on the TS-7800-V2 itself pictured above. We’ll be using the 5 VDC power supply that comes with the development kit (Part# PS-5VDC-REG-2P1). The bootup process will begin immediately once you plugin the power supply. If you have a serial console program up and running, you’ll see the boot messages displayed on the console.
Undoubtedly, you’ll want to connect the TS-7800-V2 to a network for SSH access, or NFS booting, or communicating with other systems, or downloading new programs, or countless other number of reasons. The TS-7800-V2 comes with one Gigabit Ethernet connection, designated as eth0 in Linux. Plug in a standard Ethernet cable connected to your router or switch, and continue reading for further instructions on setup. Of course, you could go wireless as well, but for development, a good ‘ol solid Ethernet connection eliminates a lot of guesswork and headache.
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.
About the Embedded Linux Environments
The TS-7800-V2 has the ability to boot to several different OSs and environments via U-Boot, a general purpose bootloader sitting on the small, 16MB eMMC hardware boot partition. You can find out more about the U-Boot environment by taking a look at the “U-Boot Environment” section of the TS-7800-V2 manual. Currently, the supported OS image is Debian Linux, running the 4.4.8 kernel, which is preloaded onto the onboard eMMC flash and microSD card (sold as a separate option, included in development kit).
Pro Tip: For development, best practice is to boot to microSD card for ease of recovery should something go wrong. Just plug the microSD card into a development machine and modify files directly.
Otherwise, the flash and microSD card contain two partitions, a small one where U-Boot is located and the larger one where the filesystem and kernel are located. U-Boot understands how to load the kernel, device tree, and boot arguments and run the OS from the one partition. More information about U-Boot startup sequence can be found in the “U-Boot” section of the TS-7800-V2 manual.
Pro Tip: If you’d like to run your application automatically upon boot, which is a very common request, take a look at the “Starting Automatically” section of the TS-7800-V2 manual.
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.
Out of the box, the TS-7800-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@ts7800-v2:~# ifconfig eth0 up root@ts7800-v2:~#
Then, in order to get an IP address, we issue the command:
root@ts7800-v2:~# dhclient eth0 root@ts7800-v2:~#
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.107:
root@ts7800-v2:~# ifconfig eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.107 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::604b:30ff:fe78:603b prefixlen 64 scopeid 0x20<link> ether 00:d0:69:4e:f2:e9 txqueuelen 532 (Ethernet) RX packets 21 bytes 4765 (4.6 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 14 bytes 1626 (1.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 36 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1 (Local Loopback) RX packets 1 bytes 112 (112.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1 bytes 112 (112.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 root@ts7800-v2:~#
Nothing to it! You should now be able to ping an external URL to test your connection:
root@ts7800-v2:~# ping debian.org PING debian.org (220.127.116.11) 56(84) bytes of data. 64 bytes from senfter.debian.org (18.104.22.168): icmp_seq=1 ttl=44 time=137 ms 64 bytes from senfter.debian.org (22.214.171.124): icmp_seq=2 ttl=44 time=137 ms 64 bytes from senfter.debian.org (126.96.36.199): icmp_seq=3 ttl=44 time=135 ms 64 bytes from senfter.debian.org (188.8.131.52): icmp_seq=4 ttl=44 time=134 ms ^C --- debian.org ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3000ms rtt min/avg/max/mdev = 134.756/136.319/137.636/1.293 ms root@ts7800-v2:~#
Next time we boot 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@ts7800-v2:~# cat /etc/systemd/network/eth.network [Match] Name=eth* [Network] DHCP=yes
Pro Tip: If the file doesn’t exist, go ahead and create it with the content you see above. This will automatically setup your network interface next time the board is powered on.
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@ts7800-v2:~# 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 ts7800-v2 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@ts7800-v2:~# 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@ts7800-v2:~# 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@ts7800-v2:~# 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-7800-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-7800-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 iwlist like so:
iwlist wlan0 scan
The output can be overwhelming, so you may want to filter out just the ESSID names using the command:
iwlist wlan0 scan | grep ESSID | cut -d':' -f2
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.
Open Access Point
This is the easiest. You’ll be able to simply issue the following command to associate:
iwconfig wlan0 essid "default"
Now, make sure you’ve associated with the access point:
root@ts7800-v2:~# 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 eth0 to get an IP address.
WEP Protected Access Point
Very similar to ‘Open Access Point’ section above except you’ll need to specify a password:
iwconfig wlan0 essid “default” key “yourpassword”
Same as above, follow up with iwconfig wlan0 and dhclient wlan0.
WPA Protected Access Point
For this, we’re going to use the wpa_passphrase and wpa_supplicant utilities which make life easier. First, create the /etc/wpa_supplicant/ directory and generate a passphrase configuration file. Replace ‘the_essid’ and ‘the_password’ with the ESSID and password to connect to the access point.
mkdir /etc/wpa_supplicant/ 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 daemon which will run in the background.
wpa_supplicant -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant-wlan0.conf -B
You should see output similar to this:
root@ts7800-v2:~# wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -B Successfully initialized wpa_supplicant root@ts7800-v2:~# [ 306.924691] wlan0: authenticate with 28:cf:da:b0:f5:bb [ 306.959415] wlan0: send auth to 28:cf:da:b0:f5:bb (try 1/3) [ 306.968137] wlan0: authenticated [ 306.978477] wlan0: associate with 28:cf:da:b0:f5:bb (try 1/3) [ 306.988577] wlan0: RX AssocResp from 28:cf:da:b0:f5:bb (capab=0x1431 status=0 aid=9) [ 307.009751] wlan0: associated [ 307.012768] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready [ 307.047989] wlcore: Association completed.
Then, same as the other sections above, follow up with iwconfig wlan0 and dhclient wlan0.
Finally, if you want your connection to be there when you reboot, you’ll need to configure systemctl to automatically set everything for you.
systemctl enable wpa_supplicant@wlan0 systemctl start wpa_supplicant@wlan0
As always, feel free to review the “Debian Wireless Client” section of the TS-7800-V2 manual for more information.
For this, you’ll be using Bluez, the official Linux bluetooth protocol stack. There’s not much you need to do for setup, but there are some commands you’ll want to become familiar with such as hcitool and hciconfig. There is plenty of documentation and guides available online for this, so we won’t go into any detail on it here. We also have a small “Bluetooth” section of the TS-7800-V2 manual you can refer to in order to get a taste of how it works.
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, so go build something amazing!
Pro Tip: Once you’ve finished with development and are ready to move into production, be sure to move your application into the eMMC flash storage for extra reliability in the field. Also, invest in the rugged metal enclosure to protect it from the elements.
Is there anything else you’d like to see added to this practical getting started guide for the TS-7800-V2? Be sure to comment below, and we’ll get it added!
- None Found