This practical guide gives us an opportunity to take a relaxed approach to getting started with the TS-7600 single board computer paired with the TS-ENC750 enclosure with TS-752 baseboard. We’re going to take a look at how to make our first connections, talk about the Linux environment, 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-7600 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-7600 with a development kit, including the pre-programmed microSD card and TS-ENC750 and TS-752 baseboard. 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-7600. Take note, we are going to use the TS-ENC750 enclosure with TS-752 baseboard which is responsible for bringing out a RS-232 level serial console from the 40-pin header of the TS-7600. In your final product, this enclosure and baseboard might not be necessary, but for early development, it’s a must have.
Pro Tip: Technically, you should also be able to cheat and use something like this FTDI Serial TTL-232 USB Cable, but we can’t fully endorse everything will operate as smoothly for you as the TS-752 will.
There are two jumpers on the TS-752 baseboard that set the board to boot from either the microSD card(s), the TS-7600‘s onboard 8 MB SPI flash, or the TS-752‘s onboard 8 MB SPI flash. Out of the box, they are set to boot from the microSD card(s). If you were to unset JP1, you’d boot to the TS-7600‘s SPI flash. If you were to set JP2, you’d boot to the TS-752‘s SPI flash. We’ll talk more about the bootup environments later in “About the Embedded Linux Environment” section.
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 need a NULL modem cable and a DB9 Serial to USB adapter (and the TS-ENC750 with TS-752 baseboard, as mentioned earlier). Technologic Systems has the NULL modem cable available for sale, as you probably seen when ordering it, but they do not sell a serial to USB adapter. You can get them from many places, and, having learned from experience, it seems that the ones with the Prolific PL2303 chipset are easiest and most compatible, like this one from Amazon.com. If you go this route, you’ll want to be sure to download and install the Prolific PL2303 drivers here. Note, if you’re on a Linux machine you shouldn’t have to install any drivers, as they come preloaded in the Linux kernel, otherwise, for Windows or Mac users, you’ll need to download the drivers. If you need a NULL modem cable, they have them available on Amazon.com, like this one.
Pro Tip: If you’re in the market, another engineer here pointed out this little gem of a USB to serial adapter. With it, you wouldn’t even need the extra NULL modem cable.
Connect the NULL modem cable directly to the RS-232 port on the TS-7600 and the serial to USB adapter. After installing the Prolific PL2303 drivers on your computer (a restart may be required), plugin the serial to USB adapter into your computer. Fire up your favorite serial console program, beit minicom, screen, picocom, PuTTY, etc., and set the serial device to use 115200 baud, 8n1 (8 data bits 1 stop bit), and no flow control. Complete instructions can be found in the “Serial Console” section of the TS-7600 manual. 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.
There are a couple different ways to power the TS-7600. One is with a 5 VDC power regulator, like the PS-5VDC-REG-8PG that comes with the development kit or sold separately. The other is with a A/B USB cable plugged into a computer. For this guide, we’re going to opt for the USB cable for the slight convenience it provides. If you go with the PS-5VDC-REG-8PG, you’ll need to remove the connector already in place directly below the USB ports and plug in the 8-pin adapter connected to the power supply. Whichever option you choose, simply plug one end into the TS-7600 and the other into a computer (for USB) or wall (for power regulator), and you’ll see status LEDs start blinking. If you have your console setup properly, you should see the bootup process pictured below.
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 board via SSH or booting to an NFS filesystem. There is only one Ethernet port on the TS-7600, designated eth0 in Linux. You can read more about it in the “Configuring the Network” section of the TS-7600 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!
USB Wireless Adapter (Optional)
The TS-7600 can be ordered with an optional USB wireless adapter. As of this writing, it’s the TP-LINK TL-WN722N, which uses the Atheros AR9002U chipset. Simply take the cap off and plug it into one of the two USB ports. Once the wireless interface is enabled, which we’ll talk about soon, you’ll see a green status LED light up.
Featuring DoubleStore Solution
The TS-7600 comes with a resilient data storage solution we call DoubleStore. You can think of it as a RAID-like setup using two microSD cards so that if one goes bad, you can recover from the other. Embedded systems are usually installed into power-tricky environments where power can unexpectedly be pulled. Like pulling a rug from underneath your younger sibling, the filesystem on the microSD card can end up in a corrupted state. DoubleStore is a preventative measure for that situation. Take a look at our DoubleStore Whitepaper and Preventing Filesystem Corruption Whitepaper for more information. For development purposes, a single microSD card will suffice. Perhaps, when we’re ready to move into production, a second microSD card can be used to take advantage of DoubleStore.
About the Embedded Linux Environment
Before we explore too much further, we should get the lay of the land. The TS-7600 has two different storage mediums from which to boot from: 1.) the onboard 8 MB SPI flash and 2.) the dual microSD card. Furthermore, there’s another SPI flash on the TS-752 baseboard that you can boot from as well, although it’s mostly just used as a recovery mechanism, see the “Host Board Recovery” section in the TS-752 Manual.
There are two different Linux environments: 1.) a fast-booting (4 seconds) initramfs with Busybox shell, and 2.) a full Debian distribution. The initramfs with Busybox is a minimalistic, ready only environment which can be booted quickly and begin executing your programs. Busybox is known as the “The Swiss Army Knife of Embedded Linux”, and you can accomplish quite a bit here. This is an excellent spot to put production-ready code because of the fast bootup and the read-only nature. For development, the Debian environment, which is pre-installed on the startup drive, is perhaps the easiest to work with, especially for those getting their feet wet in embedded Linux. So, we’re going to boot to the Debian environment on the microSD card, which gives us access to not only a more familiar Linux environment with tools like apt-get and compilers, but also an environment with more storage and debugging tools.
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 Linux development machine and modify files directly.
Furthermore, there are some helpful user space utilities preloaded with the TS-7600 which make it easy to do things like toggle DIO and LEDs called tshwctl (TS Hardware Control). A quick look at the –help menu gives you an idea of what it’s capable of:
root@ts7400-4ce740:~# tshwctl --help Usage: tshwctl [OPTION] ... Technologic Systems TS-76xx/TS-46xx/TS-74xx manipulation. General options: -g, --getmac Display ethernet MAC address -s, --setmac=MAC Set ethernet MAC address -R, --reboot Reboot the board -t, --getrtc Set system time from RTC -S, --setrtc Set RTC time from system -o, --rtcinfo Print RTC info, batt, temp, etc. -v, --nvram Get/Set RTC NVRAM -i, --info Display board info -e, --greenledon Turn green LED on -b, --greenledoff Turn green LED off -c, --redledon Turn red LED on -d, --redledoff Turn red LED off -X, --resetswitchon Enable reset switch -Y, --resetswitchoff Disable reset switch -D, --setdio=<pin> Sets DDR and sets specified pin(s) -O, --clrdio=<pin> Sets DDR and clears specified pin(s) -G, --getdio=<pin> Clears DDR and gets DIO pin(s) input value -W, --watchdog Daemonize and set up /dev/watchdog -q, --cputemp Print CPU internal and external temperature -h, --help This help -M, --timewkup=<time> Time in seconds to wake up after -m, --resetswitchwkup Wake up at reset switch is press -F, --standby Standby CPU, must specify -M|-m to wkup -L, --sleep Sleep CPU, must specify -M|-m to wkup -N, --canon Enable CAN transcievers -f, --canoff Disable CAN transcievers -V, --cpuadc Read and print CPU LRADC values
Default Boot to Debian
Assuming you’ve applied power, setup a serial console, and are now looking at a shell terminal, awaiting our commands, let’s configure the TS-7600 to skip the initramfs and boot directly to Debian. For this, we’ll need to set the soft jumper, JP1 as documented in the “Initramfs” section of the TS-7600 manual. For this, we use the tshwctl command followed by a reboot:
# tshwctl --setjp=1 # reboot
You should now see Debian startup sequence, followed by a login. For this, we’re just going to use ‘root’ as the user name. There is no password by default.
Next, let’s take a look at getting connected to the network and Internet through wired and wireless connections.
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.
First, we need to enable the eth0 network interface by issuing the following command:
root@ts7600-4d2dcf:~# ifconfig eth0 up root@ts7600-4d2dcf:~#
Then, in order to get an IP address, we issue the command:
root@ts7600-4d2dcf:~# dhclient eth0 RTNETLINK answers: File exists root@ts7600-4d2dcf:~#
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.135:
root@ts7600-4d2dcf:~# ifconfig eth0 Link encap:Ethernet HWaddr 00:d0:69:4c:e7:40 inet addr:192.168.1.135 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:21 errors:1 dropped:0 overruns:0 frame:1 TX packets:17 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:6272 (6.1 KiB) TX bytes:3408 (3.3 KiB) Base address:0x8000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:820 errors:0 dropped:0 overruns:0 frame:0 TX packets:820 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:52429 (51.2 KiB) TX bytes:52429 (51.2 KiB) root@ts7600-4d2dcf:~#
Nothing to it! You should now be able to ping an external URL to test your connection:
root@ts7600-4d2dcf:~# ping debian.org PING debian.org (22.214.171.124) 56(84) bytes of data. 64 bytes from busoni.debian.org (126.96.36.199): icmp_req=1 ttl=57 time=26.8 ms 64 bytes from busoni.debian.org (188.8.131.52): icmp_req=2 ttl=57 time=31.9 ms 64 bytes from busoni.debian.org (184.108.40.206): icmp_req=3 ttl=57 time=25.6 ms 64 bytes from busoni.debian.org (220.127.116.11): 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@ts7600-4d2dcf:~#
For this, we’ll edit the /etc/network/interfaces file to read like the following. The highlighted section is what we’re adding. Make sure to modify it to fit your specific network settings.
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or # /usr/share/doc/ifupdown/examples for more information. # We always want the loopback interface. # auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.1.120 netmask 255.255.255.0 gateway 192.168.1.1
The next thing we need is to tell our network interface which DNS nameservers to use, so that we can ping by domain name, like debian.com. For this, we’ll edit /etc/resolv.conf and use the same gateway IP from above as the nameserver. You file should look like something like this:
root@ts7600-4d2dcf:/var/www# cat /etc/resolv.conf nameserver 192.168.1.1
After saving your changes, we simply need to enable the interface and then reload the service responsible for the network interfaces. To do this, we run the commands:
root@ts7600-4d2dcf:~# ifconfig eth0 up root@ts7600-4d2dcf:~# service networking stop root@ts7600-4d2dcf:~# service networking start
Then, you should be able to run ifconfig eth0 and see the settings applied.
root@ts7600-4d2dcf:~# ifconfig eth0 eth0 Link encap:Ethernet HWaddr 00:d0:69:49:6b:63 inet addr:192.168.1.120 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::2d0:69ff:fe49:6b63/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:450 errors:0 dropped:0 overruns:0 frame:0 TX packets:38 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:78249 (76.4 KiB) TX bytes:6932 (6.7 KiB) root@ts7600-4d2dcf:~#
You may want to test your connection at this point. Try pinging your gateway, aka router. You’ll know it’s successfully up and running when you see 0% packet loss in the report.
root@ts7600-4d2dcf:~# ping 192.168.1.1 PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data. 64 bytes from 192.168.1.1: icmp_req=1 ttl=64 time=2.74 ms 64 bytes from 192.168.1.1: icmp_req=2 ttl=64 time=2.94 ms 64 bytes from 192.168.1.1: icmp_req=3 ttl=64 time=3.58 ms 64 bytes from 192.168.1.1: icmp_req=4 ttl=64 time=3.95 ms ^C --- 192.168.1.1 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3002ms rtt min/avg/max/mdev = 2.740/3.304/3.951/0.490 ms root@ts7600-4d2dcf:~#
The USB wireless dongle sold with the TS-7600, the TP-LINK TL-WN722N, uses the Atheros ath9k_htc driver and 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-7600 manual.
Since we’ve already completed the step of creating the interface configuration file in the wired section before this, we’ll just jump right into enabling the interface, scanning for an access point, and then associating 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.
Connecting to an Open Network
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@ts7600-4d2dcf:~# 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 udhcpc -i eth0 to get an IP address.
Connecting to a 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 udhcpc -i wlan0.
Connecting to a 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@ts7600-4d2dcf:~# wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -B Successfully initialized wpa_supplicant root@ts-imx6:~# [ 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 udhcpc -i 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 “WIFI Client” section of the TS-7600 manual for more information.
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, you could replace the TS-752 baseboard with a board of your own design, or not, the TS-752 is a production-ready and handy baseboard as is!
Is there anything else you’d like to see added to this practical getting started guide for the TS-7600? Be sure to comment below, and we’ll get it added!