Archive

Posts Tagged ‘gpio’

WCH CH341 USB to Serial Chip Gets Linux Drivers to Control GPIOs over USB

February 16th, 2018 21 comments

USB to serial chips are often used as a debug interface either directly on the target board, or via a dedicated debug board. But some models have extra pins exposed, and one of those is WCH CH341, which also includes I2C & SPI interfaces and up to 8 GPIOs.

But software support for those extra pins is not currently built-in into the drivers found in Linux mainline, and you’d also have to find a board that breakout the relevant pins. It turns out there are few of things including “CH341A ALL IN 1 USB to SPI/I2C/IIC/UART/TTL/ISP serial adapter” board going for $10 shipped on Aliexpress, and which Zoobab successfully used to control 6 (out of 8) GPIOs over USB.

The board comes with a USB board to connect to your computer, several header for I2C, UART, SPI, some LEDs, and jumper to select I2C/SPI or UART mode and voltage (5V/3.3V).

The board is recognized differently whether you use I2C/SPI or UART mode in Linux:

  • I2C-SPI mode

  • UART mode

You’ll however need the out of tree i2c-ch341-usb driver to expose the 8 GPIOs and control them over USB/I2C. He set the direction to output for 6 of the pin in the source code (6-7 could not be set to output for whatever reason):

After after build the module, and load the module:

gpio0 to gpio5 would should in /sys/class/gpio, which means you can control them with the usual sysfs commands:

He also benchmarked the pins with a shell script to turn on and off connected LED, and managed to do that at around 2.2KHz. It may be a little faster by changing the I2C bus speed (100 kHZ by default) and/or using C code instead. Alternatively, using spi-ch341-usb driver from the same developer (gschorcht) may speed things up a little bit despite the documented “slow SPI”.

Another shell script with 6 LEDs connected to the board is demonstrated below.

Anyway that good news since that means you can add (extra) GPIOs to any Linux board with USB relatively easily and cheaply. But if you’re not quite willing to spending $10 on that option, there are cheaper options such as a CH341 USB programmer going for $2.30 + shipping on Electrodragon, or CJMCU-341 board sold for around $5 including shipping on Aliexpress or eBay.

Categories: Hardware, Linux Tags: driver, gpio, i2c, Linux

FOSDEM 2018 Open Source Developers Meeting Schedule

January 23rd, 2018 5 comments

FOSDEM (Free and Open Source Software Developers’ European Meeting) occurs every year on the first week-end of February, where developers meet for two days discussing about open source software projects. FOSDEM 2018 will take place on February 3-4 this year with  652 speakers, 684 events, and 57 tracks, an increase over  last year 608 speakers, 653 events, and 54 tracks. There will be 8 main tracks namely: Community, History, Miscellaneous, Performance, Python, Security and Encryption, Space, and Global Diversity CFP Day.

There will also be 33 developer rooms, and since the full schedule is now available, I’ll make a virtual schedule mostly based on sessions from the Embedded, mobile, and automotive, Hardware Enablement, and Internet of Things devrooms.

Saturday 3, 2018

  • 09:50 – 10:15 – Turning On the Lights with Home Assistant and MQTT by Leon Anavi

In this presentation you will learn the exact steps for using MQTT JSON Light component of the open source home automation platform Home Assistant for controlling lights through the machine-to-machine protocol MQTT. Practical examples for low cost devices combining together open source hardware with free and open source software will be revealed. The presentation will provide general overview of Home Assistant, details about the software integration of new devices to it through the MQTT protocol and open source MQTT brokers such as Mosquitto. We will do a code review of an open source Linux daemon application for Raspberry Pi, written in the C programming language and based on the Paho library for MQTT client and the piGPIO library used for pulse-width modulation (PWM) control of a RGB LED strip. We will compare it to an implementation of the same features for the microcontroller with WiFi ESP8266 written as a sketch for the Arduino environment. Furthermore, the presentation will include details about reading data from various sensors and their setup in Home Assistant.

  • 10:25 – 10:50 – Accessing your Mbed device from anywhere using Pagekite by Bert Outtier

When looking at home automation solutions available in the market nowadays, one of the most important and expected features is to be able to control your home automation installation from anywhere in the world using a smartphone app. A vendor of a low-cost home automation solution requested us to add such a feature to their existing IP gateway product, which only allowed for users to control their home automation system with their smartphone while they are connected to their local network at home. We were asked to make it possible to let the smartphone app connect to the IP gateway from anywhere in the world. This vendor’s IP gateway hard- and software was based on the Mbed platform, so they needed a solution that could fit within Mbed.

Since our client wanted an open-source, secure, low-cost and easy to set up solution that he could host himself, we opted to go for Pagekite. However, since Mbed does not support OpenSSL, Linux sockets or libev, the existing libpagekite C library was not an option to start from. So we started to implement a Mbed flavour of the library ourselves, and decided to make it open-source

  • 11:00 – 11:30 – The free toolchain for the STM8 by Philipp Klaus Krause

The STM8 is a popular 8-bit architecture by ST Microelectronics commonly used in household electronics, automotive application and industrial controls. For quite a while there were no free tools, and the irregular architecture makes it hard to support in GCC or LLVM. In recent years free tools for it started to appear and now form a free toolchain that surpassed preexisting non-free ones. The most important part is the Small Device C Compiler (SDCC). New tree-decomposition-based algorithms from recent compiler research have been implemented in SDCC, including a new register allocator particularly suited to irregular architectures with few registers. SDCC quickly surpassed the non-free compiler in standard compliance and OS support and generates substantially faster integer code. Programs can be flashed by stcgal (via a serial link on STM8 devices that have a bootloader) and stm8flash (via the SWIM interface of ST-LINK hardware). OpenOCD and GDB allow on-target debugging via the ST-LINK. IDEs complete the development environment. However, stcgal still needs non-free binary blobs for use with some devices and the ST-LINK has non-free firmware. SDCC still falls short in floating-point performance. While there are some ports of free RTOSes that use the free toolchain for the STM8, more would be desirable.

  • 11:30 – 12:00 – Building RT Linux distribution with Yocto by Pierre Ficheux

The conference will describe how to use PREEMPT_RT and Xenomai with Yocto build system – building image and SDK – developing simple application – testing performances.

Using RT extension with Yocto is not that easy because linux-yocto-rt kernel is not usable on main embedded target such as ARM (as it works on QEMU target only). Using Xenomai is much more complicated as it needs several steps (patching the kernel, installing user-space libraries, building an extended SDK).

During the conference we will describe how to build a Yocto Linux image using PREEMPT_RT for famous boards such as Pi 3 or BeagleBone Black.

Some Xenomai support is provided by meta-eldk from DENX but it supports only Xenomai 2.6. We will describe meta-xenomai as we maintain it for our customers (available on GitHub). That new meta-xenomai layer is based on Xenomai 3.x and very recent kernel.

Then we will explain how to build a simple Xenomai application based on a periodic task. Finally we will compare performances of both extension (PREEMPT_RT and Xenomai) on same hardware.

  • 12:00 – 13:00 – How to keep your embedded Linux up and running? by Krzysztof Opasiak

Userspace software is imperfect and we all know about this. Running it for 5 minutes seems to be easy but what about days or weeks? This problem already gave server guys a lot of sleepless nights. Nowadays also IoT and embedded Linux world is facing very the same problem. Unfortunately solutions known from server world (Nagios and friends) usually cannot be directly applied.

During this talk, Krzysztof will discuss problems related to monitoring and “healing” embedded Linux distribution. First, most common server approaches will be described. After that, Krzysztof will try to identify key problems of applying this solution to embedded platform. Then Krzysztof will introduce faultd – small but extendable daemon for system monitoring and CPR;). How to use it? What can it do? What are the advantages and disadvantages? All those questions should be answered in this part. Last part is going to be a discussion on a presented idea and experience sharing.

  • 13:05 – 13:30 – A Guided Tour of Eclipse IoT: 3 Software Stacks for IoT by Benjamin Cabé

Whether you’re looking at the constrained devices that make for the “things” of the IoT, gateways that connect them to the Internet, or backend servers, there’s a lot that one needs to build for creating end-to-end IoT solutions. In this session, we will look at the typical software features that are specific to IoT, and see what’s available in the open source ecosystem (and more specifically Eclipse IoT) to implement them. A live demo of the Eclipse IoT Open Testbed for Asset Tracking will allow the audience to see some of the projects (such as Eclipse Kura, or Eclipse Kapua) in action.

  • 13:45 – 14:10 – Tizen:RT A lightweight RTOS platform for low-end IoT devices by Philippe Coval

The Tizen software platform has been designed to target consumer electronics, since 2013 the OS is powering many products on the market (from smart watches to TVs, cameras or even white goods). Even if this Linux based platform is very flexible, the Linux kernel has minimum size requirements, so Tizen can’t be deployed on constrained devices (ubiquitous microcontrollers).

To also target low end devices part of Tizen’s technology was rebased on NuttX RTOS. Seamless connectivity is still provided by IoTivity, while a new IoT features are becoming available to application developers too, this whole stack is Tizen:RT!

This presentation will give an overview of Tizen ecosystem, and explain how to get started with Tizen:RT using QEmu, SDK, finally an IoT scenario will be demonstrated on trusted system on module ARTIK 055s.

  • 14:25 14:50 – Eclipse IoT FOSS Platform for Cloud Based IoT Solutions by Steffen Evers

It is expected that in the next years billions of devices will be connected to the Internet of things (IoT). Many of them will interact with cloud-based solutions to provide additional services on the devices or in the web. To bring IoT to the next level technologies for supporting cross-domain/cross-vendor solutions are needed. There is already a lot FOSS available to provide a technological base for building IoT solutions (e.g. Kubernetes). However, on top of it, software is needed for the connectivity challenges, support of domain-specific protocols, large scale messaging and device management and integration with existing infrastructure. Eclipse IoT aims to address these needs and provide an FOSS IoT framework that makes IoT development fast and simple. In the last year Eclipse IoT has made a lot of progress and the underlying environment in cloud technology has seen a lot of changes. In addition, upcoming challenges like automated driving and connected vehicles have resulted in new projects for better support for the automotive domain. This talk gives you an overview of major Eclipse IoT projects and illustrates its capabilities with a short demo.

  • 15:05 15:30 – IoT.js – A JavaScript platform for the Internet of Things by Ziran Sun

IoT.js is a JavaScript platform that aims to provide inter-operable services for IoT world. Powered by JerryScript, an ultra-lightweight modular JavaScript engine, the platform is designed to bring the success of Node.js to constrained IoT devices. To address interoperability, IoT.js has provided a Node.js friendly architecture and comes with a subset of Node.js APIs. Since Samsung OSG first presented IoT.js in FOSDEM in 2016, the platform has been through a rapid growth in last couple of years. With a lot active high-quality contributions from the IoT.js and JerryScript open source community, IoT.js has released version 1.0 in July 2017 which presented a rich set of features, hardware and tool supports for developers. In this talk, we are looking at recent developments in IoT.js and share our vision for future plans. The talk is supported by a demo of iot.js running on constrained device seamlessly connects to node.js for third party cloud access.

  • 15:45 – 16:10 – The dark side of Internet of things by Dipesh Monga

With the advent of the Internet of things, monitoring and controlling everything such as coffee maker, lights, TV, Fridge,etc. over the Internet has become a child’s play. But are we really making our lives simpler or diving ourselves in a vast ocean which is getting deeper and deeper? In today’s world where the security of our data of a major concern, the number of websites are always tracking what we search for, what we watch, our location and now when things are limited to only data, adding another dimension i.e. physical entities is really a big question.

From this talk audience will take away an understanding of the privacy concerns related to IoT, and how they may be putting their personal information at risk by connecting my physical entities to the Internet. Is it really safe to connect things to the Internet?

  • 16:30 – 17:00 – Facing the Challenges of Updating Complex Systems by Enrico Jörns

Over the past three years, the growing zoo of Open Source update frameworks made updating an embedded Linux system much easier. But, the availability of a robust update tool solves only one step in the complex chain from a software artifact to an updated and working system on your devices.

Starting with a modern system consisting of a recent bootloader, kernel, init system and update tool, this talk ventures beyond the basic and already solved topics of A/B redundancy, atomicity, or simple update verification.

Enrico will present strategies for creating a robust update chain from automated testing up to full rollout management and show how to solve these challenges with recent Open Source software such as barebox, RAUC, systemd, hawkBit, casync and labgrid. You will learn how to deal with more modular and complex system setups, restricted systems, error recovery, product variants, resigning for deployment, updating the bootloader itself and interaction with verified boot.

  • 17:00 – 18:00 – Multitasking on Cortex-M class MCUs, A deep-dive into the Chromium-EC OS by Moritz Fischer

We’re gonna look at multi-tasking on small Cortex-M class MCUs like the ARM Cortex-M0. After a brief general overview of the Cortex-M0 programming model, exception handling and other basics required, we’ll start our deep-dive into one specific implementation in the Chromium-EC firmware. We’ll look at startup code, how tasks are implemented, how to deal with priorities and peripheral interrupts.

The Chromium-EC firmware is a little (RT)OS that runs (mostly) on ARM cores of the Cortex-M class (M0/M3/M4), and powers Google’s Chromebooks as well as other devices (Project Sulfur SDR). It’s permissive license makes it attractive for (ab)use in other projects, since Kernel and U-Boot integration are already existing.

  • 18:00 – 18:30 –  The Chromium project’s Way to Wayland by Maksim Sisov

Wayland is the most advanced X11-alternative display protocol, shipping today in a variety of desktop and embedded environments. Although the Chromium browser on Linux still defaults to use the X11 window system, there have been efforts to port it to different environments.

This effort happens in various fronts, including the development and stabilization of Ozone, an abstraction layer for graphics and input events, and the transitioning of some ChromeOS-oriented solutions to Linux, for example Chromium’s new “UI service”.

Igalia has been actively contributing to this multi organizational collaboration, aiming at getting a full fledged Chromium browser running natively on Wayland. The work happens on Chromium’s upstream repository so that the greater Chromium community can benefit from it.

  • 18:30 19:00 – GStreamer for tiny devices by Olivier Crête

GStreamer is a complete Open Source multimedia framework, and it includes hundreds of plugins, including modern formats like DASH, HLS or the first ever RTSP 2.0 implementation. The whole framework is almost 150MB on my computer, but what if you only have 5 megs of flash available? Is it a viable choice? Yes it is, and I will show you how.

Starting with simple tricks like only including the necessary plugins, all the way to statically compiling only the functions that are actually used to produce the smaller possible footprint.

Sunday 4, 2018

  • 09:30 10:00 – Programming UEFI for dummies, what I have learned while tweaking FreePascal to output UEFI binaries by Olivier Coursière

With the upcoming end of legacy mode in UEFI firmware on PCs, every alternative and hobbyist operating systems, bare metal programmers and wannabe OS developers will have to deal with UEFI on modern hardware. After presenting the binary format of UEFI applications, I will focus on the use of UEFI APIs through EFI system table and UEFI protocols so you can get started.

  • 10:00 – 10:30 – Rustyarm AKA A project looking at Rust for Embedded Systems by Benedict Gaster (cuberoo_)

Rustyarm is a project in the Physical Computing group at the University of West of England looking at application of Rust on embedded micro controllers. UWE Sense is a new hardware and software platform for IoT, build with ARM micro controllers, Bluetooth LE and LoRaWAN, which runs a software stack written completely in Rust. While UWE Sense is a close to the metal implementation, UWE Audio, a new hardware platform for studying high performance audio using ARM micro controllers, uses Rust to implement a monadic reactive graph, supporting both an offline compiler and and Embedded DSL. UWE Audio uses safe Rust, for example, describing domain clock as generic associated types, providing both compile time guarantees that multiple streams will not be incorrectly sequenced at different sample rates, and the ability to dynamically compile for different parts of the system.

In this talk I will provide a high-level overview of the Rustyarm project, including how using Rust has made this project interesting, but also enabled providing guarantees with respect to the audio scheduler, for example. However, Rust has some short comings in the embedded domain and we provide details on some of these and what we and the wider community are doing to address them. As an example of Rust’s application in the embedded domain we present early work on UWE Audio and hardware and software platform for building digital music instruments, which as already noted is programmed with solely in Rust.

  • 10:30 – 11:00 – How to build an autonomous robot for less than 2K€ by Miika Oja (PuluMan)

Telepresence, Delivery Boy, Security and Follow Me in one PULUrobot. PULUrobot solves the autonomous mobile robotics complexity issue without expensive parts, without compromise. By fearless integration and from-scratch design, our platform can do SLAM, avoid obstacles, feed itself, and carry payload over 100kg, for less than 2000EUR.

Application ecosystem can be born around it, as we offer a ready-made Open Source (GPLv2) solution in a tightly coupled HW-SW codesign. Pulu Robotics Oy was founded in July, 2017, in Finland, to solve our own needs, with an efficient team of three. No one had prior knowledge on robotics.

By studying the market and other startups, we realized the common mistake is to use “robotic modules” as building blocks. They are highly expensive, provide little bang for buck, often are inefficient, and require complex software middleware (such as ROS) as the glue inbetween. Due to our combined background in mechanical, electrical, software and manufacturing design, we took the approach of designing as much as possible by ourselves.

We are now selling the very first generation of robots for the early adopters, hoping to give a kick start to the open source community as soon as possible. Behind the curtains, we are focusing on the development of our next 3D sensor system, which will replace the current scanning 2D lidar with a 360×90 degree full 3D distance data, and do it for the same price we currently pay for the Scanse 2D lidar used in the first small-scale production batch.

  • 11:00 – 11:30 – … like real computers! Making distributions work on single board computers by Andre Przywara

Installing an operating system on single board computers (SBCs or “Fruit-Pis”) is very board specific and requires a lot of hand holding. If at all, standard distributions support only a small number of them explicitly, which leads to a lot of board specific images and distributions. This talk will show how this situation can be improved, to the point where off-the-shelf Linux (or BSD) distributions can be installed on those boards, without those distros knowing about each and every one of them. Key ingredients are standardized firmware interfaces like UEFI, stable device trees and on-board memory like SPI flash. This should make using ARM based SBCs as easy as using (x86) PCs today: like “real computers”. On top of this, ways to simplify and speed up mainline Linux kernel support are explored. Enabling kernel support for new SoCs usually takes a while, especially if the effort is driven by the community. This delays distribution support, up to a point where a certain SoC or board might become slightly dated when it’s finally supported. Using more device tree features and less hardcoded kernel data would reduce the code required to support new SoCs, ideally reaching a point where new SoCs could be at least booted with existing (distribution!) kernels, just by providing the proper device tree blob. This talk describes the idea and gives an example by looking at what can be done on Allwinner SoCs.

  • 11:30 – 12:00 – Booting it successfully for the first time with mainline by Enric Balletbo Serra

While things have gotten a lot better, new hardware bring-up sometimes still feels like pulling teeth. With the right methodology, tools and techniques, a significant amount of time, energy (and sanity) can be saved while enabling a new board to run Linux. In this talk, we’ll discuss the phased process involved in new board bring-up and the challenges it can pose, from reviewing initial schematic design to the successful upstreaming of any necessary bootloader and kernel patches. We’ll also provide some examples of the process based on a board that was recently made compatible with mainline.

  • 12:00 – 12:30 – SITL bringup with the IIO framework, bootstrapping a x86 based drone platform by Bandan Das

This talk aims at an introduction to using the Industrial IO(IIO) framework to initialize sensors and acquire data to feed to a Software in the Loop (SITL) interface of drone software such as iNav/Cleanflight. Most flight controller boards are based on low power ARM microcontrollers and the flight controller software is not usually based on Linux. However, with the availability of increasingly powerful boards with onboard sensors and multicore processors, using a Linux based flight controller software can be used to our advantage. Experimenting with onboard devices and scheduling algorithms can lead to interesting applications with minimal porting overhead to new architectures.

The talk starts with a quick overview of the IIO framework and using it to initialize the drivers for the onboard sensors of the Intel Aero platform, a x86 based flight controller board. Although, not tied to the Aero board in any way, this talk will use this board as an example to describe the onboard sensors and acquire data from them to successfully run a minimal SITL instance. The talk aims to explore how the IIO framework exposes data from these sensors and how users can utilize these interfaces followed by a demo of the setup.

  • 12:30 – 13:00 – Rapid SPI Device Driver Development over USB by Stefan Schmidt

On the quest for a cheap and easy way to connect some simple SPI devices to my laptop it was surprising to not find anything suitable available. The idea is neither new nor innovative and surely there must have been something already.

Maybe the use-case was to special. To connect the SPI device to a Linux laptop over USB in order to develop a SPI kernel driver for it and having a rapid development and test cycle. None of the solutions to access the SPI device over libusb in userspace would work for me. I needed a SPI master controller in kernelspace to work with the variety of devices and kernel subsystems.

After some research I settled on the MCP2210 chip. With its cheap and easy to get development boards and an out-of-tree driver as a good start. Maybe it is also something others are looking for and it is surely worth demonstrating and explaining.

  • 13:00 – 14:00 – Implementing state-of-the-art U-Boot port, 2018 edition by Marek Vasut

This presentation is a practical guide to implementing U-Boot port to a new system from scratch. U-Boot is the de-facto standard bootloader for embedded systems, there is plenty of U-Boot ports, yet vast majority of those are implemented in sub-optimal way. This talk first explains the U-Boot internals, the driver model (DM) and it’s interaction with device tree (DT), as understanding these is vital to understanding the implementation of core subsystems. The core subsystems are explained in detail afterward to allow developers implement drivers the intended way without hacks and workarounds. Unfortunately, not all systems have plenty of resources, but U-Boot caters for those as well. The final part of the talk discusses the U-Boot SPL, the preloader which initializes the hardware, DRAM and starts U-Boot and finer parts of this procedure, which tends to have plenty of pitfalls.

  • 14:00 – 15:00 – Image capture on embedded linux systems by Jacopo Mondi

Image capture is one of the most broad and complex fields of today’s computing applications. Capturing and displaying images with an embedded platform poses additional challenges, introduced by the rapidly increasing complexity of dedicated hardware blocks often found on modern Systems On Chip designed for mobile and industrial computing. Using real world examples of image sensors, connection buses and processing blocks this presentation provides an overview of current industry standard technologies with an introduction to Video4Linux2 kernel framework for driver development and its userspace APIs.

  • 15:00 – 16:00 – ARM64 + FPGA and more: Linux on the Xilinx ZynqMP by Luca Ceresoli

The Xilinx Zynq UltraScale+ MPSoC (aka ZynqMP) is a powerful and complex chip featuring 64-bit cores, 32-bit realtime cores, a large FPGA, a GPU, video codecs and dedicated power management and security units.

The main topics covered will be:

  • Overview of the hardware.
  • Available software support from Xilinx and from the community.
  • How the peculiar CPU+FPGA design effectively allows to design “your own SoC”, with the technical steps to implement this with Linux.
  • Why booting is nontrivial on this SoC and the currently available ways to boot Linux.
  • Handling the H.264/H.265 hardware codecs.
  • GPU support issues.

Focus will be given to how much open source technologies can be used with the ZynqMP SoCs, why this matters, and the current status of open source resources with respect to the alternatives.

  • 16:00 – 16:50 – New GPIO interface for linux user space by Bartosz Golaszewski

Since linux 4.8 the GPIO sysfs interface is deprecated. Due to its many drawbacks and bad design decisions a new user space interface has been implemented in the form of the GPIO character device which is now the preferred method of interaction with GPIOs which can’t otherwise be serviced by a kernel driver. The character device brings in many new interesting features such as: polling for line events, finding GPIO chips and lines by name, changing & reading the values of multiple lines with a single ioctl (one context switch) and many more. In this presentation, Bartosz will showcase the new features of the GPIO UAPI, discuss the current state of libgpiod (user space tools for using the character device) and tell you why it’s beneficial to switch to the new interface.

FOSDEM 2018 will take place at the ULB Solbosch Campus in Brussels, Belgium, attendance is free of charge, and no registration is required.

Learn More About Linux’s New GPIO User Space Subsystem & Libgpiod

November 3rd, 2017 10 comments

Sysfs was used to control GPIOs on Linux system with the GPIOs defined in /sys/class/gpio, but starting with Linux 4.8, a new GPIO interface for user space was introduced, with gpiochip becoming char devices foudn in /dev/gpiochip0, dev/gpiochip1, etc.. , and sysfs allegedly become deprecated.

But a quick check in NanoPi Duo with Linux 4.11 shows both GPIO user space interfaces appear to be enabled:

Nevertheless overtime, sysfs will die out, and the new subsystem will likely be used by all systems, so it might be useful to learn more about it.

One way to do that is to watch Bartosz Golaszewski’s ELCE 2017 talk entitled “New GPIO Interface for User Space” with the video embedded below. But I first I’ll summarize some of the key points.

Now GPIO handling from user space becomes similar to other char driver with ioctl, poll and read functions, and beside assigning numbers to GPIOs you can assign names. The API (in linux/gpio.h) provides access to chip info, line info, line request for values, reading values, settings values, line request for events (rise/falling edges), polling for events, and reading events. Bartosz goes into details for each function in his talk.

Since the kernel API is a bit complicated to use, there’s also a C library called libgpiod, which comes with some tools like gpiodetect, gpioinfo, gpioset, gpioget, gpiofind & gpiomon. Further work includes C++ and Python bindings, as well as a GPIO daemon and client. Example code for libgpiod:

Some example of user space tools found in libgpiod:

The first command return the list of gpio chips, their names, and number of lines, the second set the 3rd pin of Chip 1 to high, the third return the values of 5 different pins, and the last one monitor a pin to detect an event and return the time when it happened.

You can check out the latest libgpiod source code, or download the latest stable release of the code as a tarball. libgpiod is already available in meta-openembedded & buildroot, and packaged in Fedora and Arch Linux.

You may also be interested in the slides.

Getting Started with MicroPython on ESP32 – Hello World, GPIO, and WiFi

October 16th, 2017 18 comments

I’ve been playing with several ESP32 boards over the months, and tried several firmware images. I started with a tutorial for Arduino Core on ESP32, a few month later I tested ESP32 JavaScript programming with Espruino on ESPino32 board, and recently Espressif Systems sent me ESP32 PICO core development board powered by their ESP32-PICO-D4 SiP, and while I took some pretty photos, I had not used it so far.

So I decided to go with yet another firmware, and this time, I played with MicroPython on ESP32, and will report my experience with basic commands, controlling GPIOs, and WiFi in this getting started post.

Flashing Micropython Firmware to ESP32 Board

Source code is available on Github, as a fork of MicroPython repo as ESP32 support has not been upstreamed yet. We could built the firmware from source, but there’s also a pre-built binary which you can download on MicroPython website.

I’ll be using Ubuntu 16.04 for the instructions, which should be pretty similar for other Linux distributions, especially the ones based on Debian, and if you’re using Windows 10, you should be able to follow the same instructions after installing Windows Subsystem for Linux with Ubuntu on your computer.

Let’s open a terminal, to download the firmware (October 14):

If you have not done so already, install the latest version of esptool:

Now connect the board via a micro USB to USB cable to your computer. The log should like like:

In my case, the device is ttyUSB0, but it may vary depending on the board used. We can now erase the flash, and copy the firmware to the board:

If the last step is successfull,  the output should be similar to the one below:

As a side note, version 2.1 of esptool does not know about ESP32-PICO-D4, but it can still detect an ESP32 device, and the update went through normally.

Hello World Sample / Boot Log with MicroPython

We can test the firmware, by connecting to the board using minicom, screen, putty, or whatever software you feel most comfortable with. I went with minicom, setup a connection to /dev/ttyUSB0 device with 115200 bps baudrate. I immediately tested the print function, and made an hard reset to check out the boot log:

The reset command will first generate some errors message, before rebooting the board:

We can type help function to get some more help:

I also often refered to MicroPython 1.9.2 documentation to write this quick start guide.

LED Blink Sample with MicroPython

The easiest way to test GPIOs is to connect an LED, since the board does not have any user LED, only the power LED. So I connected an LED to pin 21 via a transistor to ensure enough current passes through it.

Controlling the LED in the command line interface is easy. Import the machine library, set the pin to output, and change the pin level as needed:

Success! But what about doing a proper blink sample? MicroPython developers’ official PyBoard would show as a USB mass storage drive in you computer, where can copy Python files like boot.py and main.py files, but in the case of ESP32 PICO core, it appears the only option is to use the serial console for programming, as we can’t simply copy files to the board from the host computer.

I  found a solution on Techtutorialsx – which also has plenty of articles about MicroPython on ESP32/ESP8266. We need ampy script that can be install from our Linux terminal:

However, the first time I tried it I got an error:

I installed files module, but the error remained. So instead I installed it for Python 3:

I then created blink.py on my computer to blink the LED every 500 ms:

Before uploading the file to the board, you can try to run it as follow:

If you have plenty of errors here, that’s probably because your code is incorrect. Since I’m not very familiar with Python, it happened to me a couple of times, until I got the code right, and the LED was blinking as expected.

Now that we’ve made sure the code works, we can now copy our sample to the board…

… reconnect to the serial console, and verify the file is there:

To run the program type the following:

The LED should blink again. You can interrupt the program with Ctrl+C, and if you want to soft reset the board, press Ctrl+D.

In order to automatically start the blink program at each boot, rename blink.py to main.py, delete blink.py, and copy main.py instead:

Power cycle the board, and the LED should start blinking almost immediately.

ESP32 WiFi with MicroPython (Station and AP modes)

We’ve got GPIOs working, but one of the most important feature of ESP32 is obvisouly WiFi. I’ll start by configuring the board in station mode. First import the network library, set the board to station mode, and scan access points:

The latter should return a list of access points with ssid, bssid, channel, RSSI, authmode, and hidden status as explained here.

I can then connect the board to one of the access points with:

The log above with IP address should give  a clue, but you can check connection status with the following function:

and use ifconfig to get the IP info:

Switching to AP mode is easy with the three commands below configuring the board with ESP32-PICO-CNX SSID:

At this stage I can see ESP32-PICO-CNX on my phone, but it’s an open connection. We can change that with authmode option that can take 5 values:

  • 0 – open
  • 1 – WEP
  • 2 – WPA-PSK
  • 3 – WPA2-PSK
  • 4 – WPA/WPA2-PSK

I’ll use WPA2-PSK and define the password with the config function.

Working as planned…

ESP32 Web Server with Micropython

Many ESP32 project will require a web interface for monitoring or configuration. Let’s first setup the board as an access point using the command we’ve used above:

Now create webserver.py file based on Python code found here that’s supposed to return the status of some GPIO pins in an HTML table:

Copy the file to the board:

Start the serial console again, import/run the python sample we’ve copied, and connect to the board (in my case http://192.168.4.1):

 

It works as expected, but we wrote the HTML code inside the Python file, and you need to handle socket programming by yourself. To further simply the task, some MicroPython web servers such as MicroWebSrv, and Picoweb are available.

MicroWebSrv (Not working yet for me)

I tried to install MicroWebSrv first, but never managed to make it work. I still reproduce the step I followed in case somebody finds out what I did wrong. I got the code, and copied files from the Linux terminal:

We can check the files are where they are supposed to be:

Go into the terminal (aka REPL console) to start a basic example, after setting up a connection:

I could connect to the server, but I would always get 404 error.

PicoWeb

So instead I switched to picoweb, adapting the instructions here and there. It’s very easy to install.  First make sure you have a working Internet connection in your board (i.e. set station mode), and install the web server with upip:

That’s the output if everything goes according to plans:

Now let’s go back to the host computer to create an html document, for example index.html:

as well as picowebtest.py sample file that will request the HTML page from the board, and return it to the client.

You’ll need to change “192.168.0.108” by the IP address of your board.

Let’s copy both files to the board…

… go back to the serial console, connect in station mode, and run the sample:

Type or copy/paste the URL in the last line into a web browser, and you should get the output below.

ESP32 Bluetooth with MicroPython

There’s no Bluetooth support in the official MicroPython documentation, because it’s work in progress, and for the most adventurous MrSulry released an alpha version  a few days ago. The Bluetooth API is also in flux, but the basic code to enable Bluetooth should look like:

I’ll update that section once Bluetooth makes it to the stable release, and/or when I’m sure the API is frozen.

Other ESP32 (Micro)Python Resources

I’ve just covered a few things that can be done with MicroPyhon on ESP32, and beside the official documentation, you can also check the various MicroPython ESP32 tutoral on techtutorialsx blog. Loboris also made another MicroPython ESP32 firmware that supports pSRAM as MicroPython may use a lot of RAM. If you’re interested in Python for ESP32, but Zerynth is another option for Python on ESP32 that works with an IDE/GUI available for Windows, Linux and MAC OS X. [Update: Yet other options are Pumbaa a port of MicroPython running on top of Simba, and Pycom version of MicroPython]

Embedded Linux Conference & Open Source Summit Europe 2017 Schedule

August 27th, 2017 4 comments

The Embedded Linux Conference & IoT summit 2017 took place in the US earlier this year in February, but there will soon be a similar event with the Embedded Linux Conference *& Open Source Summit Europe 2017 to take up in Europe on October 23 – 25 in Prague, Czech Republic, and the Linux Foundation has just published the schedule. It’s always useful to find out what is being discussed during such events, even if you are not going to attend, so I went through the different sessions, and compose my own virtual schedule with some of the ones I find the most interesting.

Monday, October 23

  • 11:15 – 11:55 – An Introduction to SPI-NOR Subsystem – Vignesh Raghavendra, Texas Instruments India

Modern day embedded systems have dedicated SPI controllers to support NOR flashes. They have many hardware level features to increase the ease and efficiency of accessing SPI NOR flashes and also support different SPI bus widths and speeds.

In order to support such advanced SPI NOR controllers, SPI-NOR framework was introduced under Memory Technology Devices (MTD). This presentation aims at providing an overview of SPI-NOR framework, different types of NOR flashes supported (like SPI/QSPI/OSPI) and interaction with SPI framework. It also provides an overview of how to write a new controller driver or add support for a new flash device.

The presentation then covers generic improvements done and proposed while working on improving QSPI performance on a TI SoC, challenges associated when using DMA with these controllers and other limitations of the framework.

  • 12:05 – 12:45 – Free and Open Source Software Tools for Making Open Source Hardware – Leon Anavi, Konsulko Group

The open source hardware movement is becoming more and more popular. But is it worth making open source hardware if it has been designed with expensive proprietary software? In this presentation, Leon Anavi will share his experience how to use free and open source software for making high-quality entirely open source devices: from the designing the PCB with KiCAD through making a case with OpenSCAD or FreeCAD to slicing with Cura and 3D printing. The talk will also provide information about open source hardware licenses, getting started guidelines, tips for avoiding common pitfalls and mistakes. The challenges of prototyping and low-volume manufacturing with both SMT and THT will be also discussed.

  • 14:20 – 15:00 – Introduction to SoC+FPGA – Marek Vašut, DENX Software Engineering GmbH

In this talk, Marek introduces the increasingly popular single-chip SoC+FPGA solutions. At the beginning, the diverse chip offerings from multiple vendors are introduced, ranging from the smallest IoT-grade solutions all the way to large industrial-level chips with focus on their software support. Mainline U-Boot and Linux support for such chips is quite complete, and already deployed in production. Marek demonstrates how to load and operate the FPGA part in both U-Boot and Linux, which recently gained FPGA manager support. Yet to fully leverage the potential of the FPGA manager in combination with Device Tree (DT) Overlays, patches are still needed. Marek explains how the FPGA manager and the DT Overlays work, how they fit together and how to use them to obtain a great experience on SoC+FPGA, while pointing out various pitfalls.

  • 15:10 – 15:50 – Cheap Complex Cameras – Pavel Machek, DENX Software Engineering GmbH

Cameras in phones are different from webcams: their main purpose is to take high-resolution still pictures. Running preview in high resolution is not feasible, so resolution switch is needed just before taking final picture. There are currently no applications for still photography that work with mainline kernel. (Pavel is working on… two, but both have some limitations). libv4l2 is doing internal processing in 8-bit, which is not enough for digital photography. Cell phones have 10 to 12-bit sensors, some DSLRs do 14-bit depth.

Differences do not end here. Cell phone camera can produce reasonable picture, but it needs complex software support. Auto-exposure / auto-gain is a must for producing anything but completely black or completely white frames. Users expect auto-focus, and it is necessary for reasonable pictures in macro range, requiring real-time processing.

  • 16:20 – 17:00 – Bluetooth Mesh with Zephyr OS and Linux – Johan Hedberg, Open Source Technology Center, Intel

Bluetooth Mesh is a new standard that opens a whole new wave of low-power wireless use cases. It extends the range of communication from a single peer-to-peer connection to a true mesh topology covering large areas, such as an entire building. This paves the way for both home and industrial automation applications. Typical home scenarios include things like controlling the lights in your apartment or adjusting the thermostat. Although Bluetooth 5 was released end of last year, Bluetooth Mesh can be implemented on any device supporting Bluetooth 4.0 or later. This means that we’ll likely see very rapid market adoption of the feature.

The presentation will give an introduction to Bluetooth Mesh, covering how it works and what kind of features it provides. The talk will also give an overview of Bluetooth Mesh support in Zephyr OS and Linux and how to create wireless solutions with them.

  • 17:10 – 17:50 – printk() – The Most Useful Tool is Now Showing its Age – Steven Rostedt, VMware

printk() has been the tool for debugging the Linux kernel and for being the display mechanism for Linux as long as Linux has been around. It’s the first thing one sees as the life of the kernel begins, from the kernel banner and the last message at shutdown. It’s critical as people take pictures of a kernel oops to send to the kernel developers to fix a bug, or to display on social media when that oops happens on the monitor on the back of an airplane seat in front of you.

But printk() is not a trivial utility. It serves many functionalities and some of them can be conflicting. Today with Linux running on machines with hundreds of CPUs, printk() can actually be the cause of live locks. This talk will discuss all the issues that printk() has today, and some of the possible solutions that may be discussed at Kernel Summit.

  • 18:00 – 18:45 – BoF: Embedded Linux Size – Michael Opdenacker, Free Electrons

This “Birds of a Feather” session will start by a quick update on available resources and recent efforts to reduce the size of the Linux kernel and the filesystem it uses.

An ARM based system running the mainline kernel with about 3 MB of RAM will also be demonstrated. If you are interested in the size topic, please join this BoF and share your experience, the resources you have found and your ideas for further size reduction techniques!

Tuesday, October 24

  • 10:55 – 11:35 – Introducing the “Lab in a Box” Concept – Patrick Titiano & Kevin Hilman, BayLibre

Continuous Integration (CI) has been a hot topic for long time. With the growing number of architectures and boards, it becomes impossible for maintainers to validate a patch on all configurations, making it harder and harder to keep the same quality level without leveraging CI and test automation. Recent initiatives like LAVA, KernelCI.org, Fuego, (…) started providing a first answer, however the learning curve remains high, and the HW setup part is not covered.

Baylibre, already involved in KernelCI.org, decided, as part of the AGL project, to go one step further in CI automation and has developed a turnkey solution for developers and companies willing to instantiate a LAVA lab; called “Lab in a Box”, it aims at simplifying the configuration of a board farm (HW, SW).

Motivations, challenges, benefits and results will be discussed, with a demo of a first “Lab in a Box” instantiation.

  • 11:45 – 12:25 – Protecting Your System from the Scum of the Universe – Gilad Ben-Yossef, Arm Holdings

Linux based systems have a plethora of security related mechanisms: DM-Crypt, DM-Verity, Secure Boot, the new TEE sub-system, FScrypt and IMA are just a few examples. This talk will describe these the various systems and provide a practical walk through of how to mix and match these mechanisms and design them into a Linux based embedded system in order to strengthen the system resilience to various nefarious attacks, whether the system discussed is a mobile phone, a tablet, a network attached DVR, a router, or an IOT hub in a way that makes maximum use of the sometime limited hardware resources of such systems.

  • 14:05 – 14:45 – Open Source Neuroimaging: Developing a State-of-the-Art Brain Scanner with Linux and FPGAs – Danny Abukalam, Codethink

Neuroimaging is an established medical field which is helping us to learn more about how the human brain works, the most complex human organ. This talk aims to cover neuroimaging systems, from hobbyist to professional, and how open source has been used to build state-of-the-art systems. We’ll have a look the general problem area, why open source was a good fit, and some examples of solutions including a commercial effort that we have been involved in bringing to market. Typically these solutions consist of specialist hardware, a bespoke software solutions stack, and a suite to manage and process the vast amounts of data generated during the scan. Other points of interest include how we approached building a maintainable and upgradeable system from the outset. We’ll also talk about future plans for neuroimaging, future ideas for hardware & discuss areas lacking good open source solutions.

  • 14:55 – 15:35 – More Robust I2C Designs with a New Fault-Injection Driver – Wolfram Sang, Renesas

It has its challenges to write code for certain error paths for I2C bus drivers because these errors usually don’t happen on the bus. And special I2C bus testers are expensive. In this talk, a new GPIO based driver will be presented which acts on the same bus as the bus master driver under inspection. A live demonstration will be given as well as hints how to handle bugs which might have been found. The scope and limitations of this driver will be discussed. Since it will also be analyzed what actually happens on the wires, this talk also serves as a case study how to snoop busses with only Free Software and OpenHardware (i.e. sigrok).

  • 16:05 – 16:45 – GStreamer for Tiny Devices – Olivier Crête, Collabora

GStreamer is a complete Open Source multimedia framework, and it includes hundreds of plugins, including modern formats like DASH, HLS or the first ever RTSP 2.0 implementation. The whole framework is almost 150MB on my computer, but what if you only have 5 megs of flash available? Is it a viable choice? Yes it is, and I will show you how.

Starting with simple tricks like only including the necessary plugins, all the way to statically compiling only the functions that are actually used to produce the smaller possible footprint.

  • 16:55 – 17:35 – Maintaining a Linux Kernel for 13 Years? You Must be Kidding Me. We Need at Least 30? – Agustin Benito Bethencourt, Codethink Ltd

Industrial grade solutions have a life expectancy of 30+ years. Maintaining a Linux kernel for such a long time in the open has not been done. Many claim that is not sustainable, but corporations that build power plants, railway systems, etc. are willing to tackle this challenge. This talk will describe the work done so far on the kernel maintenance and testing front at the CIP initiative.

During the talk it will be explained how we decide which parts of the kernel to cover – reducing the amount of work to be done and the risk of being unable to maintain the claimed support. The process of reviewing and backporting fixes that might be needed on an older branch will be briefly described. CIP is taking a different approach from many other projects when it comes to testing the kernel. The talk will go over it as well as the coming steps. and the future steps.

Wednesday, October 24

  • 11:05 – 11:45 – HDMI 4k Video: Lessons Learned – Hans Verkuil, Cisco Systems Norway

So you want to support HDMI 4k (3840×2160) video output and/or video capture for your new product? Then this is the presentation for you! I will describe the challenges involved in 4k video from the hardware level, the HDMI protocol level and up to the kernel driver level. Special attention will be given to what to watch out for when buying 4k capable equipment and accessories such as cables and adapters since it is a Wild, Wild West out there.

  • 11:55 – 12:35 – Linux Powered Autonomous Arctic Buoys – Satish Chetty, Hera Systems 

In my talk/presentation, I cover the technical, and design challenges in developing an autonomous Linux powered Arctic buoy. This system is a low cost, COTS based, extreme/harsh environment, autonomous sensor data gathering platform. It measures albedo, weather, water temperature and other parameters. It runs on a custom embedded Linux and is optimized for efficient use of solar & battery power. It uses a variety of low cost, high accuracy/precision sensors and satellite/terrestrial wireless communications.

I talk about using Linux in this embedded environment, and how I address and solve various issues including building a custom kernel, Linux drivers, frame grabbing issues and results from cameras, limited power challenges, clock drifts due to low temperature, summer melt challenges, failure of sensors, intermittent communication issues and various other h/w & s/w challenges.

  • 14:15 – 14:55 – Linux Storage System Bottleneck for eMMC/UFS – Bean Huo & Zoltan Szubbocsev, Micron

The storage device is considered a bottleneck to the system I/O performance. This thinking drives the need for faster storage device interfaces. Commonly used flash based storage interfaces support high throughputs, eg. eMMC 400MB/s, UFS 1GB/s. Traditionally, advanced embedded systems were focusing on CPU and memory speeds and these outpaced advances in storage speed improvements. In this presentation, we explore the parameters that impact I/O performance. We describe at a high level how Linux manages I/O requests coming from user space. Specifically, we look into system performance limitations in the Linux eMMC/UFS subsystem and expose bottlenecks caused by the software through Ftrace. We show existing challenges in getting maximum performance of flash-based high-speed storage device. by this presentation, we want to motivate future optimization work on the existing storage stack.

  • 15:05 – 15:45 – New GPIO Interface for User Space – Bartosz Golaszewski

Since Linux 4.8 the GPIO sysfs interface is deprecated. Due to its many drawbacks and bad design decisions a new user space interface has been implemented in the form of the GPIO character device which is now the preferred method of interaction with GPIOs which can’t otherwise be serviced by a kernel driver. The character device brings in many new interesting features such as: polling for line events, finding GPIO chips and lines by name, changing & reading the values of multiple lines with a single ioctl (one context switch) and many more. In this presentation, Bartosz will showcase the new features of the GPIO UAPI, discuss the current state of libgpiod (user space tools for using the character device) and tell you why it’s beneficial to switch to the new interface.

  • 16:15 – 16:55 – Replace Your Exploit-Ridden Firmware with Linux – Ronald Minnich, Google

With the WikiLeaks release of the vault7 material, the security of the UEFI (Unified Extensible Firmware Interface) firmware used in most PCs and laptops is once again a concern. UEFI is a proprietary and closed-source operating system, with a codebase almost as large as the Linux kernel, that runs when the system is powered on and continues to run after it boots the OS (hence its designation as a “Ring -2 hypervisor”). It is a great place to hide exploits since it never stops running, and these exploits are undetectable by kernels and programs.

Our answer to this is NERF (Non-Extensible Reduced Firmware), an open source software system developed at Google to replace almost all of UEFI firmware with a tiny Linux kernel and initramfs. The initramfs file system contains an init and command line utilities from the u-root project, which are written in the Go language.

  • 17:05 – 17:45 – Unikernelized Real Time Linux & IoT – Tiejun Chen, Vmware

Unikernel is a novel software technology that links an application with OS in the form of a library and packages them into a specialized image that facilitates direct deployment on a hypervisor. But why these existing unikernels have yet to gain large popularity broadly? I’ll talk what challenges Unikernels are facing, and discuss exploration of if-how we could convert Linux as Unikernel, and IoT could be a valuable one of use cases because the feature of smaller size & footprint are good for those resource-strained IoT platforms. Those existing unikernels are not designed to address those IoT characters like power consumption and real time requirement, and they also doesn’t support versatile architectures. Most existing Unikernels just focus on X86/ARM. As a paravirtualized unikenelized Linux, especially Unikernelized Real Time Linux, really makes Unikernels to succeed.


If you’d like to attend the real thing, you’ll need to register and pay a registration fee:

  • Early Registration Fee: US$800 (through August 27, 2017)
  • Standard Registration Fee: US$950 (August 28, 2017 – September 17, 2017)
  • Late Registration Fee: US$1100 (September 18, 2017 – Event)
  • Academic Registration Fee: US$200 (Student/Faculty attendees will be required to show a valid student/faculty ID at registration.)
  • Hobbyist Registration Fee: US$200 (only if you are paying for yourself to attend this event and are currently active in the community)

There’s also another option with the Hall Pass Registration ($150) if you just want to network on visit with sponsors onsite, but do not plan to attend any sessions or keynotes.

ROCK64 Board Review – Part 2: Quick Start Guide with Ubuntu 16.04.3 MATE, Multimedia Features, Some Benchmarks

August 7th, 2017 23 comments

Pine64 ROCK64 is the first maker board based on Rockchip RK3328 processor, and is potentially interesting for various applications including network storage thanks to USB 3.0 and Gigabit Ethernet, multimedia applications with 4K HDR video support, as well as other applications requiring I/Os. I’ve already tested Rock64 board with Android 7.1 operating system, so today I’ll report by finding and experience with Ubuntu 16.04.3 with MATE desktop.

Selecting and Flashing a Linux Image

You’ll find several operating systems in the Wiki, but you’ll also find more cutting edge images in ayufan’s github. But first let me explain some vocabulary used for Pine64 firmware files:

  1. Engineering version – Becomes with release build based on the stock build develop by Pine64 and the SoC vendor. It’s supposed to be more stable, but get less updates
  2. Community versions (currently managed via ayufan) are more frequently updates, and comes with more recent features. You’ll find two categories
    1. Release builds – The current stable version released by the community
    2. Pre-release builds – Version under test to eventually become the release build

Currently, documentation is still work in progress for the board, so I spent some time on IRC #Rock64 chatting with the helpful community there, and I noticed most of them used the community builds. I’ve also been told there has not been that much work on the Desktop version right now, with most people focusing on NAS support with images such as Debian + OpenMediaVault. But since I wanted to test a desktop image I was recommended the Ubuntu Mate image, and download the pre-release 64-bit version: xenial-mate-rock64-0.4.17-85-arm64.img.xz.

If you’ve read the WIki, you’ll notice all those are “micro SD” images, so since I had a eMMC flash module, I was a little confused at the beginning, but since I have Hardkernel’s micro SD to  eMMC flash module adapter, installation was just the same as on a micro SD card with Etcher.

Top to Bottom: ROCK64’s 16GB eMMC flash Module, Hardkernel adapter, and micro SD card reader

But Pine64 does not sell such adapter, so how are you supposed to do with you bought an eMMC flash module? I’ve been explained you first need to flash a micro SD card with the image, and then interrupt the boot in u-boot (USB to TTL debug board required), remove the eMMC jumper, and continue the boot by typing “boot”. This has be to be done, or you won’t see the eMMC flash module, while booting from a micro SD card.

Now you can download, and flash the firmware to the eMMC flash module with curl:

Not the most user-friendly method, but it should work. If you don’t have a USB to TTL board, first you should really buy one, but for this specific case, you could remove the eMMC jumper about two seconds after applying power. In that case, your mileage may vary though… Pine64 is working on an easier method of installation to the eMMC flash module.

Rock64’s Ubuntu 16.04.3 MATE Boot, System Info, and Initial Setup

Since I want to get the boot log, I connected the USB to TTL board. There’s no dedicated UART connected on the board, so I download the GPIO pinout charts for Pi 2 Bus and Pi 5+ Bus from the Wiki, amd we’ll use it to test GPIOs later on.

Pi 2 Bus – Click to Enlarge

 

Pi 5+ Bus – Click to Enlarge

UART Tx and Rx can be found on respectively pin 8 and 10 of Pi 2 Bus header, so I connect the debug board accordingly, together with USB keyboard and mouse, a USB harddrive, Ethernet and HDMI cables.

Click to Enlarge

Finally I put the micro SD card into the board, applied powered, and after a few seconds, I got to the Ubuntu MATE desktop. however, I only got ribberish in the serial console, which was set to 115,200 8N1, the most common settings “in the universive”. There’s currently no info about serial console setting in the Wiki, but a web search lead me to the right settings: 1,500,000 8N1, which apparently is the default in Rockchip SDK.

This high bitrate may cause troubles with some serial adapter, but after changing minicom settings accordingly, I had no trouble with the serial console. That’s the complete boot log after a reboot: