at&t iot starter kit (lte-m, stm32l4) getting started...

32
© 2018 Avnet. All rights reserved. All trademarks and registered trademarks are the property of their respective owners. All specifications are subject to change without notice. NOTICE OF DISCLAIMER: Avnet is providing this design, code, or information "as is." By providing the design, code, or information as one possible implementation of this feature, application, or standard, Avnet makes no representation that this implementation is free from any claims of infringement. You are responsible for obtaining any rights you may require for your implementation. Avnet expressly disclaims any warranty whatsoever with respect to the adequacy of the implementation, including but not limited to any warranties or representations that this implementation is free from claims of infringement and any implied warranties of merchantability or fitness for a particular purpose. Page 1 AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guide Version 1.3 o STM32L4 Discovery Kit IoT Node o Avnet M14A2A WNC Cellular Shield o AT&T Flow Designer

Upload: others

Post on 05-Apr-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

© 2018 Avnet. All rights reserved. All trademarks and registered trademarks are the property of their respective owners. All specifications are subject to change without notice. NOTICE OF DISCLAIMER: Avnet is providing this design, code, or information "as is." By providing the design, code, or information as one possible implementation of this feature, application, or standard, Avnet makes no representation that this implementation is free from any claims of infringement. You are responsible for obtaining any rights you may require for your implementation. Avnet expressly disclaims any warranty whatsoever with respect to the adequacy of the implementation, including but not limited to any warranties or representations that this implementation is free from claims of infringement and any implied warranties of merchantability or fitness for a particular purpose.

Page 1

AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guide Version 1.3

o STM32L4 Discovery Kit IoT Node o Avnet M14A2A WNC Cellular Shield o AT&T Flow Designer

Page 2: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 2

Document Control

Document Version: 1.3

Document Date: 06/11/2018

Document Author: Peter Fenn

Document Classification: Public

Document Distribution: Public

Prior Version History

Version Date Comment

Draft 0.1 12/22/2017 Initial Draft

Draft 0.2 01/15/2018 Added:

- Support forums

- Keil download and licensing instructions

- Missing diagrams

Draft 0.3 01/17/2018 Typo corrections

1.0 02/22/2018 First release

- Updated Kit name and Avnet shield name

- Updated and added missing figures

1.1 03/07/2018 Formatted to Avnet document template

1.2 03/14/2018 Keil MDK installation and licensing section updated

1.3 06/11/2018 - References to starterkit.att.com now corrected to marketplace.att.com/quickstart - Procedure added for configuring the cloned AT&T Flow project

- Installation of STM32L475VGT device to Keil tools added

- Renumbered all procedure steps for easier reference - Appendix B SIM Management section added

Page 3: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 3

Contents

Introduction ................................................................................................................. 5

Starter Kit Contents ..................................................................................................... 5

STMicroelectronics STM32L4 Discovery Kit IoT Node ................................................ 7

Avnet M14A2A LTE Cellular Shield ............................................................................. 8

WNC Module Firmware ............................................................................................... 9

ARM Keil IDE .............................................................................................................. 9

Keil Software Download .............................................................................................. 9

Install Keil License..................................................................................................... 10

Use Pack Installer to Add STM32L475VGT to the Keil Tools .................................... 12

Create Online Accounts ............................................................................................ 13

Register Cloudconnectkits.org Account (Avnet) ........................................................ 13

Register an AT&T Account and Activate the AT&T SIM ............................................ 13

Clone the AT&T Flow Designer Project ..................................................................... 13

Register a PubNub Account ...................................................................................... 18

Create a PubNub Application .................................................................................... 19

Connect AT&T Flow to PubNub ................................................................................ 21

Register a Freeboard.io Account ............................................................................... 22

Link Freeboard.io to PubNub .................................................................................... 22

Assemble the AT&T IoT Kit Hardware ....................................................................... 23

Download and Configure the Example Application ................................................... 24

Verify the Dashboard Visualization............................................................................ 28

Appendix A – WNC Module Firmware Update .......................................................... 29

Appendix B – SIM Management ................................................................................ 31

Page 4: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 4

Figures

Figure 1 - AT&T IoT Starter Kit (LTE-M, STM32L4) Data Flow .................................................................... 5 Figure 2 - AT&T IoT Starter Kit (LTE-M, STM32L4) Contents ...................................................................... 6 Figure 3 - STM32L4 Discovery Kit IoT Node ................................................................................................ 7 Figure 4 - Avnet WNC M14A2A Cellular Shield ............................................................................................ 8 Figure 5 - The AT&T IOT Starter Kit Two Board Assembly .......................................................................... 8 Figure 6 - Block Diagram of Assembled System .......................................................................................... 9 Figure 7 - Screenshot of KEIL Software Download Page ........................................................................... 10 Figure 8 - Key Steps In the License Management Dialog .......................................................................... 11 Figure 9 - Keil PSN Label On The Quick Start Card ................................................................................... 11 Figure 10 – How To Launch Flow From AT&T Menu ................................................................................. 14 Figure 11 - Accessing AT&T Flow Community Projects ............................................................................. 14 Figure 12 - Search for Avnet STM32L4 IoT Kit Project .............................................................................. 15 Figure 13 - Forking the Avnet STM32L4 IoT Kit Project ............................................................................. 15 Figure 14 - Deploying the Project ............................................................................................................... 16 Figure 15 - Project Deployment in Progress ............................................................................................... 16 Figure 16 - Steps to Update the Host Name and URL ............................................................................... 17 Figure 17 - Pubnub Landing Page .............................................................................................................. 18 Figure 18 - Accessing the Pubnub Registration Page ................................................................................ 18 Figure 19 - The Pubnub Registration Form ................................................................................................ 18 Figure 20 - Create a New Pubnub App ....................................................................................................... 19 Figure 21 - Name the Pubnub App ............................................................................................................. 19 Figure 22 - Opening the Pubnub App ......................................................................................................... 19 Figure 23 - The Pubnub App Keys .............................................................................................................. 20 Figure 24 - Pubnub related nodes in AT&T Flow ........................................................................................ 21 Figure 25 - Adding the Pubnub Keys to Flow ............................................................................................. 21 Figure 26 - A Fully Assembled Kit ............................................................................................................... 23 Figure 27 - Locating the Reference Design Project Files ........................................................................... 24 Figure 28 - Customizing the Device ID and End Point Address in main.c .................................................. 24 Figure 29 - Accessing Flow Endpoint Information ...................................................................................... 25 Figure 30 - Opening the FlowStreamClient.h Header File .......................................................................... 25 Figure 31 - Saving Files in Keil ................................................................................................................... 26 Figure 32 - Build the Keil Project ................................................................................................................ 26 Figure 33 - Keil Build Output After a Successful Project Build ................................................................... 26 Figure 34 - Flash the MCU on the STM32L4 Discovery Kit IoT Node ........................................................ 27 Figure 35 - Keil Output Showing Successful Flashing of MCU ................................................................... 27 Figure 36 - Dashboard Showing Data Published to the Cloud from IoT Starter Kit.................................... 28 Figure 37 - WNC M14A2A Module Firmware Query – LTE Cat-1 Firmware .............................................. 29 Figure 38 - WNC M14A2A Module Firmware Query – LTE-M (Cat-M1) Firmware .................................... 30

Page 5: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 5

Introduction This guide provides an overview of the AT&T IoT Starter Kit (LTE-M, STM32L4) hardware and software and includes the key steps to quickly begin using this kit.

The IoT Starter Kit consists of a hardware platform comprised of a STMicroelectronics STM32L4 Discovery Kit IoT Node board plus an Avnet Arduino-compatible WNC M14A2A Cellular modem shield, stacked onto it. The modem sends/receives data via cellular data link back to the AT&T M2X/Flow website.

The example software provided lets you take measurements using a variety of sensors on the STM32L4 Discovery IoT board and send these values to a Freeboard.io dashboard via PubNub and the AT&T FLOW server.

The Firmware is developed and compiled using the ARM Keil MDK tools.

Once installed on the STM32L4 microcontroller, the application software uses several interfaces such as I2C, GPIO, and UART to communicate with the various sensors on the IoT board and the cellular modem. Periodically, data is read from the sensors, formatted and sent to the cloud via the cellular modem. Commands, in the form of JSON strings, can be sent back to the IoT Starter Kit from the cloud and instruct the device to control on-board components (such as the user LED for example).

System data flow is shown below.

FIGURE 1 - AT&T IOT STARTER KIT (LTE-M, STM32L4) DATA FLOW

