TS-7820: Difference between revisions

From embeddedTS Manuals
Line 812: Line 812:


== HART ==
== HART ==
The TS-7820 implements two 4-20mA HART modems.
The TS-7820 implements two 4-20mA [https://en.wikipedia.org/wiki/Highway_Addressable_Remote_Transducer_Protocol 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.
 
{| class=wikitable
! UART
! HART + pin
|-
| ttyS7
| [[#8x2 Terminal Blocks|terminal block pin 27]]
|-
| ttyS8
| [[#8x2 Terminal Blocks|terminal block pin 28]]
|}
 
Our ADC ground is on the [[#8x2 Terminal Blocks|terminal block pin 26]] which must be used for both HART channels.
 
[[File:HartWiringExample.jpg|400px|right]]


== Serial Ports ==
== Serial Ports ==

Revision as of 16:55, 27 November 2018

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 B 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.embeddedarm.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/embeddedarm/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

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.

HartWiringExample.jpg

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

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

8x2 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 (Left) 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 (Right) AN4+
9 (Left) AN4-
10 AN3+
11 AN3-
12 AN2+
13 AN2-
14 AN1+
15 AN1-
16 (Right) Ground
Bottom Row
17 (Left) 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

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

DIO Header

1x PCIe Header

USB Host ports

Ethernet Ports

SFP

USB Console (Type B)

MicroSD

COM1 Header

Push Switch

Specifications

Power Specifications

The stock TS-7800-V2 expects 5V DC.

Input Min voltage Max voltage
5V input 4.5 5.25
TS-781 TBD TBD

Power Consumption

All tests are performed at 5V, with Ethernet, USB, mSATA, SD, disconnected unless otherwise specified. The different CPU frequencies are only tested when loaded and have the same power consumption at idle. Savings were not found by disabling CPU cores. See the Speed Scale section for how to modify the CPU clock rate.

TS-7800-V2-DMW9I
Test Average Max
Idle at 1.3GHz with Ethernet off 0.821A/4.11W 1.013A/5.07W
Idle at 1.3GHz, Ethernet connected 0.902A/4.51W 1.210A/6.05W
Busy both cores 666MHz (openssl speed) 0.984A/4.92W 1.111A/5.55W
Busy both cores 1066MHz (openssl speed) 1.252A/6.26W 1.308A/6.54W
Busy both cores 1333MHz (openssl speed) 1.355A/6.78W 1.572A/7.86W
Busy single core 1333MHz (openssl speed) 1.039A/5.20W 1.240A/6.20W
mSATA writing [2] 1.481A/7.41W 1.787A/8.94W
Sleep Mode 572uA/2.86mW 583uA/2.92mW
TS-7800-V2-DMN1I
Test Average Max
Idle (no changes) 0.81A/4.05W 1.15A/5.75W
Busy both cores at 1.333MHz (openssl speed) 1.39A/6.95W 1.55A/7.75W
  1. This port is only used for console.
  2. Tested with Mushkin MKNSSDAT30GB, cpu at 1.3GHz and otherwise idle

Temperature Specification

All TS-7800-V2 are rated for -40 to +85 degrees C ambient with the CPU set to run at 1066 MHz. Temperature tolerance is lower when operating at the full 1.334 MHz speed. See the graphic below for more detail. See the Speed Scale section for how to modify the CPU clock rate.

TS-7800-V2 HotTempTestGraph.jpg

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

The TS part numbers for the TS-7800-V2 are TS-7800-V2-DMN1I, and TS-7800-V2-DMW9I. These codes disambiguate as follows:

Family Cores Memory Radio Option Set Temperature
TS-7800-V2 D = Dual M = 1GB DDR3 N = None 1 = Base Model I = Industrial (-40 to +85 C)
W=Wifi/Bluetooth 9 = Dev / All Options

During the engineering sampling phase, only the TS-7800-V2-DMN1I will be available for general purchase.