Genio 1200 QSG
Genio 1200 EVK Demo Requirements
This demonstration kit is very flexible and can be setup in various configurations, with software support for Yocto or Android. However for the purpose of this Quick Start Guide, a specific configuration is chosen with the following conditions:
IOT-YOCTO software build
D6 Camera Board enabled
Additional items needed for Quick Start Guide demo
To support the demo, the following additional items are needed.
One USB Cable (USB-A to Micro-B)
One USB Cable (USB-A to USB-C)
External PC for loading flash and interacting via command prompt
Setup PC Environment
Setup serial port for viewing debug output and interacting with the kit through a command line interface
Check Device Manager that the USB COM port appears as a UART device under COM Ports
Install a terminal program as necessary, for example Putty from here: https://www.putty.org/. Set baud rate speed to 921600 and open the corresponding port to connect UART0.
Kit Hardware Installation
Insert the D6 Camera Board to CS10 on the main motherboard. The image below shows the smaller D2 board on the left and the larger D6 board on the right. At this time only D6 is supported in the Yocto demos shown in this quick start guide.
Change jumper settings as shown in the following image to enable Yocto operation.
Connect a USB cable to connector labeled USB Type-C Connector Flash download port as shown in the image USB Port Locations below:
This requires installation of the Google Android USB driver as outlined in the Setup PC Environment section. If using Windows, open Device Manager and confirm that the driver appears under Android Device \ Android Bootloader Interface.
Connect a second USB cable to connector labeled UART0 Debug Connector Debug console port as shown in the image USB Port Locations below:
This requires installation of the FTDI VCP USB driver as outlined in the Setup PC Environment section. If using Windows, open Device Manager and confirm that the driver appears under Ports (COM & LPT) \ USB Serial Port (COMx), where x is the port assigned by your system.
Further details regarding both USB drivers can be found in the flash trouble-shooting section.
Plug AC/DC power adapter into the connector.
Flash the software
This guide shows how to “flash” (write) the demo image into the non-volatile flash memory of the main motherboard. The flashing process is performed through the USB Type-C Connector flash download port. In order to write the on-board storage with Genio Tools, you need to set the IoT SoC in download mode, which allows Genio Tools to transfer a download agent binary to the SRAM of SoC. The download agent then provides a fastboot interface for subsequent image transfer and storage write operations.
Download the pre-built private board image to your local PC.
Note
Be sure to download the private image as it is required to run the demos in this quick start guide.
Unzip the image.
Note
Avoid having a long path name by installing to a root folder and shortening the file name if necessary, for example C:\\evk
.
Open a Windows cmd window (to enter commands)
Change working folder to the image directory before running the
genio-flash
commands:
cd C:\evk
Flash the image using the overlay which enables both cameras. which enables Before flashing the board, check if there are certain board features you’d like to enable:
genio-flash --load-dtbo gpu-mali.dtbo --load-dtbo apusys.dtbo --load-dtbo video.dtbo --load-dtbo camera-ar0830-ap1302-csi0.dtbo
Once you see the
Looking for a MediaTek SoC ...
prompt, start the process to boot the board in flash download mode.
Press and keep pressing the Download button.
Press and release the RST button
Hold the Download button until you see the log
Erasing 'mmc0'
message, as shown below:
You should see flashing process started after releasing the volume up button. A typical successful log looks something like this:
Looking for MediaTek SoC matching USB device 0e8d:0003 Opening COM33 using baudate=115200 Connected to MediaTek MT8195 SoC Sending bootstrap to address: 0x201000 Jumping to bootstrap at address 0x201000 in AArch64 mode erasing mmc0 < waiting for any device > Erasing 'mmc0' (bootloader) request sz: 0xe8f800000, real erase len: 0x0 OKAY [ 9.627s] Finished. Total time: 9.655s erasing mmc0boot0 Erasing 'mmc0boot0' (bootloader) request sz: 0x800000, real erase len: 0x800000 OKAY [ 0.013s] Finished. Total time: 0.018s erasing mmc0boot1 Erasing 'mmc0boot1' (bootloader) request sz: 0x800000, real erase len: 0x800000 OKAY [ 0.004s] Finished. Total time: 0.010s flashing mmc0=rity-demo-image-genio-1200-evk.wic.img Sending sparse 'mmc0' 1/9 (262140 KB) OKAY [ 6.440s] Writing 'mmc0' OKAY [ 9.393s] Sending sparse 'mmc0' 2/9 (262140 KB) OKAY [ 6.332s] Writing 'mmc0' OKAY [ 10.185s] Sending sparse 'mmc0' 3/9 (230376 KB) OKAY [ 5.607s] Writing 'mmc0' OKAY [ 8.196s] Sending sparse 'mmc0' 4/9 (262140 KB) OKAY [ 6.362s] Writing 'mmc0' OKAY [ 9.354s] Sending sparse 'mmc0' 5/9 (262140 KB) OKAY [ 6.401s] Writing 'mmc0' OKAY [ 10.089s] Sending sparse 'mmc0' 6/9 (262140 KB) OKAY [ 6.413s] Writing 'mmc0' OKAY [ 9.291s] Sending sparse 'mmc0' 7/9 (242392 KB) OKAY [ 5.924s] Writing 'mmc0' OKAY [ 8.585s] Sending sparse 'mmc0' 8/9 (262140 KB) OKAY [ 6.417s] Writing 'mmc0' OKAY [ 9.288s] Sending sparse 'mmc0' 9/9 (129780 KB) OKAY [ 3.159s] Writing 'mmc0' OKAY [ 4.605s] Finished. Total time: 132.157s flashing mmc0boot0=bl2.img Sending 'mmc0boot0' (205 KB) OKAY [ 0.007s] Writing 'mmc0boot0' OKAY [ 0.026s] Finished. Total time: 0.054s flashing mmc0boot1=u-boot-env.bin Sending 'mmc0boot1' (4 KB) OKAY [ 0.002s] Writing 'mmc0boot1' OKAY [ 0.015s] Finished. Total time: 0.028s Rebooting OKAY [ 0.002s] Finished. Total time: 0.002s
Note
The above command should be the only needed to flash the image with the configurations necessary in this QSG. Further background and troubleshooting information including different command options are available in Flash Genio 1200-EVK. A common problem is that the download does not start and simply keeps waiting for the device. More information is available in Missing “Yocto” Device Driver (Windows Only).
Once the kit boots up with the new flash image, debug log messages can be seen through UART0 in the Putty terminal window.
Verify the desktop boot screen appears on the display of the kit.
Log into board through UART0 interface.
Once board has fully booted, a login prompt is sent across UART0 similar to that shown below.
genio-1200-evk login:
Type root
, then enter, to log in.
NNStreamer Demos
NNStreamer is a set of GStreamer plugins that allow GStreamer developers to adopt neural network models, and neural network developers to manage neural network pipelines with their filters in a easy and efficient way. In order to demonstrate these features we first set up the camera with the v4l2-ctl
command.
Camera Setup
We must first find the V4L2 device for the YUV sensor. There is only one such device which is for the preview stream. The user can list all devices by typing the following command and then searching for the device named mtk-v4l2-camera:
v4l2-ctl --list-device
MediaTek MDP3 ();
/dev/video2
… (shortened for brevity)
mtk-v4l2-camera (platform:mtkcam0):
/dev/video5
Important
The above results are shown only as an example. The node number may change every time the system boots. In this case the mtk-v4l2-camera device is at /dev/video5
. This path and node number 5 will be used in the demos below.
Before using the cameras, you must set the resolution and the pixel format to 1920 * 1080, UYUV
using the v4l2-ctl
command. The command requires several parameters, one of which is the media device of the sensor. The index of the media device in this example is /dev/video5
which was determined by the results above.
v4l2-ctl -d /dev/video5 --set-fmt-video=width=1920,height=1080,pixelformat=UYVY --stream-mmap --stream-count=10 --stream-to=/tmp/ap1302.yuv --verbose
Use gst-launch-1.0
to launch the camera.
gst-launch-1.0 v4l2src device=/dev/video5 ! video/x-raw,width=1920,height=1080,format=UYVY ! v4l2convert output-io-mode=dmabuf-import ! video/x-raw,width=1280,height=720 ! waylandsink sync=false
Confirm that a live video stream is being shown on the LCM. Before proceeding to the next demos, type CTRL+C to end this video stream.
CTRL+C
Further details about hardware operation, background theory, or troubleshooting can be found in the BSP User Guide - Launch Camera section.
NNStreamer Environment Setup
The following NNStreamer demos are run using a python script run_nnstreamer_example.py
. This script is configured using environment variables specifying which camera type to use, which mode to use, which processing engine to use, and the device node of your camera as determined in the step above. Set the following variables before running any of the following demos.
CAM_TYPE=yuvsensor
MODE=1
ENGINE=neuronsdk
CAMERA_NODE_ID=5
Important
The node number may change every time the system boots. As determined above, the mtk-v4l2-camera device in this example is at /dev/video5
. This node number 5 is used for the CAMERA_NODE_ID variable. Further details can be found in the page NNStreamer.
Pose Detection
Set the APP variable so the script runs the proper demo. Then run the script.
APP=pose_estimation
python3 /usr/bin/nnstreamer-demo/run_nnstreamer_example.py --app $APP --cam_type $CAM_TYPE --cam $CAMERA_NODE_ID --engine $ENGINE --performance $MODE
A video stream from the camera should now be displayed on the LCM however with indicators similar to the below image.
Before proceeding to the next demos, type CTRL+C to end this video stream.
CTRL+C
Face Detection
Set the APP variable so the script runs the proper demo. Then run the script.
APP=face_detection
python3 /usr/bin/nnstreamer-demo/run_nnstreamer_example.py --app $APP --cam_type $CAM_TYPE --cam $CAMERA_NODE_ID --engine $ENGINE --performance $MODE
A video stream from the camera should now be displayed on the LCM however with the face blocked out as shown in the below image.
Before proceeding to the next demos, type CTRL+C to end this video stream.
CTRL+C
OpenGL ES Demos
On IoT Yocto, there are several OpenGL ES applications that can used to check that the GPU is running and well integrated within the Wayland/Weston system. In this section we introduce two GLES applications: weston-simple-egl
and kmscube
.
They both use the GPU to render content, but they have different approaches to creating their graphic windows.
Display a rotating cube
This is a simple GLES program demonstrating how to drive bare metal graphics without a compositor (Wayland), using DRM/KMS (kernel mode setting), GBM (graphics buffer manager), and EGL for rendering content using OpenGL ES.
After having typed CTRL+C from the above step, you should see only the simple desktop window which shows the date and time in the upper right hand corner. This desktop graphic is being driven by the Weston service. In this demo, we will display a rotating cube by running the kmscube
command. However kmscube
will create its own window on which it renders content. So, before we launch kmscube
, we must make sure that no other window system occupies the display. This means stopping the Weston process that drives the desktop.
Stop
weston
service if it already started.systemctl stop weston
Confirm that the desktop disappears and you see only a dark screen on the HDMI monitor.
Launch
kmscube
and confirm that you can see a rotating cube as shown in below figure.kmscube
Type CTRL+C to stop displaying the rotating cube.
Display a rotating triangle
This is a simple demonstration GLES program that draws a rotating colorized triangle on a transparent Wayland window. This program is not responsible for creating the window, and instead merely renders its content on an existing window which Weston creates. So, before launching it, we must start Weston.
Start
weston
service if it is not started yet.systemctl start weston
Confirm that the desktop reappears which shows the date and time in the upper right hand corner.
Launch
weston-simple-egl
and confirm that you can see a rotating triangle as shown in below figure.weston-simple-egl 153 frames in 5 seconds: 30.600000 fps 150 frames in 5 seconds: 30.000000 fps ...
Type CTRL+C to stop displaying the rotating triangle.
Additional Details
You can find source code for weston-simple-egl in the Weston codebase: $BUILD_DIR/tmp/work/aarch64-poky-linux/weston/8.0.0-r0/weston-8.0.0/clients/simple-egl.c
or weston github
You can find source code in Weston codebase: $BUILD_DIR/tmp/work/aarch64-poky-linux/kmscube/git-r0/git
or mesa gitlab
Further details about the GPU, background theory, or troubleshooting can be found in the BSP User Guide - GPU section.