Practical Guide to Getting Started with the TS-7800-V2

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.

Jumpers

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.

Serial Console

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):


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 <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.

Power

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.

Ethernet

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.

Setup Networking

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

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:

Then, in order to get an IP address, we issue the command:

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:

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

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.

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.

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

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.

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

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.

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

Wireless Networking

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:

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

Then, we’ll want to scan for access points using iwlist like so:

The output can be overwhelming, so you may want to filter out just the ESSID names using the command:

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:

Now, make sure you’ve associated with the access point:

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.

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.

You should see output similar to this:

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.

As always, feel free to review the “Debian Wireless Client” section of the TS-7800-V2 manual for more information.

Setup Bluetooth

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.

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, 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!

Author: Derek Hildreth

eBusiness Manager for Technologic Systems