Introduction — phyBOARD — Pollux AI-i.MX 8M Plus

Evhenii Rvachov
6 min readSep 21, 2021

A few months ago, I was starting to learn a new platform. It’s a board based on i.MX 8M Plus (NXP) processor and exciting solutions from PHYTEC company. The phyBOARD®-Pollux AI kit is a development platform for the use of machine learning in embedded systems. If you read my articles and saw my videos on YouTube, you know I like symbioses between hardware and software. At this moment, I’ve not integrated this Board into my project. But after two weeks, I’ve understood this is a fantastic solution to the industrial project if you get universal power, temperature resistance, hardware, software security, and many other features.

phyBOARD-Pollux with phyCORE-i.MX 8M Plus module

Thanks to the company PHYTEC for the support and mentoring to the i.mx world. The primary goal is to draw attention to this platform and whet your appetite for deployment boards on industrial. I want to say that any project, sooner or later, must go into production. And it will be great if it is a stable device that can work in the enterprise for several years.

A few words about the processor and why it is worth using i.MX 8M Plus in industrial projects:

  • The first thing that interested me was the NXP i.MX 8M Plus with 2.3 TOPS neural processor designed for AI applications.

At CES 2020, NXP announced the first i.MX processor with a dedicated Neural Processing Unit (NPU). The NXP i.MX 8M Plus SoC is powered by the i.MX 8M Nano, a quad-core Arm Cortex-A53 processor, runs at up to 2GHz, an independent Cortex-M7 800MHz real-time microcontroller with a GPU Vivante 3D, but with the addition of 2.3 TOPS NPU.

The NPU will provide advanced machine learning capabilities on industrial and IoT (Internet of Things) devices with applications such as human and object recognition for public safety, industrial machine vision, robotics, hand gestures, and emotion detection with natural language processing.

Ok. Let’s see what’s inside the phyBOARD®-Pollux AI kit and run examples from the box.

First unboxing — phyBOARD — Pollux AI-i.MX 8M Plus

The PHYTEC website has all the information you need about this Board and technical documentation. I’ll not duplicate the data; you can read it here.

Dimensions of Board — phyBOARD®-Pollux AI kit

If you are going to build, rebuild, test, and produce your own Linux distribution, you must learn the Yocto project. Of course, I did NOT know what Yocto is, but it doesn’t hard to understand. I’ve spent 1–2 evenings, and I could build my first custom Linux distribution. And you can do it! Let’s get started.

Setup host machine for Yocto project

Let’s set up our host configuration for Building Linux distribution. To get the expected behavior of the Yocto Project on a Linux host machine, you need to install the packages and utilities described below. The critical point is the required hard disk space of the host machine. For example, when assembling a Ubuntu machine, the minimum required hard disk space is about 50GB. It is recommended to allocate at least 120 GB, which is enough to compile all the backends together. A minimum of 250 GB is recommended to create machine learning components. The recommended minimum Ubuntu version is 18.04 or newer. Chromium version 74 requires Ubuntu 18.04.

I’ve tested building on my PC (Ubuntu 20.04) i7, 32GB, and Oracle VM VirtualBox. I recommend using a virtual machine or Amazon EC2 for working on the Yocto Project.

VM Ubuntu for Yocto Project

If you are going to use VirtualBox for building, please check the following parameters:

  • CPU virtualization (recommend to use 8vCPU or more)
  • Network Adapter needs to change by “Bridged Adapter” (you can connect to your VM through ~ssh)

If you can use EC2 instances — please use more than 48 cores CPU; it helps you get your final image faster.

Amazon EC2 Instance Type for Yocto Project

When you get a working instance (or VM on your faster PC), you can connect to it through the ssh client, for example, in your terminal (mac or ubuntu). Don’t forget to use your .pem or .cer file from your security AWS.

>> ssh -i "your_PEM_file" ubuntu@your_dns.compute-1.amazonaws.com

The following list shows the required packages by feature for a supported Ubuntu Linux distribution and for comfortable to work with Yocto Project:

>> sudo apt update
>> sudo apt upgrade
>> sudo apt-get build-dep qemu
>> sudo apt-get remove oss4-dev

Packages needed to build an image on a headless system:

>> sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
build-essential chrpath socat cpio python3 python3-pip python3-pexpect \
xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \
pylint3 xterm

Next, we need to install python2, and it needs to run the phyLinux script from official documentation wiki.phytec.com. You will need this script only once. The following configuration will be to use the python3 environment. Please run these commands:

>> sudo apt-add-repository universe
>> sudo apt update
>> sudo apt install python2-minimal
>> sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1

Check your Python2 version:

python2 -V

If you get this, you can jump to next:

Python 2.7.18

Download & Collect Yocto layers

Ok, we have a host machine for building our future projects by infrastructure Yocto, and we can move to the next stage — Building Linux distribution and ML application. I’ve tested this guide on PHYTEC documentation.

If you are going to get more information about Yocto for NXP — you can go to this link. But we have a product from PHYTEC’s company, and many Yocto layers need correct running just for PHYTEC Boards.

For some layers that need specific python (in our case python3.6) libraries and packages, you can use virtualenv or conda tools to create your environment. Let’s set up env on your EC2 (or any host machine). If you see PHYTEC documentation, you will see how to use specific conda environments, and packages include your env.

>> cd ~
>> wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
>> chmod +x Miniconda3-latest-Linux-x86_64.sh
>> ./Miniconda3-latest-Linux-x86_64.sh

Activate or clone your conda environment from *.yml file from wiki.phytec.com

>> wget https://github.com/JanderHungrige/tf.keras-vggface/blob/main/Anaconda/TF2.3envfile.yml>> conda env create -f TF2.3envfile.yml

Ideally, We are ready to start building our first Linux distribution for embedded systems and i.mx8m plus family.

Start building phytec-facematch-image on Amazon EC2

I use Amazon EC2 instance with 48 cores CPU and 96Gb Memory. And the first building of core and application has taken 41 minutes. Maybe you will get another spending time. But you have to know — it’s just for the first time to building. Next, you will spend 5 minutes because you have built history caching.

Process of Yocto Building

When you finish, you will download your final image and burn it to your SD card.

All history and results of your building are located on /deployment/images/NAME_of_Image. You have to find a .sdcard file and use it for burning on your SD card. If you use the EC2 instance, you have to download it from your remote machine. I use the SCP command with arguments:

>> scp -i file-security.pem user@ec2-xx-xx-xxx-xxx.compute-1.amazonaws.com:path/to/file /your/local/directory/files/to/download

Next, you need to umount and burn the image to your SD card:

>> ls -la /dev/sd*
>> sudo umount /dev/sdd1/
>> sudo dd if=image.wic of=/dev/sdd1 bs=1M
  • Connect phyCAM-M MIPI CSI camera to CSI interface
  • Plug into your SD slot on phyBOARD
  • Connect HDMI
  • Mouse and Keyboard
  • Plugin original power supply from original phyBOARD AI Box.
video from @rvjenya— YouTube channel

I hope this little tutorial has given you a concept of ​​how you can create impressive projects on the i.mx8 family of processors. Would you mind writing to me if something didn’t work out for you or found an error (correction) in my article?

--

--

Evhenii Rvachov

I’m just a Human who likes hardware/software engineer.