Introduction
This article is an extension of Flashing the Zephyr* Application Using a JTAG Adapter on the Arduino 101*. It demonstrates to new users how to build a heart rate monitor using Zephyr* on the X86, and ARC processors on an Arduino 101* platform. This is done with Ubuntu* in a VMware* workstation using a JTAG adapter. The JTAG adapter method enables engineers to perform advanced development and debugging on the Arduino 101 platform through a small number of dedicated pins.
Hardware Components
The hardware components used in this project are listed below:
- Two standard A plug to B plug USB cable
Jarv RunBT (optional)
Grove-LCD RGB Backlight (optional)
Setting up a VMware Workstation on Ubuntu*
Go to the VMware website to download and install the latest VMware Workstation player for Windows*. Browse to the Ubuntu website to download the latest version of Ubuntu Desktop. Open VMware and create a new virtual machine using the downloaded Ubuntu image. Check virtualization settings in your computer’s BIOS to ensure they are enabled, otherwise VMware will not work.
Set up a Development Environment for Zephyr* on Ubuntu* under VMware*
Ensure the Ubuntu OS is up to date and install dependent Ubuntu packages.
- sudo apt-get update
- sudo apt-get install git make gcc gcc-multilib g++ libc6-dev-i386 g++-multilib python3-ply
Install the Zephyr Software Development (SDK) kit and run the installation binary.
- wget https://nexus.zephyrproject.org/content/repositories/releases/org/zephyrproject/zephyr-sdk/0.8-i686/zephyr-sdk-0.8-i686-setup.run
- chmod +x zephyr-sdk-0.8-i686-setup.run
- ./zephyr-sdk-0.8-i686-setup.run
When the “Enter target directory for SDK” prompt is displayed, enter the directory where you want to store the zephyr SDK.
Export the Zephyr SDK environment variables. The following ZEPHYR_SDK_INSTALL_DIR assumes the zephyr SDK area is =~/zephyr-sdk.
- export ZEPHYR_GCC_VARIANT=zephyr
- export ZEPHYR_SDK_INSTALL_DIR=~/zephyr-sdk
Save the Zephyr SDK environment variables for later use in new sessions.
- vi ~/.zephyrrc
- export ZEPHYR_GCC_VARIANT=zephyr
- export ZEPHYR_SDK_INSTALL_DIR=~/zephyr-sdk
Building the Heart Rate Monitor on Zephyr
Git clone a repository to the Ubuntu.
- git clone https://gerrit.zephyrproject.org/r/zephyr && cd zephyr && git checkout tags/v1.5.0
Navigate to the Zephyr project directory and set the project environment variables.
- cd zephyr
- source zephyr-env.sh
Connecting FlySwatter2 to Arduino 101* (branded Genuino 101* outside the U.S.)
The first step is to connect the ARM micro JTAG connector to the FlySwatter2. Then, connect the FlySwatter2 to the Arduino 101 micro JRAG connector. The small white dot beside the micro JTAG header on the Arduinio 101 indicates the location of pin one. Insert one of the cable so it matches the dot. For more information on locating the micro JTAG connector on the Arduino 101, visit https://www.zephyrproject.org/doc/1.4.0/board/arduino_101.html.
Figure 1: Connect FlySwatter2* to Arduino 101* using ARM* Micro JTAG Connector.
A Hardware Abstraction Layer (HAL) allows the computer operating system to interact with a hardware device. Add your username to HAL layer interaction permissions to control the FlySwatter2.
$ sudo usermod –a –G plugdev $USERNAME
Grant members of the plugdev group permission to control the FlySwatter2.
$ sudo vi /etc/udev/rules.d/99-openocd.rules $ # TinCanTools FlySwatter2 $ ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="664", GROUP="plugdev"
Reload udev rules to apply the new udev rule without restarting the system.
$ sudo udevadm control --reload-rules
Insert the second standard A plug to B plug USB type B cable into the FlySwatter2 and the computer.
$ dmesg | grep FTDI
In the Ubuntu window, FTDI USB Serial device should be displayed as below.
Figure 2: FlySwatter2 on Ubuntu.
The FlySwatter2 device should be connected to the Ubuntu as a removable device.
Figure 3: FlySwatter2 pop up message on virtual machine.
Backup and Restore Factory Reset
Visit Flashing the Zephyr* Application Using a JTAG Adapter on the Arduino 101* to backup and restore the Arduino 101 factory settings.
Flashing the Zephyr* Image onto the Intel® Quark™ SE SoC
Navigate to the Zephyr project and build the binary image. The board type for X86 processor is arduino_101_factory.
$ cd zephyr $ make pristine $ make BOARD=arduino_101_factory
Ensure the FlySwatter2 is connected to the Arduino 101 platform and the computer, and then flash the image.
$ make BOARD=arduino_101_factory flash
The Heart Rate Monitor image should be successfully flashed onto the X86 processor.
Figure 4: Flash image successfully message.
Flashing the Zephyr* Image into the ARC Processor
Navigate to the Zephyr project and build the binary image. The board type for ARC processor is arduino_101_sss_factory.
$ cd heartrate-monitor $ make pristine $ make BOARD=arduino_101_sss_factory
Ensure the FlySwatter2 is connected to the Arduino 101 platform and the computer, and then flash the image.
$ make BOARD=arduino_101_sss_factory flash
Troubleshooting
This section contains tips for establishing and detecting permission to control the FlySwatter2.
Got “Error: libusb_open() failed with LIBUSB_ERROR_ACCESS” when flashing the Zephyr into X86 or ARC processor
Figure 5: Error LIBUSB_ERROR_ACCESS
Ensure that your username is added to HAL layer interaction permissions to control the FlySwatter2.
$ sudo usermod -a -G plugdev $USERNAME
Also ensure permission was granted for plugdev to control the FlySwatter2.
$ sudo vi /etc/udev/rules.d/99-openocd.rules $ # TinCanTools FlySwatter2 $ ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="664", GROUP="plugdev"
Got “Error: no device found” when flashing the Zephyr into X86 or ARC processor
Figure 6: Error No device found
Make sure Ubuntu detected the FlySwatter2 device. Unplug and re-plug the standard A plug to B plug USB type B cable from the FlySwatter2 to the computer may help Ubuntu detect FlySwatter2. Then test the connection with the following command:
$ dmesg | grep FTDI
Summary
We have described how to build and flash the Zephyr Heart Rate Monitor image onto the ARC or X86 processor of the Arduino 101 platform on Ubuntu in VMware. Experiment with the Zephyr Heart Rate Monitor application by connecting a portable device that supports BLE such as a Jarv RunBT and Grove-LCD RGB Backlight to the Arduino 101 board. Install a BLE app such as nRF Toolbox on an Android device, pair with the device that connected to the Arduino 101. Follow the instructions on the portable device for heart rate input. The heart rate date should appear on the Android screen and Grove LED display. To find more information about the Intel® Curie™ module and Zephyr project, go to https://software.intel.com/en-us/iot/hardware/curie.
Helpful References
- Zephyr project
- Zephyr SDK
- Intel® Developer Zone:
- Arduino forum:
- Arduino 101 hardware:
- Order Arduino 101 platform:
About the Author
Nancy Le is a software engineer at Intel Corporation in the Software and Services Group working on Intel® Atom™ processor scale-enabling and IoT projects.