Starter Kit Contents The kit contains all the elements needed to implement a complete wireless IoT solution. It includes all the components shown and described on the next page…

Page 6: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 6

FIGURE 2 - AT&T IOT STARTER KIT (LTE-M, STM32L4) CONTENTS

STMicroelectronics STM32L4 Discovery Kit IoT Node

Avnet WNC M14A2A Cellular Shield

AT&T Starter SIM

1 LTE Blade Antenna

2 micro USB cables

5V DC power adapter to power Avnet WNC M14A2A Cellular Shield

Quick Start Card

Downloadable example designs and tutorials available at:

http://cloudconnectkits.org/product/att-stm32-iot-starter-kit

Forum support available via the following sites:

Avnet WNC M14A2A Cellular Shield, Reference Design and AT&T related questions: http://cloudconnectkits.org/forum

STM32L475 board, ST-LINK, STM32 software libraries, etc: https://community.st.com/community/stm32-community

Keil MDK tool questions: http://www.keil.com/forum

Page 7: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 7

STMicroelectronics STM32L4 Discovery Kit IoT Node The STM32L4 Discovery Kit IoT Node is the host development and operational platform. It features:

An STM32L475VG microcontroller (80 MHz, 1MB Flash, 128kB SRAM)

64-Mbit Quad-SPI Flash memory

Bluetooth® V4.1 module

Sub-GHz low-power-programmable RF module

Wi-Fi® module Inventek ISM43362-M3G-L44 (802.11 b/g/n compliant)

Dynamic NFC tag

2 digital omnidirectional microphones (MP34DT01)

Capacitive digital sensor for relative humidity and temperature (HTS221)

High-performance 3-axis magnetometer (LIS3MDL)

3D accelerometer and 3D gyroscope (LSM6DSL)

260-1260 hPa absolute digital output barometer (LPS22HB)

Time-of-Flight and gesture-detection sensor (VL53L0X)

2 push-buttons (user and reset)

USB OTG FS with Micro-AB connector

On-board ST-LINK/V2-1 debugger/programmer

More information on the STM32 series of microcontrollers from STMicroelectronics can be found at:

https://www.st.com/stm32

FIGURE 3 - STM32L4 DISCOVERY KIT IOT NODE

Page 8: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 8

Avnet M14A2A LTE Cellular Shield The Avnet-designed Arduino Shield is based on a Wistron NeWeb Corporation (WNC) M14A2A cellular module. This module contains all necessary protocol stack functionality needed to establish and maintain a data connection in an LTE-M network. The WNC cellular module is controlled/managed via AT commands exchanged using a serial port connection to the STM32L4 Discovery Kit IoT Node. This is referred by WNC as a Type III interface to allow support for the 3GPP defined AT commands plus proprietary AT commands.

FIGURE 4 - AVNET WNC M14A2A CELLULAR SHIELD

FIGURE 5 - THE AT&T IOT STARTER KIT TWO BOARD ASSEMBLY

Page 9: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 9

The system-level block diagram for this version of AT&T IoT Starter Kit is shown below:

FIGURE 6 - BLOCK DIAGRAM OF ASSEMBLED SYSTEM

WNC Module Firmware The WNC M14A2A module has been factory programmed with IMA3 firmware for LTE Cat-M1 operation.

If there is a need to check this firmware version or reprogram the module, please refer to Appendix-A

at the end of this document

ARM Keil IDE The firmware for the STM32L4 Discovery Kit IoT Node is developed, compiled and debugged using Arm® Keil MDK, a full-featured IDE with advanced debugging capabilities and CMSIS library support for thousands of Arm® Cortex-M devices. More detail about this professional IDE is available at: http://www2.keil.com/mdk5

Keil Software Download Download the Keil tools as follows:

1. Go to: https://www.keil.com/demo/eval/arm.htm

2. Provide the information requested in the form there and click Submit

3. Follow the instructions on the page which follows that, to download and install the Keil tools…

Page 10: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 10

FIGURE 7 - SCREENSHOT OF KEIL SOFTWARE DOWNLOAD PAGE

Install Keil License After installing the Keil tools, a license needs to be installed. This IoT Starter kit includes a Product Serial Number (PSN) for a 90-day license for the Keil tools. The key steps in this licensing procedure are summarized below:

1. Right-click on the Keil uVision5 desktop icon and select Run as Administrator

2. Navigate to Menu / File / License Management…

3. Select the Single-Use License tab in the dialog window that appears,

4. Click the Get LIC via Internet button…, then click the button OK to register the product. This action opens the License Management page on the Keil web site.

Page 11: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 11

FIGURE 8 - KEY STEPS IN THE LICENSE MANAGEMENT DIALOG

5. Locate the PSN label on the “IoT Starter Kit Quick Start Card” that was included inside the

shipping box (this has your unique PSN number authorizing use of the Keil tools for 90-days)

FIGURE 9 - KEIL PSN LABEL ON THE QUICK START CARD

6. Enter this 15 character PSN where prompted, together with your contact info and click the Submit button. An e-mail is sent back with the License ID Code (LIC) within a few minutes.

Page 12: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 12

7. Returning to the License Management dialog box, locate the field labeled New License ID Code (LIC) and now enter the LIC number received via email, then click Add LIC.

Now that a valid license has been installed for the Keil tools, you are ready to start developing your application software for the STM32L4 Discovery Kit IoT Node…

If additional detail is required on the license installation procedure, please refer to the Keil website: http://www.keil.com/support/man/docs/license/license_sul_install.htm

Use Pack Installer to Add STM32L475VGT to the Keil Tools

8. Launch the Keil IDE, then open the Pack Installer (from the menu icon, or Project > Manage)

9. Support for the STM32L475VGT device needs to be installed. Download the applicable STM32L4 Device Family Pack from: http://www.keil.com/dd2/stmicroelectronics/stm32l475vgtx/eula-container

10. Once this has completed, select File > Import to import the downloaded DFP file (Keil.STM32L4xx_DFP.2.0.0.pack)

11. In the Device Installer, select the Devices tab, then enter STM32L475VGT in the search box

12. Click on the relevant Unpack buttons in the right-hand panel and then exit the Device Installer once this has completed

Page 13: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 13

Create Online Accounts To implement the out-of-box example, the following is required:

a) Accounts need to be set-up on four websites b) An AT&T SIM card needs to be activated

This is tabled below and step-by-step details provided in the paragraphs that follow:

Account Name / Website URL Purpose

http://cloudconnectkits.org Avnet support forums, project files and documentation

https://marketplace.att.com/quickstart AT&T account registration, SIM activation, Flow, etc access

https://www.pubnub.com Real-time data streaming service from AT&T to dashboard

https://freeboard.io Browser-based dashboard visualization of measurement data

Register Cloudconnectkits.org Account (Avnet) 13. Navigate to http://cloudconnectkits.org 14. Press the Sign In/Register button. A drop-down appears from which you can create an account. 15. When asked for Serial Kit Number, use the WNC Serial Number (S/N) as shown below. 16. Once registered, you are logged in and a confirmation email is sent to your email address. 17. Select the AT&T IoT Starter Kit (LTE-M, STM32L4) webpage for access to this kit’s design

documentation, bill of materials, reference designs and other information. http://cloudconnectkits.org/product/att-stm32-iot-starter-kit

Register an AT&T Account and Activate the AT&T SIM 18. Navigate to https://marketplace.att.com/quickstart 19. Click-on Login then Signup (top right corner of webpage) 20. Complete the AT&T IoT Platform Account Signup form then click the Create Account button 21. Once logged-into your new account, select Management > Register SIMs from the menu at the

top of the webpage 22. Type-in the SIM Card’s ICCID (20 digit number printed on the SIM card) into the form and provide

a descriptive nickname for this SIM 23. Click the Register SIMs button

(150 MB data and 150 SMS messages has now been allocated to the Starter SIM account)

Clone the AT&T Flow Designer Project Before proceeding with setup of a PubNub account, it is recommended to complete the initial setup of the AT&T Flow project that will be needed for the reference design.

