Tuesday 18 July 2017

Udoo X86 Power On / Off via BLE on Arduino 101

I finally received my UDOO X86, I backed on Kickstarter on April 2016!

To give a little of context, it is a board designed by UDOO sporting an Intel x86 CPU (64bit, different depending if you have a BASIC, ADVANCED or ULTRA), 2/4/8GB or RAM (soldered) and a LOT of peripherals and I/O.
To mention some of them:
  • M.2 Key E port
  • Gigabit Ethernet
  • 3x USB 3 Ports
  • 1 HDMI and 2x DisplayPort
  • GPIO
  • 2x COM ports
  • RTC
  • I2C

In addition, they managed to put on the same board a Genuino/Arduino 101 board (Intel Curie), with BLE and 6 axis accelerometer & gyroscope.
Everything on a board more or less twice the size of the RaspberryPi.

More details can be checked on the official documentation page on the UDOO site.

I am writing this tutorial from the board itself and I can tell it can be used as desktop/HTPC without any major issues.

One cool feature of the Arduino 101 is it is able to Power On/Off the main CPU via Interrupt!

I am going to tell you how to be able to remotely power on and off the main CPU via BLE.

I am using LUbuntu 16.04 as OS, but those instructions should work pretty well on any operating system, even MS Windows.

Grant Power management to Intel Curie

Verify the BIOS/EFI settings are as shown in this page.

Prepare the Arduino environment

Install the Arduino IDE from the official site and install the Intel Curie Arduino 101 Libraries & Tools. You could do the same with PlatformIO, but I am not quite sure about the Intel Curie support.

Check you select the correct board type, programmer and serial port in the Tools menu.

Remember to give your user the rights to write to the serial port executing:

sudo usermod -a -G dialout

You have to logout to make those changes taken into account.

In addition to that, it could be necessary to execute the following script:

wget -O - https://raw.githubusercontent.com/01org/corelibs-arduino101/master/scripts/create_dfu_udev_rule | sudo bash

This is required to make the Arduino capable of resetting the board to put it in programming mode.

Check everything works fine uploading a simple example sketch (pick the Basic/Blink one).

The blinking led is the one close to the HDMI port

Upload the sketch to receive commands from BLE

Let's start with a skeleton sketch Intel prepared for us.

Choose the example from CurieBLE/Peripheral/CallbackLED.

Upload it to the board.

Follow the instructions shown on this page to configure the Android application.

All you need to do is to pair to the Arduino101 BLE device, which will be shown as LEDCB.
Once you're connected, you'll be able to write 0 or 1 to a variable exposed by the service implemented in the sketch.
The variable will power on and off the LED depending on the value of the variable.

Adapt the sketch to send a Power signal to the main board

We need to add a simple function to send a LOW digital signal for 20ms on the PIN number 9, followed by a HIGH digital level.
This generated wave will be caught by an intermediary SMT32, which will send the power interrupt to the Intel Atom/Celeron/Pentium.

The whole board will react on the interrupt, including the Arduino 101, which will be restarted, losing any unsaved state.
It means everything which follows the execution of the function sendPowerSignal is actually useless, as the Arduino 101 will reboot.

Issues (2 May 2017)

I am unable to fully verify it is working since on shutdown the board actually gets powered on.
Possible root cause:

  • BLE is interacting with the PIN number 9
  • When the Arduino 101 is reset, the PIN 9 goes again low triggering a power on

Those facts seem not impacting just my board, as I found a forum post you can check here where another user faced the same problem.

I can also confirm that if I suspend the system, the Arduino 101 is no more visible on Bluetooth, so it means it gets powered off.

UPDATE (3 May 2017)!

I've been in touch with UDOO team and they provided a revision of the BIOS for testing purposes only.

The problem is partially fixed and I'll keep you posted to let you know when we will have this example fully working.

UPDATE (18 July 2017)!

I've received a BIOS 1.03 RC version to test if the mentioned issues are fixed.

And we have good news! Everything works as expected!

I let UDOO send the changelog of the latest BIOS as soon as it is officially out, but I can confirm you'll be able to use the Arduino 101 to properly power up and shutdown the main board.

The power management via Intel Curie can be now left enabled and flashing the Arduino 101 or rebooting will no more generate issues (reboots).

The problem has been solved making the power signal trigger sequence more complex (5 HIGH to LOW transitions within 100 ms, instead of a single transition).

If you're using a desktop linux distribution (e.g. Ubuntu), please check the power management rules and set "When power button is pressed" to "Shutdown" or "Suspend", depending on what you prefer).

Otherwise, you will get a dialog, as in the following video... 


balamurugan said...

Thanks for posting keep updating it.
Node JS Training in Chennai
Node JS Advanced Training
French Classes in Chennai
pearson vue test center in chennai
Informatica Training in Chennai
Data Analytics Courses in Chennai
spanish language in chennai
content writing training in chennai
Node JS Training in OMR
Node JS Training in Porur

Jackie Co Kad said...

Great Article
Data Mining Projects

Python Training in Chennai

Project Centers in Chennai

Python Training in Chennai

Swetha K said...

I recently read your post and I got a lot of information. Definitely, I will share this blog for my friends.
JMeter Training in Chennai
JMeter Certification
Linux Training in Chennai
Graphic Design Courses in Chennai
Spark Training in Chennai
Pega Training in Chennai
Primavera Training in Chennai
Unix Training in Chennai
Placement Training in Chennai
Oracle Training in Chennai
JMeter Training in T Nagar
JMeter Training in OMR

nisha said...

The Blog is really admired. every concept should be very uniquely represented.

Data Science Training Course In Chennai | Data Science Training Course In Anna Nagar | Data Science Training Course In OMR | Data Science Training Course In Porur | Data Science Training Course In Tambaram | Data Science Training Course In Velachery

technology said...

Considering all these points the online marketing is a vast and broadly open to all the people around the world to connect through multiple devices like (Mobile (Smartphone), Laptop, Desktop, Tablet, Smart TV etc.) data science course syllabus

Priya Rathod said...

A decent blog consistently concocts new and energizing data and keeping in mind that perusing I have feel that this blog is truly have each one of those quality that qualify a blog to be a one.
AWS Training in Hyderabad
AWS Course in Hyderabad

mark said...

Amazing post click here