TS-7820

From embeddedTS Manuals
WARNING: This product is in the Engineering Sampling program. This means the documentation and product itself may change several times before the product is deemed ready for large quantity orders. Please force-refresh (shift-f5 on most browsers) to clear your cache when visiting this page to ensure you are viewing the most recent version of this documentation. Of course also please check back often as this information is subject to change.
Features still in development
Documentation still under development
Ethernet switch TCAM support
FPGA GPIO IRQs
GPS PPS
FPGA Reloading
FRAM
LCD
1MS/s ADC (ADS7041)
DAC (08S085)
HART
CAN
MicroSD
DIO on HD2
Supercaps
Production mechanism through USB for mass programming boards.
Known Hardware Issues
LTC2325 ADC Channels 3/4 cannot be used in both AC/DC mode.
Ethernet LEDs will swap left/right on REV A hardware
TS-7820
ts-7820.gif
Product Page
Product Images
Specifications
Documentation
TS-7820 Files
Processor
Marvell MV88F6820
Armada 385 ARM Cortex-A9 1.3 GHz Dual Core CPU


Overview

The TS-7820 is a Single Board Computer (SBC) based on a Marvell MV88F6820 1.3GHz Cortex-A9 (ARMv7 architecture) Dual Core CPU. The CPU features a set of high-end peripherals such as 3x 10/100/1000 Ethernet, mPCIe, mSATA, dual USB 3.0, eMMC for onboard storage, and more. This board also connects one of the 10/100/1000 ports to a 5 port switch providing a total of 6 RJ45 ports. One of the 10/100/1000 ports is also available as an SFP for long distance runs. This device features WIFI, Bluetooth, fast onboard ADC, GPS, an FPGA allowing more DIO, UARTs, and more.

Getting Started

A Linux PC is recommended for development, and will be assumed for this documentation. For users in Windows or OSX we recommend virtualizing a Linux PC. Most of our platforms run Debian and if there is no personal distribution preference this is what we recommend for ease of use.

Virtualization

Suggested Linux Distributions

It may be possible to develop using a Windows or OSX system, but this is not supported. Development will include accessing drives formatted for Linux and often Linux based tools.

Getting Console and Powering up

WARNING: Be sure to take appropriate Electrostatic Discharge (ESD) precautions. Disconnect the power source before moving, cabling, or performing any set up procedures. Inappropriate handling may cause damage to the device.

Get console input by plugging a USB type B cable into the USB device header (CN7). Connect the host side of the cable to a workstation for development. Console can be connected before or after main power to the board. To see all boot messages console should be connected before power.

On Linux workstations the cp210x (USB Serial) driver will typically work out of the box on most distributions. This will show up as /dev/ttyUSB0. For other operating systems:

The serial console is provided through this port at 115200 baud, 8n1, with no flow control. Picocom is the recommended linux client to use which can be run with the following command:

sudo picocom -b 115200 /dev/ttyUSB0

This will output some serial setting information and then "Terminal ready". Any messages after this point will be from the device via the serial output. The terminal is now ready and power can be applied in order to boot up the device. Power is applied through the removable terminal block. This accepts 5 VDC, or 8-28 VDC input, only a single power input can be connected at any time.

A typical power supply should be prepared to provide up to 15W. The devices's power consumption will average around 3 W on an idle quad core. See the #Specifications section for further details on power requirements.

File:TS-7820 terminal block power connectors.png

For 5 V in, connect pin the middle pin to a 5 VDC source, the right pin to GND, and the V+ pin disconnected. For 8-28 V in, connect the left pin (V+) to the voltage source and the right pin to ground leaving the middle pin disconnected. See the terminal blocks section for more information on this header.

Once power is applied to either the 5 VDC, or 8-28 VDC the device will output information via the console. The first output is from U-Boot:

U-Boot SPL 2017.09-gd51137b8bd (Oct 09 2018 - 08:32:47)
Detected Device ID 6820 (SAR1 0xCB00030F)
mv_ddr: mv_ddr-armada-17.10.3-gd51137b8bd (Oct 09 2018 - 08:33:03)
DDR3 Training Sequence - Switching XBAR Window to FastPath Window
DDR Training Sequence - Start scrubbing
DDR3 Training Sequence - End scrubbing
mv_ddr: completed successfully
Trying to boot from MMC1


U-Boot 2017.09-gd51137b8bd (Oct 09 2018 - 08:32:47 -0700)

SoC:   MV88F6820-A0 at 666 MHz
I2C:   ready
DRAM:  1 GiB (333 MHz, ECC enabled)
MMC:   mv_sdh: 0
*** Warning - bad CRC, using default environment

PCI:
  00:01.0     - 1172:0004 - Does not fit any class
Model: Technologic Systems TS-7820
FPGA Revision: 0
SCSI:  MVEBU SATA INIT
SATA link 0 timeout.
SATA link 1 timeout.
AHCI 0001.0000 32 slots 2 ports 6 Gbps 0x3 impl SATA mode
flags: 64bit ncq led only pmp fbss pio slum part sxs 
Net:   eth2: ethernet@30000, eth3: ethernet@34000, eth1: ethernet@70000
Press ESC twice to abort autoboot in 3 second(s)

Boot will continue unless "Esc" is pressed twice. By default u-boot will attempt to boot on these devices:

Boot order Device Description
1 usb0 Load OS from first USB storage media.
2 scsi0 Load OS from first SATA device
3 mmc0 Load OS from eMMC media
4 dhcp DHCP can advertise a TFTP server (root-path, and filename), and u-boot will load the file and source it. This can be used to launch a network script.
5 pxe If the file TFTP points at is not a valid u-boot format (mkimage), then it will attempt to load it like a PXE binary.

Typically the unit as we ship will not have USB or SATA connected, and will boot to a preprogrammed Debian image on eMMC.

Note: The startup message "*** Warning - bad CRC, using default environment" is safe to ignore. This indicates that u-boot scripts are not being customized. Typing "env save" will hide these messages, but this is not needed.

The TS-7820 follows u-boots default "distro" boot command. U-boot will step through each boot device and first look for partitions marked "bootable". If no partition is marked bootable through a GPT partition flag, it will default to the first partition. It will then search all bootable partitions for an extlinux configuration file at /extlinux/extlinux.conf. If that is not found, it will search for a /boot/boot.scr.uimg or /boot/boot.scr. If that is not found, it will attempt to load an EFI binary at efi/boot/bootarm.efi. If none of these methods succeed, it will proceed to the next boot device.

