Page 1
Red Getting Started—WPx5xx + Linux Dev Machine + CLI 41110481 Rev 2 Contents subject to change...
Page 2
This product may contain technology developed by or for Sierra Wireless Inc. This document contains information which is proprietary to Sierra Wireless Inc. and is licensed pursuant to Creative Commons Attribution 4.0 International License. Document Title: mangOH Red Getting Started—WPx5xx + Linux Dev Machine + CLI details Author: Sierra Wireless Source: http://mangoh.io/...
Page 3
Preface Revision History Revision Release date Changes number August 2017 Document created Rev 2 8/23/17 41110481...
1: Getting Started Now that you have your mangOH™ Red, it’s time to start using it. Important: Use this guide only if you are using a native Linux development system (Ubuntu is recommended). This guide includes instructions for native Linux® development machines using CLI (Command Line Interpreter).
Page 7
Before You Begin on page 8 • Step-by-step tutorial: · Set Up Your mangOH Red Hardware on page 9 · Prepare Your Linux Dev Machine For Legato Development on page 17 · Prepare Your mangOH Red For Development on page 23 ·...
Before you begin, here are a few items that you might find helpful: • Some terminology: · "CF3"—The mangOH Red supports CF3 (Common Form Factor) embedded modules, such as the WP8548 and HL8548. Throughout this tutorial, "CF3" refers to the module that comes with your mangOH Red kit.
3: Set Up Your mangOH Red Hardware In this chapter, you will set up your mangOH Red to begin developing applications. A typical mangOH Red kit includes: • mangOH Red board • CF3 (Common Form Factor) module, cover, and release tool •...
Red Getting Started 3.2 Hardware Setup To set up the mangOH Red board: 1. Insert the CF3 module—Hold the module above the socket and line up the triangles on the module and socket. The module will drop straight into the socket.
Page 11
· OFF—2,4,5,6,7 5. Insert a micro-SIM in the slot on the bottom side of the mangOH Red. You can use the Sierra Wireless micro-SIM that is included in the kit, or another micro-SIM that has been activated by a mobile network provider.
Page 12
Red Getting Started 6. Attach the main antenna and (for LTE CF3 modules) the diversity antenna. Note: The main antenna is required if you want to connect the mangOH Red to a mobile network in Connect To Mobile Networks on page...
Page 13
CONSOLE USB connector to the dev machine): $ minicom -D /dev/ttyUSB0 A welcome message appears, and the window will show console messages when the mangOH Red powers on in the next step. Rev 2 8/23/17 41110481...
Page 14
However, only one console connection can be opened at any time since it locks the USB serial port. 11. Power up the mangOH Red: a. Use a micro-USB cable to connect the CF3 USB connector to a USB port on the dev machine.
Page 15
Console messages describing module boot-up process Note: For future reference, the mangOH Red’s power supply (USB port on your dev machine, or an AC adapter) connects to the board via either USB connector— CF3 USB or CONSOLE USB (depending on the jumper position on the power header).
Page 16
Red Getting Started You should receive ping responses. Press Ctrl+C to cancel the ping request and return to the command prompt. Replies received, connection working Ctrl+C pressed to cancel ping Now you are ready to Prepare Your Linux Dev Machine For Legato Development on...
4.2 Build and Install the Development Environment In this section you will build and install the environment to develop applications for the CF3 module used in your mangOH Red. The environment includes: • Legato toolchain—Tools and libraries used to build the Legato Platform for your CF3 module.
Page 18
The dev machine’s hardware type appears —e.g. "x86_64" is a 64-bit system. 4. Install several packages that are required for the Legato Platform and the mangOH Red platform—enter the following command and follow any prompts that appear: $ sudo apt-get install build-essential openjdk-8-jre \ libwebkitgtk-1.0-0 python python-jinja2 cmake \...
Page 19
If the value returned is ’0’, the command succeeded. If it is any other value, the command failed. 6. If your dev machine is 64-bit, install additional dependencies: $ sudo apt-get install lib32z1 lib32ncurses5 7. Build the Legato toolchain (SDK): a.
Page 20
When finished, installing, the message "SDK has been successfully set up and is ready to be used." will appear. h. Configure the toolchain to make it available for use in generating the mangOH Red platform and the kernel modules that it references: $ export PATH=$PATH:/opt/swi/y17-ext/sysroots/\ x86_64-pokysdk-linux/usr/bin/\...
Page 21
$ git config --global user.email "youremail@example.com" $ git config --global user.name "your.name" 11. Download the mangOH platform files into a working directory—enter the following command and either replace <mangOH_work_directory> with a new directory name (e.g. "mangOH_work"), or remove it (to use the default directory name "mangOH").
Page 22
Red Getting Started 12. Add an environment variable (shortcut) for the mangoh work directory: a. Edit your ~/.bashrc file (the startup script that runs when you open a terminal window) and add the following line at the end of the file: export MANGOH_ROOT=~/mangOH_work Note: .
5: Prepare Your mangOH Red For Development In this chapter, you will update the CF3 module on your mangOH Red with the basic mangOH Red platform (application suite). 5.1 Build and Install Legato Platform and mangOH Red Platform on Target...
Page 24
Red Getting Started IMEI IMEI Note: This may take several minutes to run. 2. In a terminal window, build and install the Legato AF: $ cd legato $ make clean && make wp85 && source bin/configlegatoenv Ignore these toolchain warnings.
Page 25
Important: Before you can install the platform you just built (using the most recent Legato framework) onto your mangOH Red, you must make sure you also have the latest firmware—the platform is built to work on the matching firmware. Rev 2 8/23/17...
If the following apps appear in the list, the build and install succeeded: If gpioExpanderServiceRed, mqttClient, and redSensorToCloud are listed, the install succeeded. Now that the mangOH Red platform is installed, you will learn how to Connect To Mobile Networks on page 5.2 How to Update Module Firmware...
Page 27
If your version is lower than the Generic version—Continue to Step f update your firmware. In the Binaries column for the Generic carrier, click Download. g. Make sure the mangOH Red is connected to the dev machine with a mini-USB cable. Rev 2 8/23/17 41110481...
Page 28
Disconnect from the mangOH Red: # exit 5. If you did this firmware update as part of the instructions in Build and Install Legato Platform and mangOH Red Platform on Target on page 23, go to Step 7 on page...
6: Connect To Mobile Networks In this chapter, you will learn how to connect the mangOH Red to a mobile network. When the mangOH_Red has a data connection, you can transmit data, including on- board sensor readings, to the IoT cloud.
Page 30
Red Getting Started 3. Turn on the target’s radio (modem); # cm radio on 4. Display the status of the target’s radio: # cm radio Example response when Power is OFF Example response when Power is ON, Status is Searching...
Page 31
Example response when Connected a. If "Connected" is: · "no", and APN has a value—The mangOH Red is ready to connect to the network. Go to Step · "no", and APN is blank—You must set the APN. Continue to the next step (step ·...
Page 32
"ok". 8. Test the data connection: a. When the command prompt reappears, verify that the connection is working—’ping’ a URL that you know is working (e.g. mangoh.io, google.com, etc.). # ping mangoh.io When ping responses (e.g. "64 bytes from 35.164...") appear, the connection is working.
Page 33
b. Stop the ping command when responses begin to appear—Press Ctrl+C to return to the command prompt. Note: If no responses appear within 30 seconds, press Ctrl+C, make sure the antenna is connected, and go back to Step 4 and try again. If you still cannot get a response, power cycle the mangOH_Red and start the procedure again.
Red’s on-board sensor data. 7.1 Register and connect to AirVantage Your mangOH Red kit includes a free account on the AirVantage IoT Acceleration Platform for your CF3 module. This platform provides Sierra Wireless’ cloud-based services for over-the-air (OTA) device management and application enablement.
Page 35
2. In the MangOH Signup area, enter your: · First and last names · Email address—Address to use as your AirVantage username. Important: Use a valid address—This is your username for accessing AirVantage, and is needed to complete the registration process.
Page 36
8. Enter your account’s email address and password, and click Log In. 9. If you did not record your device’s FSN and IMEI earlier (in Build and Install Legato Platform and mangOH Red Platform on Target on page 23): a. Open a terminal window and connect to the device: $ ssh root@192.168.2.2...
Page 37
The areas shown below (Last Communication and System Info) are both blank because you have not connected your mangOH Red to AirVantage yet. Leave this browser window open and continue to Connect to AirVantage on page...
$ ssh root@192.168.2.2 3. The mangOH Red platform that you installed earlier includes an application that reports sensor data from your mangOH Red to the IoT cloud. Start the application to send data to AirVantage, and confirm that it started running:...
AirVantage, and the type of communication. For example, this CF3 communicated its Registration. System Info (Information about the CF3 module in your mangOH board) Last Communication Shows your most recent sensor data. Rev 2 8/23/17 41110481...
Page 40
Note: redSensorToCloud automatically closes the data connection, so you do not need to use "cm data connect -1". You have now registered and connected your device to AirVantage, and completed the mangOH Red Fundamentals tutorial. For more information on the mangOH platform, visit mangoh.io. Rev 2 8/23/17...
Page 41
To begin developing simple applications or modifying existing applications, work through the examples in Develop and Test applications on page Rev 2 8/23/17 41110481...
A: Develop and Test applications In this section, you will learn how to develop applications in the Legato development environment, install them onto your mangOH Red, and test that they run. Legato provides two interfaces for developing applications: • CLI—Command Line Interpreter in a terminal window.
A.1.2 Update an Installed Application As you saw when you set up your AirVantage account, one of the mangOH platform applications loaded on your device in Build and Install Legato Platform and mangOH Red Platform on Target on page 23 was redSensorToCloud.
Page 44
At this point, you have modified the redSensorToCloud application’s source code. Now you have to build (compile) it. This application was created as part of the mangOH Red platform; to rebuild the application, you will rebuild the whole system (Legato Platform and mangOH Red platform).
Page 45
7. Verify that the update file mangOH_Red.wp85.update was created: $ ls -al *.update 8. Make sure the mangOH board is powered on and is connected to your dev machine—the board is connected if you receive ping responses: $ ping 192.168.2.2 Press Ctrl+C to return to the command prompt.
Page 46
Red Getting Started 11. By default, redSensorToCloud is installed but not started. Start the application to send data to AirVantage: # app start redSensorToCloud Note: redSensorToCloud automatically opens a data connection, so you do not need to use "cm data connect".
A.1.3 Update and Install a New Application When you installed Legato, sample application files were also stored. In this section, you will build and then install the "hello world" application on the target. Build (compile) an application on the dev machine and install it on the target: 1.
Page 48
Red Getting Started b. Connect to the target: $ ssh root@192.168.2.2 c. Watch the log file and show when a message from "hello world" appears: # logread -f | grep "Hello" Note: Nothing will appear to happen until you run the Hello World application in the next step.
Page 49
e. Run the application and see that it outputs a "Hello, world." message to the LOG_TERM terminal window: # app start helloWorld (Optional) If you want to see information about the application, enter the following command: # app info helloWorld g.
B: Update Legato Application Framework As part of the Build and Install Legato Platform and mangOH Red Platform on Target on page 23 process, you downloaded and installed the latest version of the Legato Application Framework (AF). When new versions of the framework are released, you can install them on your dev machine using the procedure below.
Page 51
Most recent release 5. If your release is older (lower version number) than the most recent release: a. Download the framework files into your working directory (for example, "legato_framework")—Replace the release number in the ’repo’ command with the most recent release (this example downloads version 17.07.1): Note: Through the rest of this guide, "legato_framework"...
Page 52
Red Getting Started IMEI IMEI Note: This may take several minutes to run. 6. Build and install the Legato AF: $ cd legato $ make clean && make wp85 && source bin/configlegatoenv Rev 2 8/23/17 41110481...
Ubuntu includes a terminal emulator, which is labeled as "Terminal" in the desktop environment. The emulator allows you to execute command-line programs that interact with the Legato framework tools on your dev machine and the CF3 module in the mangOH Red. For this tutorial, here are some useful tips: •...
Red Getting Started C.3 Useful commands for this tutorial (and more) The following table describes the Legato and Linux commands used in this tutorial, plus other useful commands. Table C-1: Legato commands Command types Command Description Versioning cm info Display the modules model, IMEI, FSN (serial number), and firmware and bootloader versions.
Table C-2: Linux commands Command types Command Description Packages add-apt-repository Add a package repository to your list of locations where the apt-get package management tool searches for the packages you request. apt-get update Update the list of repositories to include those you added with add-apt- repository.
Need help?
Do you have a question about the Red and is the answer not in the manual?
Questions and answers