Posts Tagged ‘Linux’

Using GPIOs on NanoPi NEO 2 Board with BakeBit Starter Kit

May 21st, 2017 9 comments

NanoPi NEO 2 is a tiny 64-bit ARM development board powered by Allwinner H5 processor. FriendlyELEC sent me a couple of NEO 2 samples together with their BakeBit Start Kit with a NanoHat and various modules via GPIOs, analog input or I2C. I’ve already tested both Armbian with Linux 4.11 and Ubuntu Core Qt with Linux 3.10, and ran a few benchmarks on NanoPi NEO 2. You would normally prefer to use the Armbian image with Linux mainline since it provided better performance, but at the time I was told GPIO support was not there.

Configuring NanoPi NEO 2 board with BakeBit library

So this week-end, when I decided to test GPIO support and BakeBit Starter Kit, I decided to follow this advice, especially image is still the recommended one in the Wiki. So I went with that image.

I’ll use Python examples from Bakebit library, but if you prefer something similar to WiringPi, you may consider using WiringNP library directly instead of using Bakebit. Since NanoHat Hub comes with header with digital I/O (including 2 PWM), analog input, I2C and UART interfaces, I’ll make sure I try samples for all interfaces I have hardware for. FriendlyELEC did not include a module with a UART interface, so I’ll skip that one.

I followed instructions in BakeBit wiki from a terminal which you can access from the serial console or SSH. First, we need to retrieve the source code:

Then we can start the installation:

The last line will install the following dependencies:

  • python2.7           python2.7
  • python-pip         alternative Python package installer
  • git                        fast, scalable, distributed revision control system
  • libi2c-dev           userspace I2C programming library development files
  • python-serial     pyserial – module encapsulating access for the serial port
  • i2c-tools              This Python module allows SMBus access through the I2C /dv
  • python-smbus   Python bindings for Linux SMBus access through i2c-dev
  • minicom             friendly menu driven serial communication program
  • psutil                   a cross-platform process and system utilities module for n
  • WiringNP           a GPIO access library for NanoPi NEO

This will take a while, and after it’s done, the board will automatically reboot.

We can check if everything is properly running, but try out one of the Python scripts:

hmm, python-smbus was supposed to be installed via the installation script. Let’s try to install it manually:

Running the command again with verbose option shows the download URL is not valid:

So I went to looking for another python-smbus library in case the name has changed, and I finally installed the pysmbus:

I could go further, but the I2C bus was not detected:

So maybe the driver needs to be loaded. But running sudo modprobe i2c_sunxi it does nothing, and I could notice the .ko file is missing from the image…

So let’s try to build the source code for the board following the Wiki intructions:

We also need to install required build packages…

… download gcc-linaro-aarch64.tar.xz toolchain, and copy it to lichee/brandy/toolchain directory (do not extract it, it will be done by the build script).

Now we can try to build the kernel for NanoPi NEO 2 (and other Allwinner H5 boards).

and it failed with more errors possible related to CROSS_COMPILE flag. There must be a better solution… FriendlyELEC guys might not work on Saturday afternoon, and while I did contact them, I decided to try one of their more recent images with Linux 4.11 available here.

Let’s pick since it has a similar name, and is much newer (released 3 days ago). I repeated the installation procedure above, and …

Success! Albeit after 4 to 5 hours of work… Let’s connect hardware to ind out whether it actually works, and not just runs.

Analog Input and Digital Output – Sound Sensor Demo

The simplest demo would be to use the LED module, but let’s do something more fun with the Sound Sensor demo I found in BakerBit Starter Kit printed user’s manual, and which will allow us to use both digital output with the LED module connected to D5 header, and analog input with the Sound sensor module connected to A0 header. Just remember the long LED pin is the positive one.

You can run the code as follows:

I changed the source a bit including the detection threshold, and timing to make it more responsive:

The LED will turn on each time the the sound level (actually analog voltage) is above 1.46V.

PWM and Analog Input – Servo and Rotary Angle Sensor Demo

We can test PWM output using the Servo module connected to D5 header, and control it using the rotary angle sensor module connected the A0 analog input header .

Click to Enlarge

The sample for the demo runs fine, and use the potentiometer is detected:

However, the servo is not moving at all. Raspberry Pi relies on rpi-config to enable things like I2C and other I/Os, and I noticed npi-config in the Wiki for NEO 2. So I ran it, and sure enough PWM was disabled.

So I enabled it, and answered Yes when I was asked to reboot. The only problem is that it would not boot anymore, with the system blocked at:

So maybe something went wrong during the process, so I re-flashed the Ubuntu image, reinstalled BakeBit, and re-enabled PWM0. But before rebooting, I checked the boot directory, and noticed boot.cmd, boot.scr, and the device tree file (sun50i-h5-nanopi-neo2.dtb) had been modified. The DTB looks fine, as I could decode it, and find the pwm section:

Let’s reboot the board. Exact same problem with the boot stuck at “Starting kernel…”. So there’s something wrong with the way npi-config modifies one or more of the files. With hindsight, I should have made a backup of those three files before enabling PWM the second time… I’ll give up on PWM for now, and ask FriendlyELEC to look into it.

I2C and Analog Input – OLED UI controlled with Joystick

The final test I’ll use the I2C OLED display module connected to one of the I2C headers, together with the analog joystick module connected to A0 header.

Click to Enlarge

Let’s run the sample for the demo:

It works, but there’s a bit of a lag, and the sample may have to be improved to better detect various states. I’ll show what I mean in the video below.

The bad parts are that documentation is not up-to-date, enabling PWM will crash the image, and while the Python sample do demonstrate IO capabilities, they should probably be improved to be more responsive. The good part is that we’re getting there, the hardware kit is a really nice, and I think the documentation and software should become much better in June, as FriendlyELEC has shown to be responsive to the community issues.

What? Python sucks? You can use C language with GPIOs too

If Python is not your favorite language, FriendlyELEC also provided some C languages samples in the C directory:

As we’ve seen above, Bakebit library appears to rely on WiringNP, and you’d normally be able to list the GPIOs as follows:

The utility is not too happy about seeing an Allwinner H5 board. But maybe the library in the board is not up-to-date, so I have built it from source:

and run the gpio sample again:

Excellent! It’s not quite a work-out-of-box experience, but NanoPi NEO 2 can be used with (most) GPIOs.

My adventures with NanoPi NEO 2 board are not quite done, as I still have to play with NanoHat PCM5102A audio add-on board, which I may end up combining with a USB microphone to play with Google Assistant SDK, and I’m expecting NanoPi NAS Kit v1.2 shortly. I’ll also update this post once PWM is working.

Top Programming Languages & Operating Systems for the Internet of Things

May 19th, 2017 3 comments

The Eclipse foundation has recently done its IoT Developer Survey answered by 713 developers, where they asked  IoT programming languages, cloud platforms, IoT operating systems, messaging protocols (MQTT, HTTP), IoT hardware architectures and more.  The results have now been published. So let’s have a look at some of the slides, especially with regards to programming languages and operating systems bearing in mind that IoT is a general terms that may apply to sensors, gateways and the cloud, so the survey correctly separated languages for different segments of the IoT ecosystem.

Click to Enlarge

C and C++ are still the preferred languages for constrained devices, and developers are normally using more than one language as the total is well over 100%.

Click to Enlarge

IoT gateways are more powerful and resourceful (memory/storage) hardware, so it’s no surprise higher level languages like Java and Python join C and C++, with Java being the most used language with 40.8% of respondents.

Click to Enlarge

When it comes to the cloud with virtually unlimited resources, and no need to interface with hardware in most cases, higher level languages like Java, JavaScript, Node.js, and Python take the lead.

Click to Enlarge

When it comes to operating systems in constrained IoT devices, Linux takes the lead with 44.1%, in front of bare metal (27.6%) and FreeRTOS (15.0 %). Windows is also there in fourth place probably with a mix of Windows IoT core, Windows Embedded, and WinCE.

Click to Enlarge

Linux is the king of IoT gateways with 66.9% of respondent using it far ahead of Windows in second place with 20.5%. They have no chart for the cloud, probably because users just don’t run their own Cloud servers, but relies on providers. They did ask specifically about the Linux distributions used for IoT projects, and the results are a bit surprising with Raspbian taking the lead with 45.5%, with Ubuntu Core following closely at 44.4%.

Click to Enlarge

Maybe Raspbian has been used during the prototyping phase or for evaluation, as most developers (84%) have been using cheap development boards like Arduino, BeagleBone or Raspberry Pi. 20% also claim to have deployed such boards in IoT solutions.

Click to Enlarge

That’s only a few slides of the survey results, and you’ll find more details about Intel/ARM hardware share, messaging & industrial protocols, cloud solutions, wireless connectivity, and more in the slides below.

Via Ubuntu Insights

Samsung ARTIK 053 WiFi IoT Module Runs Tizen RT on an ARM Cortex R4 MCU

May 17th, 2017 2 comments

Samsung has just introduced the latest member of its Artik family at IoT World 2017. ARTIK 053 is a WiFi module powered by an ARM Cortex R4 wireless micro-controller @ 320 MHz with hardware based security, GPIO, SPI, and I2C ports, and running Tizen RT real-time operating system.

Artik 053 module specifications:

  • MCU – 32-bit ARM Cortex R4 @ 320MHz with 1280 KB RAM for general use, 128 KB RAM for global IPC data (likely Samsung Exynos i T200, or a variant without an ARM Cortex M0+ core)
  • Storage – 8 MB flash
  • Connectivity – 802.11 b/g/n WiFi @ 2.4 GHz
  • Expansion – 29 dedicated GPIO ports, 2x SPI, 4x UART (2-pin), 4x ADC, 1x JTAG, 2x I2C
  • Security – AES/DES/TDES, SHA-1/SHA-2, PKA (Public Key Accelerator), PRNG/DTRNG (Random Number Generators), Secure key storage, Physical Unclonable Function (PUF)
  • Power Supply – 5 to 12VDC input voltage
  • Dimensions – 40 x 15 x 3 mm
  • Certifications – FCC (U.S), IC (Canada), CE (EU), KC (Korea), SRRC (China)

The module runs Tizen RT operating system with WiFi and network middleware, support for LWM2M (Lightweight Machine to Machine) for device management, IoTivity, and JerryScript/IoT.js.

Tizen RT Block Diagram

You can develop on ARTIK 053 using ARTIK IDE, as well as open source tools like Eclipse Classic Desktop (CDT), gcc, and OpenOCD. A “Developer Reference Mobile App” working with Samsung ARTIK Cloud is also provided, and Samsung collaborated with VMWare to support Little IoT Agent (Liota) open source software development kit (SDK) developed by VMware on ARTIK 053.

ARTIK 053 starter kit – pictured below – will help you evaluation the module, and get started as soon as possible.

Artik 053 Module on Development Board

The ARTIK starter board includes Arduino-form factor interface headers, expanded GPIO headers with exposed SPI and UARTs, on-board reset and Arduino reset buttons, 2x test buttons and 2x LEDs, a micro USB connector for power and programming, a JTAG header (1.27mm pitch), and a power barrel.

ARTIK 053 sells for as low as $6.65 for 300 unit orders on Digikey, while the starter kit goes for $35 on either Mouser or Digikey. You’ll more more details, including software and hardware documentation, on website.

NAS Kit v1.2 Gets Support for NanoPi NEO 2, an UAS Capable USB to SATA Bridge, and an RTC Battery

May 12th, 2017 32 comments

Last month, FriendlyELEC launched a NAS Dock kit for NanoPi NEO board, but they’ll already removed it from their store. That’s because they have a new version NAS Dock v1.2 that also supports NanoPi NEO 2 with Gigabit Ethernet, replaces JMicron JM20329 by UAS capable JMicron JMS567 USB 3.0 to SATA bridge, and adds an RTC battery.

The rest of NAS Dock Kit v1.2 specifications remain the same:

  • 1-bay NAS Dock expansion board with
    • JMicron JMS567 USB 3.0 to SATA bridge
    • SATA connector for 2.5″ HDD drive
    • Extra USB host port
    • On/off switch, and dual color status LED
    • Header to connect NanoPi NEO / NEO 2 board
    • 12V DC power input
    • Dimensions – 151 x 89.7 mm
  • NS-120 aluminum enclosure (154 x 100 x 47.5 mm, 414 grams)
  • Heatsink set for NanoPi NEO / NEO 2
  • 4x M3 6mm screws, 8x M2.5 6 mm screws
  • Four rubber pads
  • Front and back covers

Since NEO 2 has a low profile Ethernet jack, the company provides both NEO and NEO 2 back covers in the kit. It’s probably less hassle than providing two kits.

Software has also improved, as while the company still provides an OpenMediaVault image, it’s now based on Linux 4.11 + Debian 8. You’ll find the download links and instructions in the Wiki. FriendlyELEC also added the better iozone benchmark to the quick hdparm test to compare the “SATA” performance to Raspberry Pi 3, NanoPi NEO, and NanoPi NEO 2 boards.

They should really have done a file copy test over Gigabit Ethernet, as NanoPi NEO 2 should be about 2 to 3 times faster while copying a large file. Raspberry Pi 3 shared Ethernet and USB bandwidth may also affect the performance badly in some specific use cases, while NanoPi NEO 2 won’t have this type of problem since Ethernet and USB are two separate interfaces in Allwinner H5 processor.

The other good news is that despite the improvements, FriendlyELEC NAS Dock Kit price has not changed, and it is still sold for $12.99 + shipping. You’ll also need a  $14.99 NanoPi NEO 2, a micro SD card, a 12V/2A power supply to complete the setup. In other news, the company has also introduced a kit with NanoPi NEO 2 board, and a cute metal case with OLED display going for $34 in total (board included).

Helios4 Personal Cloud DIY NAS Supports 3.5″ Hard Drives, RAID, and More (Crowdfunding)

May 11th, 2017 25 comments

A few months ago, we covered GnuBee Personal Cloud 1, a NAS that runs on open source software, and that supports up to six 2.5″ SATA drives. The crowdfunding has been successful – after lowering the funding target -, and backers should hopefully get the NAS right after summer. But at the time, some people complained about the  memory capacity (512MB),  the lack of support for 3.5″ drives, and a few other items. A new project called “Helios4 Personal Cloud” addresses many of those concerns. It comes with 1 to 2GB RAM, enclosure supporting four 3.5″ drives, supports RAID, and is powered by Marvell ARMADA 388 processor that has been specifically designed for this type of application.

Helios4 NAS specifications:

  • SoC – Marvell ARMADA 388 dual core Cortex A9 processor @ up to 1.866 GHz with RAID5/6 acceleration engines, security acceleration engines, etc…
  • System Memory – 1 or 2 GB DDR3L
  • Storage – 4x SATA 3.0 ports, 2x HDD power connectors for 3.5″ drives using the provided DIY enclosure; micro SD slot supporting SDHC/SDXC cards
  • Connectivity – 1x Gigabit Ethernet
  • USB – 2x USB 3.0 ports, 1x micro USB port for serial console only
  • Expansion – 14-pin GPIO header, 4-pin I2C header which can be used for an LCD screen & control buttons.
  • Misc – 2x PWM fan headers + 2x fans provided with DIY enclosure
  • Power Supply – 12V/8A via 4-pin jack

The basic kit comes with an Helios4 board (shown below), 4x SATA data cables, 2x Molex to dual SATA power cables, and a 12V/8A power adapter. The full kit adds a case available in black or blue, two 70mm PWM ball bearing fan, and a fasteners set.

The NAS will support Armbian Debian and Ubuntu images, OpenMediaVault open NAS solution, and SynCloud open source app server. The developers (Kobol Team), based in Singapore, also promise to release software and hardware design files for the project. For now, they have Armbian build scripts, as well as Linux and U-boot source code on Github. The board has been designed in collaboration with SolidRun, which has experience with Marvell via their MACCHIATObin / ClearFog boards and system-on-modules.

The project has just been launched on Kickstarter, where Kobol aims to raise 150,000 SGD ($106,000 US). All prices are in SGD, but I’ll use the USD equivalent going forward. An early bird pledge of $125 US should get you the basic kit with 1GB RAM, while $149 is required for the 2GB version. If you want a full kit with enclosure, you’ll need to pledge $139 (1GB RAM) or $169 (2GB RAM). Worldwide shipping adds $39 or $43 for respectively the basic and full kit, even if you are in Singapore. Delivery is scheduled for September 2017.

Meet Zynqberry, a Xilinx Zynq FPGA Board with Raspberry Pi 2/3 Form Factor

May 10th, 2017 19 comments

Earlier this year, I wrote about Trenz Electronic’s Xilinx Zynq Ultrascale+ system-on-module, but I’ve just found out I missed another interesting product from the company. The ZynqBerry is a board powered by Zilinx Zync Z-7007S or Z-7010 ARM + FPGA SoC with Raspberry Pi 2/3 form factor.

Click to Enlarge

ZynqBerry specifications:

  • SoC
    • Xilinx Zynq XC7Z007S-1CLG225C (Z-7007S) single core ARM Cortex-A9 MPCore up to 766MHz + FPGA with 23K logic cells
    • Xilinx Zynq XC7Z010-1CLG225C (Z-7010) dual core ARM Cortex-A9 MPCore up to 866 MHz + FPGA with 28K logic cells
  • System Memory – 128 or 512 MB DDR3L
  • Storage – 16 MB Flash SPI flash + micro SD card slot
  • Video Output – HDMI, MIPI DSI interface
  • Audio Output – HDMI, 3.5mm audio jack (PWM audio only)
  • Connectivity – 100 MBit Ethernet via (LAN9514 USB Hub with Ethernet
  • USB – 4x USB 2.0 host ports
  • Camera – MIPI CSI-2 interface
  • Expansion – 40-pin Raspberry Pi compatible header
  • Debugging – USB UART and JTAG ARM & FPGA debug via micro USB
  • Power Supply – 5V via micro USB port
  • Dimensions – Raspberry Pi form factor


Three different hardware versions of the board are available:

  • TE0726-03R – Minimal version with Xilinx Z-7010, 128 MB RAM, no Ethernet, no USB, no HDMI, no MIPI connectors – 79 Euros
  • TE0726-03M – Xilinx Z-7010 with 512 MB RAM – 109 Euros
  • TE0726-03-07S-1C – New model equipped with Xilinx Z-7007S + 512 MB RAM – 99 Euros

The ARM core(s) on the board run PetaLinux, and FPGA part can be programmed using Vivado Design Suite. You’ll find software and hardware documentation, and demos (HDMI, SDR, ALSA, CSI) in the Wiki. Some knowledge of German may be useful in the download area.

ZynqBerry boards can be purchased directly on Trenz Electronic website.

Christmann RECS|Box Atlas Quad Apalis Microserver Evaluation Kit Supports Four Toradex Apalis SoM

May 10th, 2017 1 comment

System-on-modules are normally used in low volume embedded systems, but they can also be used in microservers, for example to upgrade capacity as needed. Christmann informationstechnik + medien GmbH has developed a microserver evaluation kit taking up to 4 Toradex Apalis SoMs for example based on Nvidia Tegra K1 processor, and also offers full rack systems with up to 72 modules.

RECS|Box Atlas Quad Apalis with 4 Apalis Modules – Click to Enlarge

Christmann RECS|Box Atlas Quad Apalis specifications:

  • Modules – 4x Slots for Apalis SoM
  • Connectivity – 1 GBit/s Compute Ethernet, 1 GBit/s Management Ethernet
  • Video Output – 1x HDMI
  • USB – 3x USB host ports, 1x micro USB port
  • Misc – 5 Status LEDs for USB, communication, and serial console, 4x fan connectors, KWM switch, 5x temperature sensors, 6x current sensors, 1x voltage monitor, fan speed monitoring
  • Power Supply – 12V via a 4-pin jack
  • Dimensions – 300 x 145 x 68 mm

The evaluation kit includes an Atlas board with an  acrylic base plate and 2 fans, a power supply, a micro USB cable, and an Apalis baseboard, but Apalis modules, which could have to purchase separately with a choice of NXP i.MX6, Nvidia Tegra 3, or Tegra K1 processor. Toradex is also working on an NXP i.MX8 version of their Apalis module, and Christmann  appears to have designed their own Apalis compliant SoM based on Samsung Exynos 5250. There’s no mention about the operating systems to run on the module, but the company provides “RECS Master” monitoring software running on your computer.

Click to Enlarge

RECS|Box Atlas Quad Apalis platform is sold for 1,275 Euros (without the modules), and once you are happy with your evaluation, you may select rack systems such as RECS|Box Antares and Arneb 19”  which can run 24 and 72 Apalis System on Modules respectively in a cluster configuration. If you prefer x86 (or FPGA) servers, the company also provides eval kit and servers taking COM Express modules. You’ll find more info on Christmann informationstechnik + medien’s embedded website.

Think Silicon Ultra Low Power NEMA GPUs are Designed for Wearables and IoT Applications

May 8th, 2017 1 comment

When you have to purchase a wearable device, let’s say a smartwatch or fitness tracker, you have to make trade offs between user interface and battery life. For example, a fitness tracker such as Xiaomi Mi Band 2 will last about 2 weeks per charge with a limited display, while Android smartwatches with a much better interface need to be recharged every 1 or 2 days. Think Silicon aims to improve battery life of the devices with nicer user interfaces thanks to their ultra-low power NEMA 2D, 3D, and GP GPU that can be integrated into SoCs with ARM Cortex-M and Cortex-A cores.

Nema|t 3D GPU Block Diagram

The company has three family of GPUs:

  • NEMA|p pico 2D GPU with one core
    • 4bpp framebuffer, 6bpp texture with/out alpha
    • Fill Rate – 1pixel/cycle
    • Silicon Area – 0.07 mm2 with 28nm process
    • Power Consumption – leakage power GPU consumption of 0.06mW; with compression (TSFSc): 0.03 mW
  • NEMA|t tiny 2D & 3D GPU with one to 4 cores
    • 4bpp framebuffer, 6bpp texture with/out alpha
    • OpenGL ES support
    • Can render a 420×420 3D UI @ 80 MHz
    • Fill Rate – 1-4pixel/cycle; up to 1,600 MPixel/s for the quad core version  @ 400 MHz
    • Silicon Area – 0.1 to 0.25 mm2 with 28nm process
    • Power Consumption – leakage power GPU consumption of 0.07mW; with proprietary compression technology (TSFBc, TSTXc): 0.03 mW
  • NEMA|s GPGPU with one to four cores
    • Supports Network On Chip (NoC) interconnect for clusters with each cluster supporting up to four cores, and each core handling up to 128 threads
    • Fill Rate – 1pixel/cycle
    • Silicon Area and Power Consumption – TBA, as Nema|s is only implemented via FPGA for now


The first two models are available right now, while the third is still in development. The company is also working on the fourth family with NEMA|ts “tiny small” GPU, but no details have been provided.

Provided the website is up-to-date, NEMA|p 2D GPU is supported in FreeRTOS V8.0.1 and Linux kernel 3.x, while NEMA|t can be used in Linux 3.x and Android 4.x. The company also provides a software library in ANSI C, as well as DirectFB and Qt support.

I found out about the NEMA through a Charbax video at Mobile World Congress 2017.

Think Silicon GPUs are said to be already used in Microchip and Dialog MCUs, and Sequant recently announced an “LTE for IoT System-on-Chip” with a NEMA|p 2D/2.5D GPU. The demo in the video above also shows an Ambiq Micro board connected to an FPGA implementation of one of their GPUs. You’ll find more information on Think Silicon website.