See U-Boot's documentation on the distro boot for more details.

Our default Debian images are written with a single GPT partition which is not marked bootable, but is the only partition. We ship Debian by default which does not support 32-bit ARM EFI, or extlinux configuration files. Our images use the /boot/boot.scr script which is generated by the debian package "flash-kernel". Our images can be written to USB, SATA, or eMMC and work without device specific modification.

U-Boot Environment

The U-Boot environment on the TS-7820 is stored in the on-board eMMC flash.

# Print all environment variables
env print -a

# Sets the variable bootdelay to 5 seconds
env set bootdelay 5;

# Variables can also contain commands
env set hellocmd 'led red on; echo Hello world; led green on;'

# Execute commands saved in a variable
env run hellocmd;

# Commit env changes to the spi flash
# Otherwise changes are lost
env save

# Remove a variable
env delete hellocmd

# Restore env to default
env default -a

U-Boot Commands

# The most important command is 
help
# This can also be used to see more information on a specific command
help i2c

# Boots into the compressed binary at $loadaddr.  
bootz
# Boots into the compressed binary at $loadaddr, specifies the fdtaddr 
# so Linux knows where to find the board device-tree
bootz ${loadaddr} - ${fdtaddr}

# Get a DHCP address
dhcp
# This sets ${ipaddr}, ${dnsip}, ${gatewayip}, ${netmask}
# and ${ip_dyn} which can be used to check if the dhcp was successful

# These commands are used for scripting:
false # do nothing, unsuccessfully
true # do nothing, successfully

# This command is used to copy a file from most devices
# Load kernel from SD
load mmc 1:2 ${loadaddr} /boot/zImage
# Load Kernel from eMMC
load mmc 0:2 ${loadaddr} /boot/zImage

# You can view the fdt from u-boot with fdt
ext4load mmc 0:2 $fdtaddr /boot/armada-38x.dtb
fdt addr ${fdtaddr}
fdt print

# You can blindly jump into any memory
# This is similar to bootm, but it does not use the 
# u-boot header
ext4load mmc 0:2 ${loadaddr} /boot/custombinary
go ${loadaddr}

# Browse fat, ext2, ext3, or ext4 filesystems:
ls mmc 0:1 /

# Access memory like devmem in Linux, you can read/write arbitrary memory
# using mw and md
# write
mw 0x10000000 0xc0ffee00 1
# read
md 0x10000000 1

# Test memory.
mtest

# Check for new SD card
mmc rescan
# Read SD card size
mmc dev 1
mmcinfo
# Read eMMC Size
mmc dev 0
mmcinfo

# The NFS command is like 'load', but used over the network
dhcp
env set serverip 192.168.0.11
nfs ${loadaddr} 192.168.0.11:/path/to/somefile

# Test ICMP
dhcp
ping 192.168.0.11

# Reboot
reset

# Delay in seconds
sleep 10

# You can load HUSH scripts that have been created with mkimage
load mmc 0:1 ${scriptaddr} /boot/ubootscript
source ${scriptaddr}

# Most commands have return values that can be used to test
# success, and HUSH scripting supports comparisons like
# test in Bash, but much more minimal
if load mmc 0:1 ${loadaddr} /boot/uImage;
	then echo Loaded Kernel
else
	echo Could not find kernel
fi

# Commands can be timed with "time"
time bdinfo

# Print U-boot version/build information
version

Change U-Boot boot order

U-boot by default will boot to usb0, scsi0, mmc0, dhcp, and finally pxe. If an application will not use usb0 or SATA for booting, these can be disabled only allowing boot directly to emmc.

# Only boot to emmc:
env set boot_targets mmc0
env save

# Boot to USB then eMMC:
env set boot_targets usb0 mmc0
env save

# Boot only to SATA
env set boot_targets scsi0
env save


Backup / Restore

Backup

If your image as a single filesystem like our example images, the simplest way to take a backup can be a tar of the filesystem. If your boot media is SD/USB, this could be mounted from a Linux workstation. If you are backing up eMMC, boot to USB/SD/Network/SATA. Attempting to back up a booted filesystem is not reliable and may end up with corrupt files.

Mount your media at /mnt/media. This example will use mmcblk0p1 for eMMC, but this will work for any partition on a block device.

sudo mkdir /mnt/media
sudo mount /dev/mmcblk0p1 /mnt/media
cd /mnt/media

## This is optional but you can generate a "md5sums.txt" which can
## be used to validate an image after writing.
sudo rm ./md5sums.txt
sudo bash -c "find . -type f -print0 | xargs -0 md5sum >> md5sums.txt"

# Create a backup
sudo tar cJf /path/to/emmc-backup.tar.xz
sudo umount /mnt/media

If an image is multiple filesystems, this may make sense to instead use "dd" to write the images. These are typically larger since the image will also contain the free space, but will include a byte for byte copy. In the same example of the mmcblk0 above:

sudo dd if=/dev/mmcblk0 bs=1M | xz > /path/to/emmc-backup.dd.xz

Restore an image

Our images are provided as a single tar image containing the contents of the first, and only partition. These images can be written to emmc, SD, SATA, or USB. This example will assume your block device is /dev/sdc, but check lsblk or dmesg to be sure.

sudo sgdisk --zap-all /dev/sdc
# Create one single Linux partition
sudo sgdisk -n 0:0:0 -t 0:8300 /dev/sdc
# Create a filesystem
sudo mkfs.ext4 /dev/sdc1
sudo mkdir /mnt/media
sudo mount /dev/sdc1 /mnt/media
sudo tar -xf /path/to/ts7820-debian-stretch-latest.tar.xz -C /mnt/media/
sudo umount /mnt/media/

Our images also contain an md5sum file which can be used to validate the image. This will only work if the boot media has not been booted. During Linux's boot it will modify files, so the md5sum will fail. This can however be used to validate an image is correct before booting it on the unit. After the media has been written, removed from the workstation and unmounted, plug it back in:

sudo mount -o ro /dev/sdc1 /mnt/media
cd /mnt/media
# Verify all of the files
# If this succeeds it will have no output, but
# failures will indicate if any files do not match
sudo md5sum -c md5sums.txt --quiet
sudo umount /mnt/media/

Sources

Debian

Debian is a community run Linux distribution. Debian provides tens of thousands of precompiled applications and services. This distribution is known for stability and large community providing support and documentation. The installation is specific to our board, but most Debian documentation applies:

Debian Stretch

The latest Debian stretch image can be downloaded here:

This file is a symlink to the latest image. The image date can be checked by reading /root.version in the image. All images can be found here.

To prepare a USB, SD, or SATA drive for booting the TS-7820, the same steps can be used. Download the image above, then connect the boot media to your Linux workstation and run these commands:

# Identify your media
# dmesg
# lsblk
# This example will be for /dev/sdc

# Wipe existing partitions
sudo sgdisk --zap-all /dev/sdc
# Create one single Linux partition
sudo sgdisk -n 0:0:0 -t 0:8300 /dev/sdc
# Create a filesystem
sudo mkfs.ext4 /dev/sdc1
sudo mkdir /mnt/media
sudo mount /dev/sdc1 /mnt/media
sudo tar -xf /path/to/ts7820-debian-stretch-latest.tar.xz -C /mnt/media/
sudo umount /mnt/media/
Note: On some USB devices this may show up as /dev/mmcblk# or /dev/sdX. If it is /dev/mmcblk#, note that your first partition will be /dev/mmcblk#p1 and not mmcblk#1.

Our images also contain an md5sum file which can be used to validate the image. This will only work if the boot media has not been booted. During Linux's boot it will modify files, so the md5sum will fail. This can however be used to validate an image is correct before booting it on the unit. After the media has been written, removed from the workstation and unmounted, plug it back in:

sudo mount -o ro /dev/sdc1 /mnt/media
cd /mnt/media
# Verify all of the files
# If this succeeds it will have no output, but
# failures will indicate if any files do not match
sudo md5sum -c md5sums.txt --quiet
sudo umount /mnt/media/

To write this image to the eMMC, boot the board to USB, SD, or SATA and perform these same steps from the unit.

Debian Networking

Debian can automatically set up the networking based on the contents of "/etc/network/interfaces.d/" files. For example, to enable DHCP for "eth0" by default on startup:

echo "auto eth0
iface eth0 inet dhcp" > /etc/network/interfaces.d/eth0

To set up a static IP:

echo "auto eth0
iface eth0 inet static
    address 192.168.0.50
    netmask 255.255.255.0
    gateway 192.168.0.1" > /etc/network/interfaces.d/eth0
echo "nameserver 1.1.1.1" > /etc/resolv.conf

To make this take effect immediately for either option:

service networking restart

To configure other interfaces, replace "eth0" with the other network device name. Some interfaces may use predictable interface names. For example, the traditional name for an ethernet port might be "eth1", but some devices may use "enp1s0" for PCIe, or "enx00D069C0FFEE" (the MAC address appended) for USB ethernet interfaces. Run 'ifconfig -a' or 'ip a' to get a complete list of interfaces, including the ones that are not configured.

Debian WIFI Client

Wireless interfaces are also managed with configuration files in "/etc/network/interfaces.d/". For example, to connect as a client to a WPA network with DHCP. Note some or all of this software may already be installed on the target SBC.

Install wpa_supplicant:

apt-get update && apt-get install wpasupplicant -y

Run:

wpa_passphrase youressid yourpassword

This command will output information similar to:

 network={
 	ssid="youressid"
 	#psk="yourpassword"
 	psk=151790fab3bf3a1751a269618491b54984e192aa19319fc667397d45ec8dee5b
 }

Use the hashed PSK in the specific network interfaces file for added security. Create the file:

/etc/network/interfaces.d/wlan0

allow-hotplug wlan0
iface wlan0 inet dhcp
    wpa-ssid youressid
    wpa-psk 151790fab3bf3a1751a269618491b54984e192aa19319fc667397d45ec8dee5b

To have this take effect immediately:

service networking restart

For more information on configuring Wi-Fi, see Debian's guide here.

Debian WIFI Access Point

First, hostapd needs to be installed in order to manage the access point on the device:

apt-get update && apt-get install hostapd -y


Note: The install process will start an unconfigured hostapd process. This process must be killed and restarted before a new hostapd.conf will take effect.

Edit /etc/hostapd/hostapd.conf to include the following lines:

interface=wlan0
driver=nl80211
ssid=YourAPName
channel=1
Note: Refer to the kernel's hostapd documentation for more wireless configuration options.


To start the access point launch hostapd:

hostapd /etc/hostapd/hostapd.conf &

This will start up an access point that can be detected by WIFI clients. A DHCP server will likely be desired to assign IP addresses. Refer to Debian's documentation for more details on DHCP configuration.

Debian Application Development

Debian Stretch Cross Compiling

Debian Stretch provides cross compilers from the Debian apt repository archive for Debian Stretch. An install on a workstation can build for the same release on other architectures. A Linux desktop or laptop PC, virtual machine, or chroot will need to be used for this. Debian Stretch for a workstation can be downloaded from here.

From a Debian workstation (not the target), run these commands to set up the cross compiler:

# Run "lsb_release -a" and verify Debian 9.X is returned.  These instructions are not
# expected to work on any other version or distribution.
su root
# Not needed for the immediate apt-get install, but used
# so we can install package:armhf for cross compiling
dpkg --add-architecture armhf
apt-get update
apt-get install curl build-essential crossbuild-essential-armhf -y

This will install a toolchain that can be used with the prefix "arm-linux-gnueabihf-". The standard GCC tools will start with that name, eg "arm-linux-gnueabihf-gcc".

The toolchain can now compile a simple hello world application. Create hello-world.c on the Debian workstation:

#include <stdio.h>
int main(){
    printf("Hello World\n");
}

To compile this:

arm-linux-gnueabihf-gcc hello-world.c -o hello-world
file hello-world

This will return that the binary created is for ARM. Copy this to the target platform to run it there.

Debian Stretch supports multiarch which can install packages designed for other architectures. On workstations this is how 32-bit and 64-bit support is provided. This can also be used to install armhf packages on an x86 based workstation.

This cross compile environment can link to a shared library from the Debian root. The package would be installed in Debian on the workstation to provide headers and libraries. This is included in most "-dev" packages. When run on the arm target it will also need a copy of the library installed, but it does not need the -dev package.

apt-get install libcurl4-openssl-dev:armhf

# Download the simple.c example from curl:
wget https://raw.githubusercontent.com/bagder/curl/master/docs/examples/simple.c
# After installing the supporting library, curl will link as compiling on the unit.
arm-linux-gnueabihf-gcc simple.c -o simple -lcurl

Copy the binary to the target platform and run on the target. This can be accomplished with network protocols like NFS, SCP, FTP, etc.

If any created binaries do not rely on hardware support like GPIO or CAN, they can be run using 'qemu'.

# using the hello world example from before:
./hello-world
# Returns Exec format error
apt-get install qemu-user-static
./hello-world

Debian Installing New Software

Debian provides the apt-get system which allows management of pre-built applications. The apt tools require a network connection to the internet in order to automatically download and install new software. The update command will download a list of the current versions of pre-built packages.

apt-get update

A common example is installing Java runtime support for a system. Find the package name first with search, and then install it.

root@ts:~# apt-cache search openjdk
default-jdk - Standard Java or Java compatible Development Kit
default-jdk-doc - Standard Java or Java compatible Development Kit (documentation)
default-jdk-headless - Standard Java or Java compatible Development Kit (headless)
default-jre - Standard Java or Java compatible Runtime
default-jre-headless - Standard Java or Java compatible Runtime (headless)
jtreg - Regression Test Harness for the OpenJDK platform
libreoffice - office productivity suite (metapackage)
openjdk-8-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-8-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-8-doc - OpenJDK Development Kit (JDK) documentation
openjdk-8-jdk - OpenJDK Development Kit (JDK)
openjdk-8-jdk-headless - OpenJDK Development Kit (JDK) (headless)
openjdk-8-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-8-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-8-jre-zero - Alternative JVM for OpenJDK, using Zero/Shark
openjdk-8-source - OpenJDK Development Kit (JDK) source files
uwsgi-app-integration-plugins - plugins for integration of uWSGI and application
uwsgi-plugin-jvm-openjdk-8 - Java plugin for uWSGI (OpenJDK 8)
uwsgi-plugin-jwsgi-openjdk-8 - JWSGI plugin for uWSGI (OpenJDK 8)
uwsgi-plugin-ring-openjdk-8 - Closure/Ring plugin for uWSGI (OpenJDK 8)
uwsgi-plugin-servlet-openjdk-8 - JWSGI plugin for uWSGI (OpenJDK 8)
java-package - Utility for creating Java Debian packages

In this case, the wanted package will likely be the "openjdk-8-jre" package. Names of packages can be found on Debian's wiki pages or the packages site.

With the package name apt-get install can be used to install the prebuilt packages.

apt-get install openjdk-8-jre
# More than one package can be installed at a time.
apt-get install openjdk-8-jre nano vim mplayer

For more information on using apt-get refer to Debian's documentation here.

Debian Setting up SSH

To install the SSH server, install the package with apt-get:

apt-get install openssh-server


Debian Stretch by default disallows logins directly from the user "root". Additionally, SSH will not allow remote connections without a password or valid SSH key pair. This means in order to SSH to the device, a user account must first be created, and a password set:

useradd --create-home --shell /bin/bash newuser
passwd newuser


After this setup it is now possible to connect to the device as user "newuser" from a remote PC supporting SSH. On Linux/OS X this is the "ssh" command, or from Windows using a client such as PuTTY.

Debian Starting Automatically

A systemd service can be created to start up headless applications. Create a file in /etc/systemd/system/yourapp.service

[Unit]
Description=Run an application on startup

[Service]
Type=simple
ExecStart=/usr/local/bin/your_app_or_script

[Install]
WantedBy=multi-user.target

If networking is a dependency add "After=network.target" in the Unit section. Once you have this file in place add it to startup with:

# Start the app on startup, but will not start it now
systemctl enable yourapp.service

# Start the app now, but doesn't change auto startup
systemctl start yourapp.service
Note: See the systemd documentation for in depth documentation on services.

Production Mechanism

Todo

Compile The Kernel

WARNING: BACK UP YOUR DATA FIRST

Prerequisites

This guide is intended to run on an x86 compatible Linux workstation. While you may be able to compile the kernel on the board, we do not recommend it. A typical workstation compile will take several minutes. The same compile on the board may take several hours.

RHEL/Fedora/CentOS:

yum install ncurses-devel ncurses
yum groupinstall "Development Tools" "Development Libraries"
Ubuntu/Debian:
apt-get install build-essential libncurses5-dev libncursesw5-dev

For other distributions, please refer to their documentation to find equivalent tools. Next you need to set up the cross compiler and sources:

# Download the cross compile toolchain from Technologic Systems:
wget ftp://ftp.embeddedTS.com/ts-arm-sbc/ts-7800-v2-linux/cross-toolchains/armv7-marvell-linux-gnueabi-hard_i686_64K_Dev_20131002.tar.bz2

#Extract to current working directory:
tar -xjf armv7-marvell-linux-gnueabi-hard_i686_64K_Dev_20131002.tar.bz2

#Download the kernel sources
git clone https://github.com/embeddedTS/linux-armada38x.git

cd linux-4.4.8

Export the CROSS_COMPILE variable with a path that points to the appropriate cross-compiler. If you followed the steps above exactly, the toolchain is extracted into the same directory as the kernel.

export CROSS_COMPILE=../armv7-marvell-linux-gnueabi-hard_i686_64K_Dev_20131002/bin/arm-marvell-linux-gnueabi-
export ARCH=arm

Now you will want to configure your settings. You can start with our default config by running:

make ts7800_v2_defconfig

At this point you can configure any additional options with:

make menuconfig

After you saved the configuration, you can build your kernel and modules with:

make && make modules

Onboard Features

ECC

The TS-7820 includes 5 RAM chips. 4 of these RAMs provide the 2GB of usable RAM for the OS, and the additional chip provides storage for ECC. On the TS-7820 ECC is always enabled.

The CPU is capable of autocorrecting single bit failures, and detecting double bit failures. The mvebu_edac driver will report any failures to the kernel log. In the case of a single bit failure:

 EDAC MC0: 1 CE MVEBU on mc#0csrow#0channel#0 (csrow:0 channel:0 page:0xc8e offset:0xc8e000 grain:8 syndrome:0x5b99e5 - Single bit ECC Failure)

A double bit failure will print out this message, and also attempt a system reboot.

 EDAC MC0: 1 UE MVEBU on mc#0csrow#0channel#0 (csrow:0 channel:0 page:0x8e offset:0x8e000 grain:8 - Double bit ECC Failure)

To have the system not reboot in case of a double bit failure and just report change the kernel cmdline to include "mvebu_edac.edac_reboot_on_fail=0".

Onboard eMMC Flash

TS-7820 EMMC

CPU Clock Rate

By default the CPU included is rated for 1333MHz. The CPU will be clocked up to this max speed by default at all times. It is possible to adjust this clock speed to 1066MHz, or 666MHz. Note that this does improve the power dissipation when the cpu would otherwise be loaded, but reducing the clock speed of this CPU does not reduce dissipation when the cpu is idle. Running at 1.3GHz with both cores enabled at idle is the same power consumption as 666MHz with only one core.

See the #Power_Consumption section for more information on these savings when loaded.

To reduce the clock speed:

# Specify the rate you want with 1066 or 666 directly:
tshwctl -l 1066

# Specify 0 to attempt to auto set back to the max:
tshwctl -l 0

# tshwctl 1 core instead of two
ts7800ctl -c 1

These commands will require a power cycle.

FPGA

The Intel Cyclone IV is connected to the Armada 385 through a PCIe 2.0 lane allowing fast peripherals such as a graphics controller, high speed ADC, as well as low latency digital IO. On the TS-7820, the FPGA provides all of the external DIO, as well as additional UARTs through 16550 controllers, a CAN controller, a HART controller, and more. Our FPGA peripherals have supporting Linux drivers where applicable.

 02:00.0 Unassigned class [ff00]: Altera Corporation Device 0004 (rev 01)
 	Subsystem: Altera Corporation Device 0004
 	Flags: bus master, fast devsel, latency 0, IRQ 48
 	Memory at e4080000 (32-bit, non-prefetchable) [size=4K]
 	Memory at e4000000 (32-bit, non-prefetchable) [size=512K]
 	Memory at e4081000 (32-bit, non-prefetchable) [size=4K]
 	Memory at e0000000 (32-bit, non-prefetchable) [size=64M]
 	Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+
 	Capabilities: [78] Power Management version 3
 	Capabilities: [80] Express Endpoint, MSI 00
 	Capabilities: [100] Virtual Channel
 	Kernel driver in use: ts78xx_mfd

These listed cores are accessible in BAR0 mapped at 0xe4080000. All registers should be accessed 32-bits at a time. The peekpoke utility can be used to read these from bash:

# Read rev register
peekpoke 32 0xe4080100
# At the time of writing this returns 0xFFF1C.  Rev is only bits 15:0, so 
# mask out the rest and convert to decimal
echo $((0xFFF1C & 0xff))
# Returns "28"
Offset Description
0x00-0xf #FPGA GPIO
0x10-0x2f ADC
0x30-0x7b Reserved
0x7c #FPGA UART Clock Controller
0x80-0x87 16550A port 0 [1]
0x88-0x8f 16550A port 1 [1]
0x90-0x97 16550A port 2 [1]
0x98-0x9f 16550A port 3 [1]
0xa0-0xa7 16550A port 4 [1]
0xa8-0xaf 16550A port 5 [1]
0xb0-0xb7 16550A port 6 [1]
0xb8-0xbf 16550A port 7 [1]
0xc0-0xef Reserved
0x100 #LTC2325 5MSPs ADC
  1. 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 This port follows the register interface for a National Semiconductor 16550A

FPGA GPIO

Register Write Description Read Description
0x0 Output Enable Set bits (1 = set, 0 = retain current value) Current OE Status (1 = output, 0 = input)
0x4 Output Enable Clear (1 = clear, 0 = retain current value) IRQ Status Register
0x8 Output Data Set (1 = high, 0 = retain) Current output value (1 = high, 0 = low)
0xc Output Data Clear (1 = clear, 0 = retain current value) Current input value (1 = high, 0 = low)
Bank IO Number Pin Name
1 0 en_nimble_4v_pad
1 en_nimble_3v3_pad
2 en_emmc_3v3_pad
3 CLK_125MHz [1]
4 red_led_padn
5 grn_led_padn
6 phy_0_led_padn
7 phy_1_led_padn
8 i2c_0_clk_pad
9 i2c_0_dat_pad
10 m2_i2c_clk_pad
11 m2_i2c_dat_pad
12 spi_0_fpga_cs3_padn
13 cpu_access_fpga_flash_padn
14 use_7800_boot_flash_pad
15 cpu_push_sw_padn
16 en_usb_5v_pad
17 blu_led_pad
18 phy_1512_reset_padn
19 en_wifi_pwr_pad
20 wifi_reset_padn
21 cage_sda_pad
22 cage_scl_pad
23 en_relay_1_pad
24 en_relay_2_pad
25 en_gps_3v3_pad
26 spi_0_wifi_cs2_padn
27 en_dig_in_0_1
28 en_dig_in_2_3
29 en_nim_usb_padn
30 prog_silab_clk_padn
31 prog_silab_data_pad
  1. When OE is on, this signal drives 125MHz. When off, this drives high.

LTC2325 5MSPs ADC

The TS-7820 features a Linear Tech LTC2325 providing 4 16-bit channels of simultaneous 5Msps of ADC data.

WARNING: Due to a bug on the P1, AC coupled modes are not supported as they will be on the next revision. On new boards we can provide a DC offset of 2.048V allowing the 2vPP
  • In single ended mode, AN#- can be grounded and AN+ can sample 0-4.096V.
  • In differential mode, AN#- and AN+ can provide up to 16 bits between AN- and AN+.
  • In either mode, AN- must not go below the absolute minimum of -0.3V, and AN+ should not exceed the absolute max of 5.3V.
  • In AC coupled modes, the channels are capable of +- 2.048V (1.4V on P1) with an absolute maximum of 2.5Vpp.
  • With a SAR type ADC the IC does not directly specify an impedance, but in this usage it will be equivalent to 20kohm.

The LTC2325IUKG ADC chipset has 4 channels that are all sampled at 5MS/s. The TS-MINI includes some circuitry to support channels as differential/single ended, and AC/DC coupled.

Channel Differential Single Ended AC coupled DC coupled
1 Y Y N Y
2 Y Y N Y
3 Y Y Y Y
4 Y Y Y Y

The FPGA provides the interface between this ADC and the CPU over its PCIe bus. On startup Linux will allocate a 2MB buffer for the ADC core, and write this physical address to the FPGA. The FPGA will then continuously write new ADC samples to this 2MB buffer. The tsmini2 utility is used to capture data from the this ADC FIFO. This is a C application that runs with realtime priority and constantly pulls samples from the 2MB /dev/udmabuf0 circular buffer and places them in a 512MB FIFO writing output to stdout. Channels cannot be disabled and will always be sampled. The tsmini2 utility will run forever unless it receives an EOF, a signal termination, or if an overflow occurs. If stdout cannot keep up with the 40MB/s samples and and overflow occurs, the remaining of the 512MB FIFO will be output and then the application will terminate. Samples can start again when tsmini2 is reinvoked.

# Generate 100MB of samples
tsmini2 | dd bs=1M count=100 iflag=fullblock of=samples.out

# Output a sample of this data:
hexdump samples.out | head -n 10
 0000000 0358 0012 3d68 3c7c 035a 0016 3d66 3c80
 0000010 0358 0014 3d64 3c78 035a 0012 3d62 3c7c
 0000020 035a 0016 3d66 3c80 035a 0018 3d64 3c78
 0000030 035c 0016 3d64 3c7c 0358 0016 3d66 3c82
 0000040 035a 0012 3d64 3c78 035a 0016 3d66 3c7c
 0000050 035a 0014 3d64 3c82 0358 0014 3d66 3c7c
 0000060 035a 0014 3d64 3c7e 0358 0018 3d64 3c82
 0000070 0358 0014 3d66 3c80 035a 0016 3d66 3c7a
 0000080 0358 0010 3d64 3c7e 0358 0010 3d66 3c7e
 0000090 035a 0014 3d68 3c78 0358 0014 3d66 3c7e

The output constantly returns 16-bits of ADC data for channel 0-3.

This raw format can be converted to csv with an included utility:

cat samples.out | raw-to-csv > samples.csv
head samples.csv

This will output the raw samples, eg:

 chan0, chan1, chan2, chan3
 856, 18, 15720, 15484
 858, 22, 15718, 15488
 856, 20, 15716, 15480
 858, 18, 15714, 15484
 858, 22, 15718, 15488
 858, 24, 15716, 15480
 860, 22, 15716, 15484
 856, 22, 15718, 15490
 858, 18, 15716, 15480

The tsmini2 application can be used as is for the majority of applications. This can be paired with netcat to transmit samples over the network:

# Listen for incoming TCP connection on port 1234 and send samples to the remote system
nc -l 1234 -e ./tsmini2

# Use netcat to initiate a TCP connection to ip 192.168.1.30 port 1234 and send samples
nc -e ./tsmini2 192.168.1.30 1234

If additional filtering is needed, a filter application can be created to read from stdin and modify data before going out.

./tsmini2 | some_filter_process > samples.out

The TS-7820 requires 4-5 seconds before it starts filling the FIFO while it allocates the 512MB memory. The filter app could also be created to look for some external event before saving samples such as trigger voltages, frequencies, or an external GPIO.

While the tsmini2 utility is the recommended method to capture these ADC samples, this documentation could be used for custom implementations.

These registers are accessed at BAR0 of the FPGA, at offset 0x100.

BAR0 Registers
Address Bits Description
0x0 31:21 Reserved
20:16 FIR_LSBCHOP [1]
15:14 FIR_BANK [2]
13 SEL_AN4_DC [3]
12 SEL_AN3_DC [3]
11 EN_AN4_GND [4]
10 EN_AN3_GND [4]
9 EN_AN2_GND [4]
8 EN_AN1_GND [4]
7:0 Reserved
0x4 31:0 32-bit Physical address for 2MB DMA buffer [5]
0x8 31:2 Offset of last write in circular buffer with new data
1 Reserved
0 FIFO Overflow
  1. Defaults to 15. Appropriate for FIR bank 3
  2. Defaults to FIR Bank 3, unity gain passthrough
  3. 3.0 3.1 If 1, Enable DC Coupling
  4. 4.0 4.1 4.2 4.3 If 1, select single ended (not differential)
  5. When an address is written here, samples are enabled and the ADC core will stream samples into this 2MB circular buffer

FPGA IRQ

TS-7840 FPGA IRQ

HART

The TS-7820 implements two 4-20mA HART FSK modems. This can provide 1200 baud communication over large distances with two wires, and many sensors are capable of being powered by the HART bus itself.

UART HART + pin
ttyS7 terminal block pin 27
ttyS8 terminal block pin 28

Our ADC ground is on the terminal block pin 26 which must be used for both HART channels.

Hart Wiring example

The HART modem itself is connected to Linux as a 16550A compatible device. TX/RX will work as expected, but HART is half duplex and requires controlling the TX enable and RX enables. Under Linux these are controlled with RTS/DTR, and DCD is used as an input.

Signal Value Description
RTS 1 TX Enabled
RTS 0 TX Disabled
CTS 1 RX Enabled
CTS 0 RX Disabled
DCD 1 Carrier is detected
DCD 0 Carrier is not detected

Example C code to communicate with a HART periheral can be found here:

This sends command 0, and parses the response. For example:

# ./hart-demo /dev/ttyS7 
mfg_id=4
devtype=4
min_req_preamble=5
universal_command_rev=7
device_rev=1
software_rev=1
hardware_rev=8
flags=0
dev_id_num=4616712
num_preambles=5
max_num_device_vars=4
conf_change_counter=0
ext_status=0

It will instead return "No response" if it never receives an answer on the bus.

Serial Ports

The TS-7820 includes 8x 16550s in the FPGA to support two external UARTS, and internal onboard devices. Under Linux these are all accessible with /dev/ttyS[number] devices.

UART Type TX (or +) RX (or -) CTS RTS
ttyS0 USB [1] N/A N/A N/A N/A
ttyS1 RS232 COM1 Header pin 2/Terminal Block pin 19 COM1 Header pin 3/Terminal Block pin 20 COM1 Header pin 8 COM1 Header pin 7
ttyS2 RS485 COM1 Header pin 1/Terminal Block pin 25 COM1 Header pin 6/Terminal Block pin 24 N/A N/A
ttyS3 Onboard 3.3V TTL Bluetooth K7 pin 9 K7 pin 8 K7 pin 10 K7 pin 11
ttyS4 M.2 WIFI/BT 1.8V TTL K8 pin 32 K8 pin 22 K8 pin 34 K8 pin 36
ttyS5 Nimbelink/XBEE 3.3V TTL CN16 pin 3 CN16 pin 2 N/A N/A
ttyS6 Onboard GPS 3.3V TTL K10 pin 20 K10 pin 21 N/A N/A
ttyS7 HART modem 0 N/A N/A N/A N/A
ttyS8 HART modem 1 N/A N/A N/A N/A
  1. This port is only used for console.

The RS-485 port is half duplex, but the controller has been modified to support automatic TXEN. This does not require manually toggling RTS, or using the TIOCSRS485 ioctl.

Watchdog

The TS-7820 includes a watchdog on the supervisory microcontroller. This is armed immediately from power on for 10 seconds. As soon as U-boot loads it will start feeding the watchdog. U-boot will feed for 60 seconds every 1 second. Once Linux takes over, there is a kernel driver which can feed the watchdog. This must be initiated by userspace. By default we use the watchdog software daemon to handle feeding.

To take over feeding in your application entirely, remove the "watchdog" daemon. The kernel provides an interface to the watchdog driver at /dev/watchdog. Refer to the kernel documentation for more information on interfacing with this directly:

External Interfaces

16x2 Terminal Blocks

These removable terminal blocks (mating connector OST OSTTJ1611030 included) are 16x1 headers, and includes ADC, relays, HART, and a switched 1A 8-28VDC. Wiring should use AWG 16-30 stranded or solid wire.

Top Row
Pin Description
1 Relay 2 Normally Open
2 Relay 2 Common
3 Relay 2 Normally Closed
4 Relay 1 Normally Open
5 Relay 1 Common
6 Relay 1 Normally Closed
7 Ground
8 AN4+
9 AN4-
10 AN3+
11 AN3-
12 AN2+
13 AN2-
14 AN1+
15 AN1-
16 Ground
Bottom Row
17 SW_8_28V
18 GND
19 COM_232_TXD/ttyS1 TXD
20 COM_232_RXD/ttyS1 RXD
21 CAN_L
22 CAN_H
23 GND
24 485_MINUS/ttyS2 485-
25 485_PLUS/ttyS2 485+
26 Analog GND
27 AN_IN_0
28 AN_IN_1
29 AN_IN_2
30 AN_IN_3
31 AN_IN_4
32 AN_IN_5
16x2 TerminalBlocks.png

3 Pin Power Terminal Block

The removable 3 pin terminal is used to power the board with 5v, or 8-28VDC. The included mating connector (OST OSTTJ037102) supports AWG 12-30.

Pin Description
1 (Left) 8-28VDC
2 5V
3 (Right) GND

XBEE/Nimbelink Header

The XBee socket on the TS-7820 is designed to support multiple devices. In addition to the standard range of XBee products from Digi, it also supports NibeLink Skywire cellular modem modules. The TS-7820 can provide 3.3 V or 4 V to the power pin of the XBee form factor, and can also support USB devices provided by compatible modules.

Power is not turned on by default and must be explicitly enabled. The 3.3 V or 5 V regulators can be enabled by manipulating the en_nimble_4v_pad/en_nimble_3v3_pad gpio.

USB on pins 7 and 8 of the XBee socket are by default disconnected from module. This is because some older modules call out these pins with different functions or to leave as a no connect. The en_nim_usb_padn DIO is used to enable the USB host connection to the XBee socket.

The special VCC output on pin 6 can provide different voltages based on the combination of 3.3 V and the 4 V regulator enables. VBUS is 0 V output when neither of the regulators are enabled and when only the "XBee 3.3 V" supply is enabled. VBUS is ~4.7 V output when only the "4 V" is enabled.

Some form factor compatible modules provide a USB device on two pins of the XBee socket. In order to ensure compatibility with most modules, these USB pins are electrically disconnected by default and must be enabled. In order to enable USB on the XBee socket, set the en_nim_usb_padn signal low. Note that most XBee modules will not function if USB is enabled. Only enable the USB connectivity if the module used supports USB on pins 7 and 8!

This example sets up a Nimbelink Cellular modem on the XBEE header.

WARNING: This should not be done with 3.3V XBEE modules
# Enable USB to the XBEE header:
gpioset gpiochip2 29=0

# Turn off XBEE 3.3V
gpioset gpiochip2 1=0

# Enable modem 4V:
gpioset gpiochip2 0=1

# After this is run it requires about 20-25 seconds before it shows up on USB
# as a CDC-Ethernet device

This examples turns on an XBEE and removes it from reset:

# Turn off modem 4V:
gpioset gpiochip2 0=0

# Turn on XBEE 3.3V
gpioset gpiochip2 1=1
Pin Name
1 VCC [1]
2 ttyS5 RXD
3 ttyS5 TXD
4 GND
5 NC
6 VBUS
7 USB Host + [2]
8 USB Host - [2]
9 NC
10 GND
11 GND
12 NC
13 NC
14 3.3 V
15 GND
16 NC
17 NC
18 NC
19 NC
20 GND
Zigbee Header
  1. This pin will provide 3.3 V or 4 V depending which is selected
  2. 2.0 2.1 Enabled with en_nim_usb_padn

DIO Header

Pin Description
1 3.3V
2 JP1
3 TODO
4 TODO
5 TODO
6 TODO
7 TODO
8 TODO
9 TODO
10 GND

1x PCIe Header

USB Host ports

This board provides 3 external USB ports. The two stacked blue ports are USB 3.0, and the single black port is a USB 2.0. Typically USB is interfaced with by using standard Linux drivers, but low level USB communication is possible using libusb.

We also provide control over USB 5V through a GPIO. This can be used to save power, or to reset USB devices that get stuck in a bad state.

# Power disabled
gpioset 2 16=0
sleep 2 # let any devices reset
# Enable power
gpioset 2 16=1

Network Ports

The TS-7820 provides 6 Ethernets. The CPU offers a total of 3 ethernet ports which each have 1Gb/s of bandwidth available. The two WAN ports directly provide direct connection to one of these CPU ethernet ports. The third CPU Ethernet port is connected to a Marvell 88E6352 gigabit switch.

TS7820-switch.png

The gigabit switch provides 4 external Ethernet ports. On startup, all ports are disabled and Linux configures all 4 ports to forward packets only to and from the CPU. If ports are bridged with brctl, the switch will connect their internal VLANs and forward packets between them without requiring the CPU's intervention. The WAN ports can also be forwarded to LAN ports, but this will require CPU intervention.

Ethernet Switch

The Marvell 88E6352 switch is supported by Linux's DSA (Distributed Switch Architecture). On startup Linux will expose all of the external ports as separate Ethernet ports. List all interfaces with:

ip a

The "lan0-lan3" ports on the TS-7820 are the external switch ports. By default these are configured to forward packets between the external port, and the CPU "eth2" interface. Packets will not forward between the ports unless configured with brctl. To bring up a lan port:

# Bring up eth2, required for any of the switch
# ports to send/receive packets to the CPU
ip link set eth2 up
ip link set lan0 up
# At this point lan0 can be configured like any normal network interface
# Eg, start a dhcp client:
dhclient lan0

The switch can also be configured to connect ports together to pass packets without the CPU's intervention. This is done with brctl. For example, to bridge lan0 and lan1 together:

# Create a bridge interface
brctl addbr br0
# Add interfaces to the bridge
brctl addif br0 lan0
brctl addif br0 lan1

# Bring up the interfaces, note that eth2 is not
# required to be up in order to bridge the ports 
# unless packets must be accessed by Linux.
ip link set lan0 up
ip link set lan1 up
# lastly, bring up the bridge
ip link set br0 up

After this bridge is up, to access lan0/lan1 ports the br0 interface should be used. This br0 interface can now be treated like any other interface. Additional bridges can be created with "brctl addbr", and may include any of the externally available network ports.

Router Example

The TS-7820 can function as a basic NAT enabled router with very little configuration. This example will be under Debian, but the configuration will be similar under other distributions.

First configure the switch to include a single bridge for lan0-lan4:

Create /etc/network/interfaces.d/br0

auto eth2
auto br0
iface br0 inet static
        address 10.10.10.1
        netmask 255.255.255.0
        bridge_ports lan0 lan1 lan2 lan3
        # Enable STP to prevent loopbacks
        up /sbin/brctl stp br0 on
        # If the same mac is on multiple ports of
        # the switch, turn off mac aging
        #up /sbin/brctl setageing br0 0

This will make the router's interface to the local network 10.10.10.1. This also assumes our internet gateway is on eth0:

auto eth0
iface eth0 inet dhcp

Make these two changes live with:

service networking restart

To make devices get assigned IPs in the NAT range 10.10.10.2-254 we also need to install and configure a DHCP server.

apt install isc-dhcp-server

Edit the file /etc/default/isc-dhcp-server and change:

 INTERFACESv4=""

to

 INTERFACESv4="br0"

This is indicating we want to serve ipv4 DHCP addresses on our bridge interface for lan0-lan3. Edit the file /etc/dhcp/dhcpcd.conf, and add to the end:

subnet 10.10.10.0 netmask 255.255.255.0 {
        range 10.10.10.1 10.10.10.254;
        # This should typically be pointed towards your DNS
        # server, a DNS server assigned to eth0, or 
        # a public DNS like googles (8.8.8.8)
        option domain-name-servers 8.8.8.8 8.8.4.4;
        option routers 10.10.10.1;
        option subnet-mask 255.255.255.0;
        option broadcast-address 10.10.10.255;
}

Restart the DHCP server and it will immediately start assigning addresses on the network:

service isc-dhcp-server restart

This dhcp server specifies router as the br0 interface, so clients will attempt to send their requests to reach networks outside of this 10.10.10.1-254 subnet to this units br0 interface to reach the internet. To pass these requests to eth0 require a kernel setting, and iptables rules. Edit /etc/sysctl.conf and find the line:

 # Uncomment the next line to enable packet forwarding for IPv4 
 #net.ipv4.ip_forward=1

Uncomment the net.ipv4.ip_forward setting, and run this to make the rules immediately take effect:

sysctl -p

Last, we must set up a rule to enable the NAT. Use the package iptables-persistent to make these rules persistent:

# This will ask if you want to save ipv4/ipv6 rules, say yes or no as there wont
# be any default rules on the system yet.
apt install iptables-persistent

# Allow routing traffic from br0 to any network this system has routes to:
iptables -A FORWARD -i br0 -j ACCEPT
iptables -A FORWARD -o br0 -j ACCEPT

# Implement a NAT to route packets to eth0 from other interfaces.
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

# Save the rules for future boots:
iptables-save

At this point the system should be operating as a router, and will automatically start back up acting as a router. The same configuration can work while including wlan0 for a wireless network, or using a cell modem card interface instead of eth0 to provide internet from a cellular service.

SFP

The WAN1 port is brought out as both an RJ45, and as an SFP port. If both are connected, the SFP is used instead. This SFP is also a 1Gb/s port, but provides capability for much longer cable runs than Ethernet.

USB Console (Type B)

The USB type B header is used for system console. This is connected to the CPU's console (ttyS0). See this section for further details.

MicroSD

COM1 Header

Pin Description
1 485_PLUS/ttyS2
2 COM_232_RXD/ttyS1
3 COM_232_TXD/ttyS1
4 CAN_H
5 GND
6 485_MINUS/ttyS2
7 COM_232_RTS/ttyS1
8 COM_232_CTS/ttyS1
9 CAN_L
10 NC

Push Switch

The push switch is accessible as a GPIO in bank 2 (FPGA), IO 15:

# Returns 1 when not pressed, or 0 when pressed
gpioget 2 15

Specifications

Power Specifications

Power Consumption

Temperature Specification

I/O Specifications

Rail Specifications

Revisions and Changes

PCB Revisions

PCB Revision Description of changes
Rev P1 Initial Release

U-Boot Revisions

Version Description of changes
u-boot-ts7820-emmc-Oct-18-2018.kwb
  • Initial release

FPGA Revisions

Version Description of changes
28
  • Initial release

Kernel Revisions

For kernel changes please see our github:

Software Image Revisions

Version Description of changes
ts7820-debian-stretch-10112018.tar.xz
  • Initial release
ts7820-debian-stretch-11052018.tar.xz
  • added tsmini2 utility for accessing 5MS/s 16-bit ADC

Model Numbers