mangOH Red Manual Download Page 45

A.1.3: Update and Install a New Application

Rev 3  9/21/17

45

b.

Connect to the target:

$ ssh [email protected]

c.

Check that the application is installed:

# app status

The "hello world" application should appear in the list with a status of ’running’. The application was built to 
run automatically; when you write your own applications, you can make them install without running, if you 
prefer.

d.

Stop the application (so you can restart it and see the output):

# app stop helloWorld

e.

Run the application and see that it outputs a "Hello, world." message to the LOG_TERM terminal window:

# app start helloWorld

f.

(Optional) If you want to see information about the application, enter the following command:

# app info helloWorld

Hello World application

Summary of Contents for Red

Page 1: ...mangOH Red Getting Started WPx5xx Linux Dev Machine CLI 41110481 Rev 3 Contents subject to change ...

Page 2: ... OR EXEMPLARY DAMAGES INCLUDING BUT NOT LIMITED TO LOSS OF PROFITS OR REVENUE OR ANTICIPATED PROFITS OR REVENUE ARISING OUT OF THE USE OR INABILITY TO USE ANY SIERRA WIRELESS PRODUCT EVEN IF SIERRA WIRELESS AND OR ITS AFFILIATES HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES OR THEY ARE FORESEEABLE OR FOR CLAIMS BY ANY THIRD PARTY Notwithstanding the foregoing in no event shall Sierra Wireles...

Page 3: ...Rev 3 9 21 17 3 Revision History Revision number Release date Changes 1 August 2017 Document created ...

Page 4: ...ur mangOH Red For Development 20 Build and Install Legato Platform and mangOH Red Platform on Target 20 Connect To Mobile Networks 27 Connect To a Mobile Network 27 Connect to the IoT Cloud 31 Register and connect to AirVantage 31 Register with AirVantage 31 Connect to AirVantage 35 Develop and Test applications 39 Develop using the CLI Command Line Interpreter 39 Configure the Dev Machine s Termi...

Page 5: ... Finding your SIM s APN 50 Using the Linux Terminal program 50 Useful commands for this tutorial and more 51 Definitions 52 Hardware Tips 53 Dipswitch Settings 53 Console Access 54 Removing Inserting a CF3 Module 56 Removing a CF3 module 56 Inserting a CF3 module 57 Quick Reference Commands in this Guide 58 ...

Page 6: ...ggested requirements in Table 1 1 on page 7 for mangOH Red application development Important Use this guide only if you are using a native Linux computer dev elopment machine Ubuntu is recommended This guide includes instructions for native Linux dev machines using CLI Command Line Inter preter Important Follow all steps as described If you skip change or jump around steps your device or devel opm...

Page 7: ...onnect to the IoT Cloud on page 31 Things to check out after you finish the steps above Develop and Test applications on page 39 Update Legato Application Framework on page 47 Tips on page 50 Hardware Tips on page 53 Console Access on page 54 Quick Reference Commands in this Guide on page 58 Note As you work through this guide you can refer to Table G 1 on page 58 for descriptions of the commands ...

Page 8: ... window These commands are shown like this ping 192 168 2 2 cd CF3 module default credentials and IP address used to connect to the target from the dev machine USB ECM IP address 192 168 2 2 User name root Password none Terminal window tips Shortcut to open a terminal window on the default Unity desktop used in Ubuntu Linux Ctrl Alt T Cancel command to break out of a running process Ctrl C minicom...

Page 9: ...nt Do not start connecting components until told to in the instructions otherwise you may encounter problems later in the guide Connect CF3 USB port on bottom side of board Optionally connect CONSOLE USB Set jumper on Power Header to select USB Insert Sierra Wireless or other SIM card in slot on bottom side of board to connect Set dipswitches to proper Optionally attach the diversity antenna Attac...

Page 10: ...tup To set up the mangOH Red board 1 Remove the protective film from the dipswitches 2 Make sure the dipswitches are set as follows ON 1 3 5 8 OFF 2 4 6 7 For switch details not needed for this tutorial see Dipswitch Settings on page 53 Remove this film ...

Page 11: ...SIM you can still continue with the tutorial but will not be able to complete the following sections Connect To Mobile Networks on page 27 and Connect to the IoT Cloud on page 31 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 27 Tip If you have trouble connecting an antenna make sure it is positioned directly on the...

Page 12: ... USB connectors CF3 USB is used for SSH connections AT commands and firmware downloads CONSOLE_USB is a serial connection used to access the module s console for diagnostic purposes Note OPTIONALLY if you want to be able to display the target s console messages diagnostic messages and have two available USB ports on your dev machine follow the instructions in Console Access on page 54 This is NOT ...

