Practical Guide to Getting Started with the TS-4100

 

This practical guide gives us an opportunity to take a relaxed approach to getting started with the TS-4100 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-4100 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-4100 with a development kit, including the pre-programmed microSD card and TS-8551 reference board. Right then, let’s get started!

Connections and Jumpers

Let’s get our TS-4100 hooked up with our TS-8551! This includes our very basic connections we’ll need for most any development or project: power, serial console, Ethernet, and WiFi.

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

Jumpers

Out of the box, the TS-4100-8551 has its jumpers set to 1.) boot from the onboard eMMC flash, 2.) drop you to a U-Boot shell, and 3.) charge the TS-SILO supercaps. Certainly, it depends on your preferences when it comes to setup for development, but we’re going to go with the jumper configuration you see in the image above. That is, we will 1.) boot to the SD card, 2.) skip U-Boot shell and boot straight into the Debian environment, and 3.) not charge the TS-SILO supercaps so we can disconnect power without needing to wait for them to discharge (20 – 60 seconds). Later in this guide, we’ll re-enable TS-SILO supercaps charging so we can test their capabilities.

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-4100-8551 offers two port choices when it comes to serial console connections: USB serial on the TS-4100 and DB-9 on the TS-8551. 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.

The image above shows the TS-4100 serial port connection without the TS-8551 reference board. While this is entirely okay to do, just note that for now, we should be connected to the reference board.

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

Then, you’ll simply login using the username ‘root’ without any password.

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

Power

The TS-8551 has both variable input voltage of between 8 to 28 VDC and fixed input voltage of 5 VDC. We’ll be using the 12 VDC power supply that comes with the development kit (Part# PS-12VDC-REG-2_5AMP-3PB). The boot process will begin immediately once you plugin the power supply and flip the large “Power” switch on the TS-8551 (switch toggled up). If you have a serial console program up and running, you’ll see the boot messages displayed on the console.

As shown in the image above, you’ll need to remove the pre-populated power connector, then flip the switch, as shown below.

There will be a green and red status LEDs lit on the TS-8551. If you’ve been following along and completed the serial console steps, you should also see bootup messages.

One of the appealing things about the TS-4100 is the fact that it can run by itself without the need for a baseboard. This essentially gives you a very small computer on module. There are limitations, like the lack of connectors, but it’s a powerful concept for some applications. Anyways, if you’re looking at running the TS-4100 without the TS-8551 board, you’ll be powering the system using a micro USB cable (5 VDC) plugged into the USB port marked P1, as shown in the image below.

Ethernet

Undoubtedly, you’ll want to connect the TS-4100 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 first thing to note is the TS-4100 comes with two 10/100 Ethernet connections. The primary, designated as eth0, is located next to the vertical USB connector. The secondary, designated as eth1, will be populated to the next to the primary. 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.

About the Embedded Linux Environments

The TS-4100 has the ability to boot to several different OSs and environments via U-Boot, a general purpose bootloader residing in the boot partitions of the on-board eMMC. You can find out more about the U-Boot environment by taking a look at the “U-Boot Environment” section of the TS-4100 manual. Currently, the supported OS image is Debian Linux, running the 3.14 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.

The onboard eMMC flash can be configured in two ways: 4 GB MLC for maximum capacity, and 2 GB pSLC (pseudo-SLC) for maximum data reliability. The images all weigh in at about 1.2 GB (or less), so while you could use either option, you may be uncomfortable with space restrictions with 2 GB pSLC.

Pro Tip: We’ve taken a hint from the eMMC flash manufacturer and called it pseudo SLC, or pSLC because it ships as MLC and SLC-like operation can be performed by running a command, which blows a fuse on the chip, making it behave like SLC flash.

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

Setup Networking

If you recall, we’re going to be setting up our eth1 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-4100 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-4100, 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-4100 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-4100 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-4100 manual you can refer to in order to get a taste of how it works.

TS-SILO Example Script

Quite possibly the neatest feature of the TS-4100-8551 is the TS-SILO on-board backup power solution. TS-SILO provides up to a minute of backup power (depending), allowing a custom script to run in the case of a power failure. Out of the box, the TS-4100-8551 will issue the shutdown -r now command to gracefully reboot the system. It will only startup again if the capacitor charge is greater than a certain number as defined in the U-Boot environment, 60% by default. For more information about TS-SILO, see the “SuperCaps” section of the TS-7680 manual (yes, the TS-7680 for now, while the TS-8551 manual is being developed). For now, let’s take a look at the script located at /usr/local/bin/tssilomon:

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

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!

Is there anything else you’d like to see added to this practical getting started guide for the TS-4100? Be sure to comment below, and we’ll get it added!

Author: Derek Hildreth

eBusiness Manager for Technologic Systems