Flow is a GUI-based IoT development tool based on NodeJS. It allows for data input and output along with user defined rules (for additional information on Flow, see https://flow.att.com/start )

Flow can be located via drop-down menu from your AT&T IoT Platform account, or accessed directly using https://flow.att.io

Page 14: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 14

FIGURE 10 – HOW TO LAUNCH FLOW FROM AT&T MENU

An existing Flow project will now be cloned and unique endpoint addresses and account keys added:

24. Navigate to https://flow.att.io/ and login using your AT&T account credentials 25. From lower left side of the Flow IDE, click Resources > Community Projects

FIGURE 11 - ACCESSING AT&T FLOW COMMUNITY PROJECTS

26. In the main pane under Search Projects, enter Avnet STM32 27. Select Avnet STM32L4 IoT Kit NoM2X

Page 15: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 15

FIGURE 12 - SEARCH FOR AVNET STM32L4 IOT KIT PROJECT

28. Click the blue Fork button in the top right to create a copy of the project for your exclusive use.

29. Name your copy of this project (eg. Avnet STM32L4 Kit Test) then click the Fork button inside the dialog box

FIGURE 13 - FORKING THE AVNET STM32L4 IOT KIT PROJECT

30. Once the project is copied, click the blue Deploy button in top right hand corner of the Flow GUI

Page 16: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 16

FIGURE 14 - DEPLOYING THE PROJECT

31. This causes the project to be compiled and deployed/activated. This step will take a while the first time it is deployed but subsequent deployments are much quicker.

FIGURE 15 - PROJECT DEPLOYMENT IN PROGRESS

32. Once the “Deploy” step has completed, locate the unique Base URL address that has been allocated, - this is visible in the “Endpoints” panel (at bottom of the page). Copy this Base URL via the Windows clipboard to a Windows Notebook window

Page 17: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 17

33. Double click the Configuration function node of the cloned Flow design and then edit the following parameters using the copied base URL (pay attention to the format of these): base_hostname base_uri

FIGURE 16 - STEPS TO UPDATE THE HOST NAME AND URL

34. Once sure the edits are correct, click on Done and then click on Deploy again

Page 18: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 18

Register a PubNub Account Next, a free PubNub account is created to allow Flow to be connected to a dashboard on freeboard.io.

35. Open a new browser tab or window, do not close the Flow window/tab as we will be using it in an upcoming step.

36. In the new tab/window, navigate to https://www.pubnub.com/ and click on Login (located in top right area of the web page)

FIGURE 17 - PUBNUB LANDING PAGE

37. Click on No Account? Register now! (- located in top right area of the web page)

FIGURE 18 - ACCESSING THE PUBNUB REGISTRATION PAGE

38. Provide the necessary information and click Register

FIGURE 19 - THE PUBNUB REGISTRATION FORM

Page 19: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 19

Create a PubNub Application Next, we create a new PubNub application and connect it to AT&T Flow:

39. Click Create New App button in the top right of the web page

FIGURE 20 - CREATE A NEW PUBNUB APP

40. Give the App a name, for example ATT_IoT_Starter_Kit

FIGURE 21 - NAME THE PUBNUB APP

41. Click on the app tile to open the app

FIGURE 22 - OPENING THE PUBNUB APP

Page 20: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 20

42. Click on the Demo Keyset tile to open the keys

FIGURE 23 - THE PUBNUB APP KEYS

43. Rename Demo Keyset to something more meaningful such as STM32L4_DK_IoT 44. Copy the Publish and Subscribe Keys (to a text file) – we will need to add these keys to the Flow

project to allow it to publish data to this PubNub app.

Page 21: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 21

Connect AT&T Flow to PubNub 45. Return to the Flow application and look for a set of 4 nodes that start with a pubnub GET HTTP IN

node. Double click on the pubnub_stm32 PUBNUB OUT node to open its parameters pane:

FIGURE 24 - PUBNUB RELATED NODES IN AT&T FLOW

46. Click on the Edit button to edit the keys and paste the publish and subscribe keys you obtained from your pubnub application (step 39 above) into the corresponding locations in this pane.

FIGURE 25 - ADDING THE PUBNUB KEYS TO FLOW

47. Click Update 48. Click Done 49. Click Deploy 50. The Flow PUBNUB OUT node is now configured to communicate with your PubNub application

Page 22: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 22

Register a Freeboard.io Account Next we will create a free account at Freeboard.io to allow us to view data sent by the STM32L4 Discovery Kit IoT Node to the cloud.

51. Open a new browser tab or window (do not close the Flow or PubNub tabs/windows, they will be required in a future step).

52. Navigate to https://freeboard.io 53. Click on the Pricing button in the top right corner 54. Click the START NOW button under the MICRO account 55. Provide the necessary information and create your account 56. Note: You will later need to cancel this account before the free 30-day trial period is exceeded!

Link Freeboard.io to PubNub 57. Once you have a freeboard.io account and are logged in, navigate to:

https://freeboard.io/board/RflSl3 58. Click on the CLONE button in bottom right corner of the dashboard, to make a copy of the

dashboard to your account 59. Open the dashboard tools pane if it is not already open (click on the wrench button at top center

of the web page) 60. Click on the pubnub_stm32 item under Datasources to open the configuration pane for this data

source 61. Copy and paste the subscribe key from the PubNub application into the Subscribe Key box in the

freeboard.io application datasource pane 62. Click on Save to save the configuration

Your freeboard.io dashboard should now be connected via PubNub to AT&T Flow.

Page 23: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 23

Assemble the AT&T IoT Kit Hardware The hardware is delivered as two separate boards. Use the following instructions to connect the boards.

63. Plug the Avnet WNC M14A2A Cellular shield into the Arduino headers on the STM32L4 Discovery Kit IoT Node board, making sure the Arduino pins and headers are correctly aligned

64. Plug the supplied AT&T Starter SIM card into the SIM socket on the shield 65. Attach the antenna to the Avnet M14A2A Cellular Shield SMA connector that is labelled Primary 66. The cellular shield requires 5V power from the provided USB power adapter. Plug a microUSB

cable into the 5V USB shield power on the Cellular shield and connect the other end of the cable to the provided USB Power adapter. LED1 illuminates light green.

67. Plug a microUSB cable into the STLink USB port on the STM32L4 Discovery Kit IoT Node board. Connect the other end of the cable to a USB port on your laptop.

FIGURE 26 - A FULLY ASSEMBLED KIT

Page 24: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 24

Download and Configure the Example Application

68. Download the Reference Design project listed under the “Startup Files & Reference Designs” tab

on the product webpage at: http://cloudconnectkits.org/product/att-stm32-iot-starter-kit

FIGURE 27 - LOCATING THE REFERENCE DESIGN PROJECT FILES

69. Unzip the project archive to a convenient location on your hard drive. We suggest keeping the path of the project as short to avoid path length limitations. In this example we unzip the files to c:\dev

70. Open the Keil project by double clicking on the applicable project file:

C:\dev\ATT_IoT_Starter_Kit\B-L475E_IOT01A\avnet_cell_port\MDK-ARM\Project.uvprojx

71. In the project panel on the left of the Keil window, expand the folder structure for avnet_cell and User by clicking on the + icons until you see the list of source files including main.c

FIGURE 28 - CUSTOMIZING THE DEVICE ID AND END POINT ADDRESS IN MAIN.C

Page 25: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 25

72. Double click on main.c to open this file in the editor pane on the right. 73. Scroll down until you reach a line starting with char deviceId[] then assign a device identifier of

your choice by replacing the text within the quote marks. 74. Next we need to add Flow Endpoint address info to enable the device to connect to Flow:

From the cloned version of the Flow project you edited earlier, copy the Base URL endpoint info, either from the notepad copy you made, or by again getting this from the Endpoints section at the bottom of the Flow GUI.

FIGURE 29 - ACCESSING FLOW ENDPOINT INFORMATION

75. Back in the Keil IDE, scroll a few lines up from the device ID in main.c to a line which contains #include "FlowStreamClient.h” x

76. Right-click on the line and select Open document “FlowStreamClient.h”. This will open the FlowStreamClient.h header file in a new tab

FIGURE 30 - OPENING THE FLOWSTREAMCLIENT.H HEADER FILE

77. Edit the DEFAULT_FLOW_HOST, FLOW_BASE_URL and FLOW_ENDPOINT defines to match your endpoint information from your Flow application (replace only the text between quotes “ ”). For this example your FLOW_ENDPOINT should not need to be changed, the default “/pubnub” should be used.

Page 26: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 26

78. Save all files by clicking the Save All icon:

FIGURE 31 - SAVING FILES IN KEIL

79. Click the Build button to build your device firmware

FIGURE 32 - BUILD THE KEIL PROJECT

80. If there are no errors, the target binary file will have been built

FIGURE 33 - KEIL BUILD OUTPUT AFTER A SUCCESSFUL PROJECT BUILD

Page 27: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 27

81. You can now flash the STM32L4 Discovery Kit IoT Node board with the firmware by clicking the Download button:

FIGURE 34 - FLASH THE MCU ON THE STM32L4 DISCOVERY KIT IOT NODE

82. Successful flashing of the board is indicated by Keil in the Build Output pane:

FIGURE 35 - KEIL OUTPUT SHOWING SUCCESSFUL FLASHING OF MCU

83. Reset the board to execute the firmware you have loaded onto the board. The reset button is the black pushbutton on the STM32L4 Discovery Kit IoT Node board.

84. Return to the freeboard.io tab in the browser – after a few seconds data should be displayed in the various gauges and graphs in the dashboard. The following information is displayed in the dashboard:

Humidity

Temperature

Pressure

3 axis Accelerometer data

3 axis Gyroscope data

3 axis Magnetometer data

Signal strength (RSSI) in dB

Signal strength indication (0-5 bars)

Local Time

Device Name

Page 28: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 28

Verify the Dashboard Visualization

FIGURE 36 - DASHBOARD SHOWING DATA PUBLISHED TO THE CLOUD FROM IOT STARTER KIT

Page 29: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 29

Appendix A – WNC Module Firmware Update The WNC M14A2A Cellular Module can be configured to run firmware to connect to LTE Cat-1 or LTE-M (LTE Cat-M1) cellular networks. This AT&T IoT Starter Kit (LTE-M, STM32L4) is intended for connection to the AT&T LTE-M network. Before assembling the kit or proceeding to the next steps, please verify your Cellular Shield has been programmed with the correct WNC firmware.

To determine which version of the firmware your cellular modem was shipped with, follow these steps:

1. Ensure you have a terminal emulator installed on your PC (eg. Tera Term) 2. Unplug the modem shield from the STM32L4 Discovery Kit IoT Node 3. Power the modem using the provided USB charger and micro USB cable (USB connector labeled

5V/DC on the modem shield) 4. Connect the modem to one of the PC’s USB ports using other micro USB cable (USB connector

labeled USB 2.0 on the modem shield) 5. Connect Tera Term to the modem’s serial Port using the File->New Connection dialog box

Check Serial and select the COM port labeled WNC M14A2A Modem Port 6. Check the Serial Port setup in Tera Term

Go to Setup->Serial Port

Make sure you have the following settings: 1. Baud Rate: 115200 2. Data: 8 bit 3. Parity: None 4. Stop: 1 bit 5. Flow Control: none

7. In the Tera Term console type ATI and hit enter. The modem should respond with the WNC firmware version information displayed in the console:

FIGURE 37 - WNC M14A2A MODULE FIRMWARE QUERY – LTE CAT-1 FIRMWARE

Page 30: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 30

FIGURE 38 - WNC M14A2A MODULE FIRMWARE QUERY – LTE-M (CAT-M1) FIRMWARE

8. LTE firmware will have its version number preceded by M14A2A_ as shown in Figure 37 - WNC M14A2A Module Firmware Query – LTE Cat-1 Firmware. If your modem is still configured with LTE Cat-1 firmware you will need to flash your modem with LTE-M firmware by following the steps described in step 10 below.

9. LTE-M firmware will have its version number preceded by IMA3_ as shown in Figure 38 - WNC M14A2A Module Firmware Query – LTE-M (Cat-M1) Firmware. If your modem is already running LTE-M firmware, you should flash your modem with new LTE-M firmware if the version number reported by your modem is lower than the one described in step 10 below.

10. Refer to the LTE-Firmware Upgrade section of the AT&T marketplace quickstart website for instructions on how to update the firmware on your cellular modem (plus the related image files) https://marketplace.att.com/quickstart Note: Please carefully read all instructions before performing the firmware upgrade, there are several steps that are not intuitive!

Page 31: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 31

Appendix B – SIM Management

You can monitor the status of your AT&T SIM card(s) from the AT&T Control Center

Navigate to this via the User drop-down menu at top-right of AT&T Marketplace webpage

On the screen that follows, click on the Launch AT&T Control Center button

Once the AT&T Control Center webpage displays, click on Devices to view a listing of your SIMs:

Page 32: AT&T IoT Starter Kit (LTE-M, STM32L4) Getting Started Guidecloudconnectkits.org/sites/default/files/GettingStarted... · 2019-02-13 · Page 5 Introduction This guide provides an

Page 32

AT&T Control Center includes useful tools for SIM Status Monitoring and Usage Analytics…