This practical guide gives us an opportunity to take a relaxed approach to getting started with the TS-7670 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-7670 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-7670 with a development kit, including the pre-programmed microSD card. Right then, let’s get started! Home
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-7670.
If you have the enclosure, you’ll notice all 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.
Jumpers
Out of the box, the TS-7670 has it’s jumpers set to boot from the onboard eMMC flash (JP2 is a user jumper hooked up to a DIO and TERM enables a RS-485 termination resistor). 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 boot to the SD card. This is generally easier to develop from, as files can be easily restored or altered from a development computer if something should go wrong.
Serial Console
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-7670 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!
Power
The TS-7670 has variable input voltage of between 8 to 28 VDC. We’ll be using the 12 VDC power supply that comes with the development kit. The TS-7670 takes up about 1 W at idle, but could be as high as 1.3 W depending on peripherals connected.
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. Home
[gfycat data_id="ZigzagSpicyBluebreastedkookaburra"]Ethernet
Undoubtedly, you’ll want to connect the TS-7670 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-7670 comes with a single 10/100 Ethernet connection, designated as eth0. Plug in a standard Ethernet cable connected to your router or switch, and continue reading for further instructions on setup.
About the Embedded Linux Environments
There are two sources from which to boot on the TS-7670: the onboard 2 GB eMMC flash and microSD card (sold as a separate option, included in development kit). Each of these boot sources, or boot drives, contain two Linux environments: 1.) fastboot, which boots to a minimalistic initial ramdisk using busybox shell in about 3 seconds, and 2.) a full Debian distribution, which is more familiar to most Linux users, which boots in about 45 seconds. More on both of these in the next section. We’ll be working in the Debian environment for this guide.
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-7670 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:
# 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= Sets DDR and sets specified pin(s) -O, --clrdio= Sets DDR and clears specified pin(s) -G, --getdio= 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=
For example, issuing the command tshwctl –redledon will turn on the red LED next to the Ethernet port.
Default Boot to Debian
[gfycat data_id="BeneficialEcstaticAsiaticmouflon"]At this point, we should be looking at a shell terminal, awaiting our commands. This shell is what we call an initial RAM disk, or initrd, with a Busybox shell. It’s a minimalistic, read-only environment which can be booted quickly (3.13 seconds) 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, 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. We could type the command exit to begin booting to Debian, but we don’t want to do this every time. Instead, we’ll simply remove the file /ts/fastboot to boot to Debian by default as documented in the “Initramfs” section of the manual. 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.
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-7670 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-7670 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
First, we need to enable the eth0 network interface by issuing the following command: Home
root@ts7670-4dffdf:~# ifconfig eth0 up root@ts7670-4dffdf:~#
Then, in order to get an IP address, we issue the command:
root@ts7670-4dffdf:~# dhclient eth0 root@ts7670-4dffdf:~#
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@ts7670-4dffdf:~# 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@ts7670-4dffdf:~#
Nothing to it! You should now be able to ping an external URL to test your connection:
root@ts7670-4dffdf:~# ping debian.org PING debian.org (140.211.15.34) 56(84) bytes of data. 64 bytes from busoni.debian.org (140.211.15.34): icmp_req=1 ttl=57 time=26.8 ms 64 bytes from busoni.debian.org (140.211.15.34): icmp_req=2 ttl=57 time=31.9 ms 64 bytes from busoni.debian.org (140.211.15.34): icmp_req=3 ttl=57 time=25.6 ms 64 bytes from busoni.debian.org (140.211.15.34): 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@ts7670-4dffdf:~#
Static IP
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@ts7670-4dffdf:/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@ts7670-4dffdf:~# ifconfig eth0 up root@ts7670-4dffdf:~# service networking stop root@ts7670-4dffdf:~# service networking start
Then, you should be able to run ifconfig eth0 and see the settings applied.
root@ts7670-4dffdf:~# 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@ts7670-4dffdf:~#
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@ts7670-4dffdf:~# 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@ts7670-4dffdf:~#
GPS
GPS is one of the differentiating features of the TS-7970, and is essential for things like asset tracking. If you’re interested in getting GPS up and running, be sure to check out the separate guide, Getting Started with GPS on the TS-7670.
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! Home
Is there anything else you’d like to see added to this practical getting started guide for the TS-7670? Be sure to comment below, and we’ll get it added!