This page contains instructions for setting up Afero Potenco, a secure Linux device that can also function as a hub for Afero enabled Bluetooth® low energy devices. For instructions on implementing Potenco as an edge device, please refer to Scripting Simple Attribute Clients.
The instructions on this page explain how to flash the image to the internal eMMC memory slot on a Microchip SAMA5D2 board, and connect the Afero Hardware Security Module (HSM). The OS image can be provided by Afero, or you can build it yourself to include your own customizations, depending on your needs.
This page contains the following sections:
Afero Potenco devices run on a Yocto Linux platform; specifically:
You will need the following pieces of hardware:
You will need to download the firmware image for your development board from Afero. Follow the instructions below to get the correct image:
To install and boot a Potenco Operating System image on the SAMA5D2 development board, follow the instructions below.
Follow the instructions below to build the OS image.
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \ build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \ xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \ xterm
You will need to get the
repo command. On Ubuntu 16.04, enter:
$ sudo apt-get install repo -y
Afero Yocto builds an image with the following settings:
These build environment variables are defined in the
conf/local.conf file but can be overridden in the bitbake command line.
Follow the build steps below:
$ mkdir sama5 $ cd sama5
yocto/pokyGitHub repository with the proper branch ready:
$ git clone git://git.yoctoproject.org/poky -b sumo
meta-openembeddedGitHub repository with the proper branch ready:
$ git clone git://git.openembedded.org/meta-openembedded -b sumo
meta-qt5GitHub repository with the proper branch ready:
$ git clone git://code.qt.io/yocto/meta-qt5.git $ cd meta-qt5 $ git checkout v5.9.6 $ cd ..
meta-atmellayer with the proper branch ready:
$ git clone git://github.com/linux4sam/meta-atmel.git -b sumo
sama5-hub-manifest. This clones meta-afero and various sources (hubby, attrd, etc.). The source repos will be put into
$ repo init -u ssh://email@example.com/AferoCE/sama5-hub-manifest.git $ repo sync -j8
pokydirectory to configure the build system and start the build process:
$ cd poky
$ source oe-init-build-env build-microchip
$ cp ~/sama5/meta-afero/conf/bblayers.conf ~/sama5/poky/build-microchip/conf/bblayers.conf $ cp ~/sama5/meta-afero/conf/local.conf ~/sama5/poky/build-microchip/conf/local.conf
Any changes to bblayers.conf or local.conf need to be saved to the meta-afero version. Specifically…
If you change the following files:
You must copy them and commit the changes to repo:
$ rm ~/sama5/meta-atmel/recipes-bsp/at91bootstrap/at91bootstrap_3.8.11.bb
$ BUILD_TYPE=prod BUILD_TARGET=debug BUILD_PROFILE=potenco bitbake core-image-minimal
bitbakecleaning the tmp dir for the Afero source packages. Then compile and build the image for
$ bitbake -c cleansstate beetle af-conn af-edge af-ipc af-sec af-util attrd hubby otamgr $ BUILD_TYPE=prod BUILD_TARGET=debug BUILD_PROFILE=potenco bitbake core-image-minimal
The SD card slot on the board is used to connect the Wi-Fi+BT combo chip so we don’t build the image for an SD card. We use the eMMC-based image as we must flash the image to the internal eMMC. The image target we build is
You will need to obtain the SAM-BA software from Microchip to flash the SAMA5D2 image to the eMMC on your SAMA5D2 Potenco. You download this tool, version 3.2.3 (on Linux) from GitHub: https://github.com/atmelcorp/sam-ba/releases.
Make sure you add the path of the executable to your $PATH.
The SAMA5D2 board provides a FTDI-based debug port; namely, the six (6) pins adjacent to the Ethernet port.
x is a number such as 0, 1, etc.
$ picocom -b 115200 /dev/ttyUSB0
$ ll /dev/ttyA* crw-rw---- 1 root dialout 166, 0 Jun 8 17:52 /dev/ttyACM0
$ cat /etc/group | grep dialout dialout:x:20:tina
$ sam-ba -p usb -b sama5d2-xplained -a serialflash -c erase::0x3000 -c writeboot:at91bootstrap-sama5d2_xplained.bin
$ sam-ba -p usb -b sama5d2-xplained -a serialflash -c erase:0x8000:0x70000 -c write:u-boot-sama5d2-xplained-emmc.bin:0x8000
$ sam-ba -p usb -b sama5d2-xplained -a sdmmc -c write:core-image-minimal-sama5d2-xplained-emmc.wic
The error shown below means you need to open the BOOT_DIS jumper, and try again:
$ sam-ba -p usb -b sama5d2-xplained -a serialflash -c erase::0x3000 -c writeboot:at91bootstrap-sama5d2_xplained.bin Opening serial port 'ttyACM0' Connection opened. /home/user/Downloads/myTools/sam-ba_3.2.3/qml/SAMBA/Applet.qml:232: Error: Could not initialize applet (status: 1) Connection closed.
The SAMA5D2 board has a different I/O connector pinout than the Peaberry board, so it must be manually wired to connector J18 on the board.
In the first diagram below, the Peaberry board is shown with the connector facing up. Connect the four pins shown to connector J18 as follows:
Power VDD to J18 pin 1
GND to J18 pin 2
I2C_SCL to J18 pin 7
I2C_SDA to J18 pin 8
Cape Expansion Headers:
The Potenco SDK is a set of binary packages that you can supply to your customers to develop applications for the Potenco OS, without having access to all the repositories needed to build the entire OS image.
Installation and use of the Potenco SDK is covered in a separate document.
$ cd ~/sama5/ $ source oe-init-build-env build-microchip
$ bitbake -c populate_sdk core-image-minimal
Download the Afero mobile app, if you haven’t already, and sign in. The Peaberry board should have come with a couple of QR Code stickers, including one on the back of the board. Scan the QR Code in the Afero mobile app to add the Potenco hub to your account. Once online, any Afero BLE devices on your account will use the Potenco hub to connect to the Afero Cloud.
Potenco also acts as an Afero edge device and can communicate with the Afero Cloud as a connected device in addition to acting as a hub. You can create a Potenco profile in the Afero Profile Editor, and attributes that you define in that profile can be accessed via scripts running on the Potenco board. Please refer to Scripting Simple Attribute Clients to learn how to create a profile for your IoT project and implement it.