I have been recently revisiting the software that goes along with the (referred to as the SK2 for Starter Kit 2) and wanted to highlight for the community some of the capabilities and features this kit included. It really is a feature packed kit including:
- A Global Cat-4 modem module
An Ambient Light Sensor
- Temperature Sensor
- 3-axis Accelerator
- A PMOD connector
- A 60-pin expansion connector
The heart of the kit is a Wistron NeWeb Corp (WNC) M18QWG global LTE Cat-4 modem, built on the Qualcom MDM9207, which has 4 Cortex-A7 cores. Three of the A7 cores are dedicated to Radio operation, but one of the cores is dedicated to running Embedded Linux (eLinux). This core that is running eLinux allows the user to build applications that can run and access the Radio via a Modem Abstraction Layer (MAL) and use a HW Interface
for accessing other peripherals.
As shipped, the Kit comes with a demonstration program (the iot_monitor) that shows interaction with:
- The radio using AT&T’s M2X
- Various I/O’s
- An integrated GPS
To help someone get started using the SK2, I am going to review operation of the iot_monitor Quick Start application. This application is actually part of the iot_monitor and is invoked via a series of flags on the command line. It is the same as discussed in the SK2 Getting Started Guide but this blog focuses on using the Quick Start application directly with M2X rather than the AT&T Asset Management Operations Center (AMOC) Dashboard.
The SK2 is designed to be a Host Mode module, meaning the application driving the SK2 module is hosted as an application running within eLinux on the dedicated processor. I am often asked if this module can run in modem mode (as a modem peripheral to a separate processor). While it can, it is not officially supported in this configuration. Instead, the intent was to allow for an application to be developed to drive the module, then placed on the module so it could run in a standalone configuration with a minimum of peripheral circuitry. To assist with this, the iot_monitor application was produced to show how to interact with the various peripherals, introduce the SDK and development process, then provide some example functionality similar to the Quick Start application that reads sensors, collects GPS data, and interacts with a web-service such as M2X.
The M2X Interface
To execute the Quick Start application, the first thing that must be done is to create an AT&T M2X account (or login to an existing one). Once you log into your account it will look something like:
The iot_monitor is started with the Quick Start flag, it expects you to provide an API KEY with the "-d" flag. The API KEY it is expecting is the account MASTER KEY. This is available by selecting Manage -> Account Settings to get to the Master Keys screen.
Note: The Master Key is used during the initial iot_monitor call to set up your Device.
The Master Key is used during the initial iot_monitor call so that M2X can create a device. The serial number that is used will correspond to the ICCID of the SIM card that you are using to access the internet. Once M2X sets the device up, it will have a PRIMARY API KEY + a DEVICE ID and the Device Serial will be the ICCID of the SIM:
PC & SK2 environment setup
Note: I’m assuming you have GIT installed (if not you need to install it) and are familiar with Linux commands (because ADB runs a Linux like shell).
To interact with the SK2 you need to install ADB on your development PC. If you do not have ADB installed, use the link https://www.xda-developers.com/install-adb-windows-macos-linux/ to install it. You will also need to install the security keys for the SK2 for ADB. This is done by creating an file named adbkey.pub with the following contents:
Place this file into the android file that was created when you installed ADB (cp adbpub.key ~/.android/). You may have to kill and restart ADB so that it recognizes the adbpub.key file. You can verify that everything is working correctly by listing the attached devices, e.g.
adb devices List of devices attached WNC_ADB device
If the adbpub.key file isn't recognized by ADB, the WNC_ADB device will be reported as '
permission denied' (or similar).
With ADB installed and the SK2 connected you can now install and run the iot_monitor. The iot_monitor itself is installed at the factory, but updates and all source code are available at https://github.com/Avnet/M18QxIotMonitor. In the repository, the releases section contains a compiled version of the code so you don’t want to compile it yourself. However, if you do want to compile it, instructions for setting up the development environment and compiling are available in the repositories README.md, as well as a series of videos at http://cloudconnectkits.org/product/global-lte-starter-kit under ‘Trainings’.
Once you have the iot_monitor executable, it must be pushed to the SK2. This is done with the command ‘adb push iot_monitor /CUSTAPP/iot’. The CUSTAPP folder is the location that all user applications must be run (the other directories are read only). Finally, after you push iot_monitor to the SK2, make sure it is marked as an executable file, e.g., 'adb shell “chmod +x /CUSTAPP/iot/iot_monitor” '.
Running Quick Start
Remember when you initially logged onto your M2X account and it showed no devices (previously shown), we are now going to run the iot_monitor and create a device to talk with. Issue an ADB shell command to the SK2 to run the iot_montior in Quick Start mode with the command ‘adb shell “/CUSTAPP/iot/iot_monitor –q5 –a <<MASTER KEY>>” ' (MASTER KEY was obtained previously). When you do this, the ADB console displays:
Note that it is reporting the creation of a new device and the associated data streams. If you revisit the M2X web page, it also reflects this:
After the setup is complete, you can press the USER button, and the SK2 will collect sample data and post it to the M2X account. Normally (when the SK2 is idle), the LED is GREEN, however, when the USER button is pressed the LED turns WHITE, then when sending data to M2X, the LED is BLUE. Once the data has been sent the LED will return to GREEN, the console will report 'All Values sent.' and it will be possible to see the data in M2X.
The ADC, TEMP, XVALUE, YVALUE, ZVALUE are all available under in the overview tab under either Streams or Location.
Once you have completed the Quick Start, you can press the USER button for longer than 3 seconds and the application will exit.
As previously stated, all the source code for the Quick Start application is located in github at https://github.com/Avnet/M18QxIotMonitor. This includes the source code for Quick Start (see the qsapp.cpp file). The iot_monitor source code is intended to be used as a reference for development of any application that you would want to run on the SK2.
In addition to the SK2, there is also an that allows for Mikroelektronika click boards to be mounted and used. Most of these boards interact with the SK2 via the I2C bus and there is example code that demonstrates this operation (HTS221.*). Also mounted on the SK2 board is a PMOD connector that allows you to connect other PMOD devices you may want to work with.
Given the SK2s versatile capabilities and the availability of reference software, it should help customers quickly develop products and projects that can take advantage of a cellular connection.