Page 13: ...e not possible if it is connected to CONSOLE USB serial USB connections are not possible 7 On the dev machine open another terminal window 8 Make sure the modemmanager package is removed from your system this package causes problems with mangOH Red if it is not removed sudo apt get remove y modemmanager 9 Wait 10 15 seconds for the mangOH Red to enumerate 10 Test the CF3_USB connection ping 192 16...

Page 14: ...3 1 Hardware Setup Rev 3 9 21 17 14 Now you are ready to Prepare Your Linux Dev Machine For Legato Development on page 15 ...

Page 15: ...pecific you must make sure you install the toolchain designed for your module mangOH Red platform Drivers for on board components and a basic device to cloud application To build and install the development environment on your dev machine 1 Open a terminal window 2 Install packages required for the development environment a Display your Ubuntu version lsb_release d 3 Check whether your dev machine...

Page 16: ...mand failed 6 If your dev machine is 64 bit install additional dependencies sudo apt get install y lib32z1 lib32ncurses5 7 Build the Legato toolchain SDK a If you have previously installed Legato toolchains make sure you do not have any old toolchain files poky sh in your Downloads directory e g Downloads and remove any changes that may have been made to your bashrc file i Go to your Downloads dir...

Page 17: ... download link the link is to a sh file Note You must register on the Source for an account before you can download files c Click Download d If prompted save the file to your Downloads folder e g Downloads e In the terminal window open the folder and run the file In the command below replace file_name with the actual file name e g If the file name is poky swi ext sample 1 7 3 sh the command would ...

Page 18: ...d opt swi y17 ext sysroots armv7a vfp neon poky linux gnueabi usr src kernel sudo chown R USER ARCH arm CROSS_COMPILE arm poky linux gnueabi make scripts sudo chown R root 8 Install the repo application which will be used to clone the Legato file repository sudo apt get install y repo 9 If the install in Step 8 failed because phablet tools was previously installed a Enter the following command sud...

Page 19: ...following line at the end of the file export MANGOH_ROOT mangOH_work b Save and close the file c Exit the window exit d Open a new terminal window which automatically executes the bashrc script which now sets the MANGOH_ROOT shortcut automatically Now that the Legato development environment is installed you can Prepare Your mangOH Red For Development on page 20 Note mangOH_work_directory is option...

Page 20: ...egato docs latest aboutReleaseInfo html to get the version number of the most recent release b Download the framework files into a working directory for example legato_framework i Create a working directory below your home directory to hold the framework files for example legato_framework mkdir legato_framework ii Download the framework files into the work directory Replace the release number in t...

Page 21: ...nal step to remove clutter from previous builds make wp85 Build the framework Note This may take several minutes to run Note You don t need to use make clean the first time you use this procedure to build the Legato AF If you have to redo the procedure for some reason use this command to clear out build artifacts files generated and stored by the make wp85 command IMEI IMEI ...

Page 22: ...omatically executes the bashrc script which makes the cfglegato shortcut available for use 4 Configure the terminal window to work with the Legato AF s tools cfglegato Set up the environment 5 Update the target s firmware to the latest available version a Go to https source sierrawireless com and do the following i In the Devices section click AirPrime ii Click WP series Important You must enter t...

Page 23: ...file 192 168 2 2 c Wait 1 2 minutes while the module reboots with the new firmware d Verify that the firmware updated i Connect to the mangOH Red ssh root 192 168 2 2 ii The following message appears if you are using your CF3 module for the first time modules are shipped without a password For now type 3 and press Enter then type Y and press Enter to be reminded the next time you connect Note The ...

Page 24: ...t the update file mangOH_Red wp85 update was created ls al update Note This may take several minutes to run The number of packages listed will vary newer platform releases will have different numbers of files Note In the command make red_wp85 wp85 indicates the target type on which the applications will run If a different module type is used the make command must be modified to indicate the correc...

Page 25: ...be SUCCESS Done 11 Verify the mangOH platform apps installed correctly a Connect to the mangOH Red ssh root 192 168 2 2 b Show the list of installed apps to confirm the build and install succeeded app status If the following apps appear in the list the build and install succeeded c Disconnect from the mangOH Red exit Note If the target has any problems starting the mangOH Red platformat applicatio...

Page 26: ...5 1 Build and Install Legato Platform and mangOH Red Platform on Target Rev 3 9 21 17 26 Now that the mangOH Red platform is installed you will learn how to Connect To Mobile Networks on page 27 ...

Page 27: ...lug the micro USB cable that is providing power b 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 c Reconnect the power plug in the micro USB cable or insert the jumper on the power header on the same pins it was removed from in step a ...

Page 28: ... above Important Typically your module will register on a network in 1 minute However the very first time your CF3 module and Sierra SIM are used registration may take from 5 20 minutes Note The Home Network Operator is the ISP that provides the network on which the target is connected This may be different than the provider of the SIM if you are connecting to a network that your SIM s provider ha...

Page 29: ...he following command cm data apn your_apn If you do not know the APN for your SIM i Search the Internet for the APN for your Home Network Operator that you showed in Step 5 for example search for Rogers Wireless ii Set the APN as described above c Check the connection status again to make sure you set the APN correctly cm data Note The APN for the Sierra Wireless SIM is internet sierrawireless com...

Page 30: ...and the SIM is installed and configured with the correct APN You are now ready to transmit data to the IoT cloud In the next section Connect to the IoT Cloud on page 31 you will set up your free account on the Sierra Wireless AirVantage IoT Acceleration Platform and begin sending data to the cloud ...

Page 31: ...atform for your CF3 module This platform provides Sierra Wireless cloud based services for over the air OTA device management and application enablement These services provide the infrastructure for you to build connect and operate your IoT applications in a single platform To use AirVantage you must register your device and then connect your mangOH Red to the AirVantage server 7 1 1 Register with...

Page 32: ... your name etc Phone number Use international format for example for North American phone numbers use 001 plus the 10 digit area code and phone number 3 Review the Terms of Service and select I agree to the Terms of Service 4 Click Signup An email is sent automatically to your email address with a confirmation link 5 Open the email and click the link to confirm your signup request Important Use a ...

Page 33: ...ord is acceptable the AirVantage Login screen appears 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 20 a Open a terminal window and connect to the device ssh root 192 168 2 2 b Display the device information including the FSN and IMEI cm inf...

Page 34: ...n at the bottom of the screen 12 Now that your device is registered click the monitor icon at the right side of your device entry or click Monitor at the top of the screen and select Systems to go to the System Details screen see next step 13 The System Details screen displays widgets reporting information about your device communications received from it running applications etc The areas shown b...

Page 35: ...hat 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 app start redSensorToCloud app status Note redSensorToCloud automatically opens a data connection so you do not need to use cm data connect System Info Details about the CF3 Last Communication When you ...

Page 36: ...ommunication section shows your Registration connection or sensor data whichever was most recently received System Info Information about the CF3 module in your mangOH board Last Communication Shows when your board last communicated with AirVantage and the type of communication For example this CF3 communicated its Registration Last Communication Shows your most recent sensor data ...

Page 37: ...firm the app has stopped app stop redSensorToCloud app status Note redSensorToCloud automatically closes the data connection so you do not need to use cm data connect 1 Timeline has sorting options to choose the data to display This example shows the two most recent sets of sensor data The second set is expanded to show each sensor reading ...

Page 38: ...your device to AirVantage and completed the mangOH Red Getting Started tutorial For more information on the mangOH platform visit mangoh io To begin developing simple applications or modifying existing applications work through the examples in Develop and Test applications on page 39 ...

Page 39: ...rk with Legato tools Each time you open a new terminal window do the following 1 Configure the window cfglegato Note You will be updating application source code in this section Use whichever editor you prefer these instructions do not refer to a specific editor Note This tutorial touches on the basics of using the Legato development environment After completing the examples in this chapter see ht...

Page 40: ...pplication are in two sub folders avPublisherComponent and sensorsComponent The code that controls the publishing frequency is in avPublisherComponent change directory to that folder cd avPublisherComponent 5 Open and edit the source code avPublisher c with your preferred editor two values must be updated to adjust the reporting frequency a Search for the variable declaration for MaxIntervalBetwee...

Page 41: ...k properly with other applications that it depends on or that depend on it To rebuild mangOH Red platform including redSensorToCloud with your changes and install it onto your mangOH Red 6 Build and install the mangOH Red platform cd MANGOH_ROOT make red_wp85 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...

Page 42: ...AirVantage account you will start to see sensor reports appearing on your new schedule on the Timeline screen you can compare the timestamp intervals for new reports compared to reports received before you made your changes as shown in the following figure To see new reports received while this screen is being viewed click the Sync status icon Note If the target has any problems starting the mangO...

Page 43: ...ou 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 On the dev machine open a new terminal window 2 Configure the window for development cfglegato 3 Change directory to the sample application directory for Hello World cd ...

Page 44: ... a message from hello world appears logread f grep Hello 2 Run the application a Open a terminal window to run the application referred to as APP_TERM in this procedure Note This make command uses the Makefile in the current directory to build only the sample application It does not build the entire system like the make command in Update an Installed Application on page 40 Note This application wi...

Page 45: ...uilt to run automatically when you write your own applications you can make them install without running if you prefer d Stop the application so you can restart it and see the output app stop helloWorld e Run the application and see that it outputs a Hello world message to the LOG_TERM terminal window app start helloWorld f Optional If you want to see information about the application enter the fo...

Page 46: ...OG_TERM terminal window press Ctrl C to return to the command prompt You have now successfully compiled a working application and installed stopped and run it on the module Note To learn more about the Legato development environment visit http legato io legato docs latest ...

Page 47: ...machine using the procedure below B 1 Update the Legato AF on Your Dev Machine To update the Legato AF on your dev machine 1 Open a terminal window 2 Configure your environment for development cfglegato 3 Check the version of the Legato AF that is currently installed cd LEGATO_ROOT ls al repo The installed version is indicated in the manifest xml link 4 Go to http legato io legato docs latest abou...

Page 48: ...ou can restore the current framework if necessary at a later point replace version with your current Legato AF version in the following command mv legato legato_ version ii Download the framework files into the work directory and follow any prompts that may appear repo init u git github com legatoproject manifest m legato releases 17 07 1 xml repo sync Note Through the rest of this guide legato_fr...

Page 49: ...Legato AF on Your Dev Machine Rev 3 9 21 17 49 6 Build and install the Legato AF cd legato make clean Optional step to remove clutter from previous builds make wp85 Build the framework cfglegato Set up the environment ...

Page 50: ...inal program 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 Open a terminal window For example in the Unity desktop shell used by default on Ubuntu Lin...

Page 51: ... use cm data apn yourAPN Set the APN for your profile to the APN from your SIM provider cm data connect Start a data connection cm data connect timeout Start a data connection keep trying for up to timeout seconds Refer to cm data http legato io legato docs latest toolsTarget_cm html toolsTarget_cm_data for more details and command options SIM cm sim info Display information about the SIM cm sim s...

Page 52: ...t admin privileges Legato Application Framework AF Collection of daemons Supervisor Config tree service directory etc liblegato and tools that provide a framework for developing and installing apps on modules e g WP8548 Legato Platform Legato Application Framework Platform services and a toolchain applications running on top of a supported operating system e g Linux or RTOS Platform Services Colle...

Page 53: ...ombined with LowPower_RESET indicates that board is in HL mode Off Default When combined with LowPower_RESET indicates that board is in WP mode 5 BATT_TS On Default Enable backup battery charging Off Disable backup battery charging 6 CONS_DIR On Console USB connector accesses the Wi Fi Bluetooth module s console Note To download firmware to the Wi Fi module set CONS_DIR OFF and WIFI_UART1_TX ON Of...

Page 54: ... the terminal window enter the following command to install the minicom application on your dev machine if it is not already there sudo apt get install y minicom b Connect to the target s Linux console via the USB serial port which enumerated when you connected the CONSOLE USB connector to the dev machine minicom D dev ttyUSB0 A welcome message appears and the window will show console messages whe...

Page 55: ... enumerate ttyUSB0 ttyUSB1 and ttyUSB2 Then when CONSOLE USB is connected it will enumerate as ttyUSB3 Note You can exit minicom at any time the purpose of showing it here is to demonstrate how to display console messages for debugging purposes To exit minicom press Ctrl A then press X When prompted select Yes to leave minicom Note Through the rest of this guide examples use terminal windows conne...

Page 56: ...Remove the module cover using the module cover removal tool Starting at one corner insert the tool in the pair of holes and carefully pry the cover away from the module 2 Repeat at the other locations pairs of pry holes are on each side 3 Lift the cover off the module 4 Carefully lift the module straight up out of the socket ...

Page 57: ...ngles on the module and socket The module will drop straight into the socket Position matters 2 Hold the module cover over the module and line up the circle on the cover with the triangle on the label then press the cover on the edges into place The triangle on the label matches the position of the triangle on the socket The triangle on the label matches the position of the circle on the cover ...

Page 58: ...directory Note is an alias of the user s home directory cfglegato This is an alias that you set up in your bashrc file The bashrc is a startup script that runs each time a new terminal window is opened This is a shortform command to run the longer series of commands needed to go to the Legato AF directory and set up the environment variables used for Legato development cm Refer to http legato io l...

Page 59: ... submodule init Update the git configuration with any new submodules added recently git submodule update Check out the version of the submodule specified by the current version of the parent repository instsys update_file ip_address Install the specified file on the device at ip_address logread f grep Hello Print any new syslog messages that contain the string Hello ls al files List details about ...

Page 60: ...k out the specified version of each repository in the manifest repo sync Get the latest updates for all git repositories and perform all updates allowed by the manifest rm filename Remove delete the listed file ssh root ip_address Log in as the root user to the device at ip_address sudo command Run the command as the superuser root admin privileges sudo chown R username path Change the file owners...

Reviews: