RoadTest: SimpleLink™ Wi-Fi® CC3220x Wireless MCU LaunchPad™
Author: jomoenginer
Creation date:
Evaluation Type: Evaluation Boards
Did you receive all parts the manufacturer stated would be included in the package?: True
What other parts do you consider comparable to this product?: CC3200
What were the biggest problems encountered?: Trying to figure out how to send RESTful API GET and POST message to the CC3220 OOB Demo via Python was a bit challenging since there were no examples to leverage from.
Detailed Review:
I was lucky enough to be selected to RoadTest the CC3220SF Launchpad from TI and after working with it with various demos, I am quite impressed with the functionality of this board. The CC3220 is the second generation of the TI Wireless Microcontroller CC32xx line of products and is a very nice upgrade from the previous CC3200.
TI provides a SimpleLink SDK for the CC3220 which has a number of sample applications that can be used and expanded on for a variety of IoT applications. The board can act as a Web Server, Access Point, MQTT Client and/or Server along with support with a number of the TI Booster Packs.
Some differences between the CC3220 and CC3200:
SimpleLink Wi-Fi CC31xx/32xx | Internet-on-a-chip | Getting Started | Wi-Fi | TI.com
CC3200
Device | Application dedicated on-chip Memory | Internet Protocols Supported | Application Level Security | SimpleLink MCU Platform |
---|---|---|---|---|
CC3200 | 256kB RAM | IPv4 | Not offered | Not offered |
CC3220SF | 1MB XIP Flash + 256kB RAM | IPv4, IPv6 | Yes | Yes |
In this RoadTest of the CC3220, I will cover:
1. CC3220 Out-Of-Box Demo
2. MQTT Client Demo
3. MQTT Client-Server Demo
4. Arrayent DevKit for the CC3220
The CC3220 comes preloaded with an Out-of-Box demo that can also be found in the SimpleLink SDK. This demo showcases the the various Wireless features of the CC3220 Radio as well as the RESTful API that is implemented in the code.
The first step in the demo of the board included downloading and installing the appropriate SDK and Firmware to both update the board to the current Firmware revision as well as obtain the code that includes the examples that show the various features of the CC3220.
These can be obtained from the TI site via:
Getting started guide:
http://www.ti.com/lit/ug/swru461/swru461.pdf
SimpleLink™ Wi-Fi® CC3220 Out-of-Box Application instructions:
http://www.ti.com/lit/ug/swru470/swru470.pdf
SimpleLink™ Wi-Fi® CC3220 Out-of-Box Application - User Guide
http://www.ti.com/lit/ug/swru473/swru473.pdf
SimpleLink™ Wi-Fi® CC3220 Software Development Kit (SDK)
SIMPLELINK-CC3220-SDK_1.40.01.00
http://www.ti.com/tool/download/SIMPLELINK-CC3220-SDK
SimpleLink™ Wi-Fi® Starter Pro (IOS and Android)
WIFISTARTERPRO SimpleLink™ Wi-Fi® Starter Pro | TI.com
Download and install Uniflash for CC3220:
Uniflash:
http://www.ti.com/lit/ug/swru469/swru469.pdf
Uniflash Wiki
http://processors.wiki.ti.com/index.php/Category:CCS_UniFlash
Current version for CC3220:
Current Version - 4.2.0.1435 for Windows/Linux, 4.2.0.1458 for Mac
CC3120 & CC3220 SimpleLink Tools
The first time using a CC3220 Launchpad, it is wise to update the code on the board to the latest rev.
Connect the CC3220 Launchpad to the computer and Start UniFlash.
If all goes well, the board should be automagically detected:
In the New Configuration Pane, select the CC3220; In this case CC3220SF-LAUNCHXL.
Click on the 'Start Image Creator' button and the following SimpleLink Image Creator page should appear
Click Manage Projects and the Project Management window should appear.
Import a OOB Project from the C3220 SimpleLink SDK install location. In this case, I selected the TI_RTOS version:
For CC3220SF secured device:
• <SDK install dir>
\examples\rtos\CC3220SF_LAUNCHXL\demos\out_of_box\uniflash\OOB_SF_tirtos.zip
• <SDK install dir>
Once selected, the imported project should show in the Project Management window:
This will bring up the Development Mode - Generate Image window. Click "Connect" to connect to the CC3220.
Ensure the MAC address is populated and then Save the Project then Click "Generate Image".
To program the board, click "Program Image (Create & Program).
A Progress window should appear and will show "Programming complete" if successful:
The RED LED at D7 should start to blink indicating the board is in Provisioning mode:
Using a serial port tool such as Putty, connection info from the CC3220 can be seen:
Once the CC3220 is programmed, the board will come up in Provision mode. A web Browser pointed to 'http://mysimplelink.net' or connecting to the board from SimpleLink Wi-Fi Starter Pro App allows the user to configure the board for a specific WiFi connection.
To connect to the board, look for the "mysimplelink-{ID NUM} SSID from the available networks.
NOTE: The following screen shots are from the SimpleLink™ Wi-Fi® CC3220 Out-of-Box Application Getting Started Guide.
Using the SimpleLink Wi-Fi Starter Pro App, open the App and search for the CC3220 Launchpad.
Navigate to Settings to set the board to "ON" for "Enable Smart Config" if enabled in the local WiFi router config, or "Off" to manually enter the configuration.
Navigate to the "Configuration Page" to name the device and connect to a local WiFi network.
Save the configuration:
If successful, a "Provisioning Successful" pop-up should appear.
Once the board has been configured to connect to the local WiFi connection and reset, the configured IP the board received from the local network can be used to view the CC3220 local web page.
Connect via web Broswer:
The IP address for the CC3220 grabed from the Wi-Fi connection can be gathered from the Console connect. In my case I used Putty to connect.
This is what the console output looks like after the CC3220 boots:
/// Console
============================================
out of box Example Ver: 1.00.00.09
============================================
CHIP: 0x30000019
MAC: 2.0.0.0
PHY: 2.2.0.5
NWP: 3.4.0.0
ROM: 0
HOST: 2.0.1.19
MAC address: 98:84:e3:f5:fe:08
============================================
[Provisioning task] Wake up on Power ON
[Provisioning task] detected device is CC3220SF
[WLAN EVENT] STA Connected to the AP: MySSID ,BSSID: f4:f2:6d:e2:20:98
[NETAPP EVENT] IP Acquired: IP=192.168.2.102 , Gateway=192.168.2.1
[Provisioning task] Connection to AP succeeded
[Provisioning task] IP address is 192.168.2.102
[Link local task] HTTP GET Request
Using the 'Acquired IP” connect to the CC3220 to view the on board web page.
Once “Start” is clicked, a screen showing the Device info; SSID, MAC Address, and IP Address, LED Control, and Accelerometer data.
If the CC3220 is moved, the accelerometer values will refelect the movement as does the image of the board. Also, changing the Led Control from On to Off controls the LED at D10.
Both the Web browser and eith IOS or Android apps connect to the CC3220 via the RESTful API. The connection and ReST GET and POST messages with board are visibly via the console output:
[Link local task] HTTP GET Request [Link local task] characteristic is: macaddress [Link local task] characteristic is: ipaddress [Link local task] characteristic is: ssid [Provisioning task] detected device is CC3220SF [Link local task] HTTP GET Request [Link local task] characteristic is: redled [Link local task] HTTP GET Request [Link local task] characteristic is: axisx [Link local task] characteristic is: axisy [Link local task] characteristic is: axisz [Link local task] HTTP POST Request [Link local task] characteristic is: redled [Link local task] value is: on
The HTTP RESTful API options are defined in the 'link_local_task.c' file as follows:
http_RequestObj_t httpRequest[NUMBER_OF_URI_SERVICES] = { {0, SL_NETAPP_REQUEST_HTTP_GET, "/ota", {{NULL}}, NULL}, {1, SL_NETAPP_REQUEST_HTTP_PUT, "/ota", {{NULL}}, NULL}, {2, SL_NETAPP_REQUEST_HTTP_GET, "/light", {{NULL}}, NULL}, {3, SL_NETAPP_REQUEST_HTTP_POST, "/light", {{NULL}}, NULL}, {4, SL_NETAPP_REQUEST_HTTP_GET, "/sensor", {{NULL}}, NULL}, {5, SL_NETAPP_REQUEST_HTTP_GET, "/device", {{NULL}}, NULL}, };
A Mailbox Request is used to pass the values for HttpRequest to GET or POST to the RESTful API tasks.
In 'link_local_task.c'
void initLinkLocalDB(void) { . . . httpRequest[3].charValues[0].characteristic = "redled"; httpRequest[3].charValues[0].value[0] = "off"; httpRequest[3].charValues[0].value[1] = "on"; httpRequest[3].charValues[0].value[2] = "toggle"; httpRequest[3].serviceCallback = lightPostCallback; httpRequest[4].charValues[0].characteristic = "axisx"; httpRequest[4].charValues[1].characteristic = "axisy"; httpRequest[4].charValues[2].characteristic = "axisz"; httpRequest[4].charValues[3].characteristic = "temp"; httpRequest[4].serviceCallback = sensorGetCallback; httpRequest[5].charValues[0].characteristic = "ssid"; httpRequest[5].charValues[1].characteristic = "ipaddress"; httpRequest[5].charValues[2].characteristic = "macaddress"; httpRequest[5].charValues[3].characteristic = "appname"; httpRequest[5].serviceCallback = deviceGetCallback; }
Another way to send GET and POST messages to the CC3220 RESTful API is via the Python HTTP Requests modules.
In order to issue RESTful commands with Python, the Python HTTP Requests module has to be installed.
This was performed on a Beaglebone Black running Debian version 7.11
sudo apt-get install python-requests
With Python Requests, the Temperature data can be retrieve from the CC3220 on board TMP006 sensor.
import requests resp = requests.get("http://192.168.2.202/sensor/temp") resp.status_code 200 resp.headers['content-type'] 'application/x-www-form-urlencoded' head = {'Content-Type' : 'application/json', 'Accept' : 'application/json’} resp = requests.get("http://192.168.2.202/sensor?temp") resp.text u'temp=73' resp = requests.get("http://192.168.2.202/sensor?temp") resp.text u'temp=76' resp.content 'temp=76’
The Accelerometer data can be accessed as well.
resp = requests.get("http://192.168.2.202/sensor?axisx") resp.content 'axisx=37' resp = requests.get("http://192.168.2.202/sensor?axisx") resp.content 'axisx=7’
Other options in the SimpleLink Starter Pro. Two options: Demo, as listed previously or Settings.
Clicking on the “?” icon, the following info is seen is provided.
About CC3220 OOB application This application demonstrates the Out-of-Box experience with CC3220 LaunchPad. The following features are highlighted: 1. Easy connection to CC3220 LaunchPad - using SimpleLink™ Wi-Fi® Starter application - direct connection to CC3220 set as Access Point 2. Easy access to CC3220 via its internal web server Demonstrates configuring and reading onboard sensors, accelerometer, temperature sensor and red LED. 3. Over The Air update. OTA service enables in-system update of the MCU application, OTA via web pages would be available in future updates.
Status – View the Status of the CC3220 Networking configuration:
Profile – Add Profile, Add WiFi Direct, Add Enterprise, Profiles ( Remove a profile that is not needed), or Remove all Profiles
Device – Device Mode ( Station, AP, WiFI Direct), Connection Policy, AP Configuration, WiFi Direct Configuration.
Network – Device Name, Station & Client IPv4 Settings, Station & Client Ipv6 Settings,
AP & Group-owner info.
Tools – Ping Test, Stop Test, Test Results. User to send a ping to an IP to verify the connection on the CC3220.
Basic Demo of the
Testing MQTT Client project from the CC3220 SimpleLink SDK.
This is an example of a MQTT Client running on the CC3220 using the example from the CC3220 SDK.
From Code Composer Studio, import the MQTT Client from the CC3220 SDK
C:\ti\simplelink_cc32xx_sdk_1_40_01_00\examples\rtos\CC3220SF_LAUNCHXL\demos\mqtt_client
Once the project has been imported, the Workspace should look like the following:
Adjust the MQTT Broker definition in the 'mqtt_client_app.c' file.
NOTE: By default, the example uses an IBM MQTT Broker but a Mosquitto Broker from a BeagleBone Black was used in this review.
/* Defining Broker IP address and port Number */ //#define SERVER_ADDRESS "messagesight.demos.ibm.com" //#define SERVER_ADDRESS "m2m.eclipse.org" //#define SERVER_IP_ADDRESS "192.168.178.67" //#define PORT_NUMBER 1883 //#define SECURED_PORT_NUMBER 8883 //#define LOOPBACK_PORT 1882 //#define SERVER_ADDRESS "m2m.eclipse.org" #define SERVER_ADDRESS "192.168.2.202" #define SERVER_IP_ADDRESS "192.168.2.202" #define PORT_NUMBER 8883 #define SECURED_PORT_NUMBER 8883 #define LOOPBACK_PORT 1883
Add the AP configuration to allow the CC3220 to connect to a local WiFi router in the 'network_if.h' file.
/* AP SSID */ //#define SSID_NAME "SPN24" /* Security type (OPEN or WEP or WPA) */ //#define SECURITY_TYPE SL_WLAN_SEC_TYPE_OPEN /* Password of the secured AP */ //#define SECURITY_KEY "" #define SSID_NAME "MYSSID" /* Access point name to connect to. */ #define SECURITY_TYPE SL_WLAN_SEC_TYPE_WPA_WPA2 /* Security type of the Access point */ //#define SECURITY_TYPE SL_SEC_TYPE_WPA_WPA2 /* Security type of the Access point */ //#define PASSKEY "<Your_AP's_Password>" /* Password in case of secure AP */ #define SECURITY_KEY "MYPASSKEY" /* Password in case of secure AP */ //#define PASSKEY "MYPASSKEY" /* Password in case of secure AP */ #define PASSKEY_LEN pal_Strlen(PASSKEY) /* Password length in case of secure AP */ #define SSID_LEN_MAX 32 #define BSSID_LEN_MAX 6 #define SSID_AP_MODE "<ap-ssid>" #define SEC_TYPE_AP_MODE SL_WLAN_SEC_TYPE_OPEN #define PASSWORD_AP_MODE ""
The MQTT client example subscribes to 4 topics and publishes to 2 s is defined in 'mqtt_client_app.c'.
/* Defining Number of subscription topics */ #define SUBSCRIPTION_TOPIC_COUNT 4 /* Defining Subscription Topic Values */ #define SUBSCRIPTION_TOPIC0 "/Broker/To/cc32xx" #define SUBSCRIPTION_TOPIC1 "/cc3200/ToggleLEDCmdL1" #define SUBSCRIPTION_TOPIC2 "/cc3200/ToggleLEDCmdL2" #define SUBSCRIPTION_TOPIC3 "/cc3200/ToggleLEDCmdL3" /* Defining Publish Topic Values */ #define PUBLISH_TOPIC0 "/cc32xx/ButtonPressEvtSw2" #define PUBLISH_TOPIC0_DATA "Push Button SW2 has been pressed on CC32XX device"
Recompile the project and Run the code on the CC3220.
If the configuration is valid, the CC3220 should connect to the MQTT Broker and subscribe to 4 topics
============================================ MQTT client Example Ver: 1.1.1 ============================================ CHIP: 0x30000019 MAC: 2.0.0.0 PHY: 2.2.0.5 NWP: 3.4.0.0 ROM: 0 HOST: 2.0.1.19 MAC address: 98:84:e3:f5:fe:08 ============================================ ************************************************* CC3220 MQTT client Application ************************************************* Device came up in Station mode [WLAN EVENT] STA Connected to the AP: MYSSID , BSSID: f4:f2:6d:e2:20:98 [NETAPP EVENT] IP acquired by the device Device has connected to MYSSID Device IP Address is 192.168.2.102 Version: Client LIB 1.1.0, Common LIB 1.2.0. .C: FH-B1 0x10 to net 0, Sent (52 Bytes) [@ 2] C: Rcvd msg Fix-Hdr (Byte1) 0x20 from net 0 [@ 2] C: Cleaning session for net 0 CONNACK: Connection Success C: Msg w/ ID 0x0000, processing status: Good C: FH-B1 0x82 to net 0, Sent (99 Bytes) [@ 2] C: Rcvd msg Fix-Hdr (Byte1) 0x90 from net 0 [@ 2] C: Msg w/ ID 0x0001, processing status: Good Client subscribed on /Broker/To/cc32xx ,Client subscribed on /cc3200/ToggleLEDCmdL1 ,Client subscribed on /cc3200/ToggleLEDCmdL2 ,Client subscribed on /cc3200/ToggleLEDCmdL3
To test the the MQTT functionality of the CC3220, a BeagleBone Black and a Raspberry Pi 3 each running Mosquitto (BBB - Broker; RasPi3 - Client).
An Open Source MQTT v3.1 Broker
NOTE: The configuration of the Mosquitto Broker will not be covered in this Review.
Once the Mosquitto Broker is installed and configured, Publish and Subscribe messages can be used to test the MQTT functionality of the CC3220.
Start the MQTT Broker
sudo mosquitto -c /etc/mosquitto/mosquitto.conf 1503728320: mosquitto version 1.4.12 (build date 2017-05-29 17:29:22+0000) starting 1503728320: Config loaded from /etc/mosquitto/mosquitto.conf. 1503728320: Opening ipv4 listen socket on port 1883. 1503728320: Opening ipv4 listen socket on port 8883. 1503728320: Opening websockets listen socket on port 8083. 1503728356: New connection from 192.168.2.102 on port 8883. 1503728356: New client connected from 192.168.2.102 as 9884e3f5fe08 (c1, k25).
Subscribe to the ButtonPressEvtSw2 topic. When SW2 is pressed on the CC3220, the event is published from the MQTT Client running on the CC3220 to the ButtonPressEvtSw2.
sudo mosquitto_sub -h 192.168.2.202 -p 8883 -t '/cc32xx/ButtonPressEvtSw2' Push Button SW2 has been pressed on CC32XX device Push Button SW2 has been pressed on CC32XX device Push Button SW2 has been pressed on CC32XX device Push Button SW2 has been pressed on CC32XX device
To Toggle the LEDs on the CC3220, Publish messages are sent to the ToggleLEDCmd1, ToggleLEDCmd2, ToggleLEDCmd3.
sudo mosquitto_pub -h 192.168.2.202 -p 8883 -t '/cc3200/ToggleLEDCmdL1’ -m 0 sudo mosquitto_pub -h 192.168.2.202 -p 8883 -t '/cc3200/ToggleLEDCmdL2' -m 0 sudo mosquitto_pub -h 192.168.2.202 -p 8883 -t '/cc3200/ToggleLEDCmdL3’ -m 0
CC3220 console showing MQTT message events
Msg Recvd. by client TOPIC: /cc3200/ToggleLEDCmdL3 PAYLOAD: 0 QOS: 0 C: Msg w/ ID 0x0000, processing status: Good C: Rcvd msg Fix-Hdr (Byte1) 0x30 from net 0 [@ 4797] Msg Recvd. by client TOPIC: /cc3200/ToggleLEDCmdL3 PAYLOAD: 0 QOS: 0 C: Msg w/ ID 0x0000, processing status: Good C: Rcvd msg Fix-Hdr (Byte1) 0x30 from net 0 [@ 4799] Msg Recvd. by client TOPIC: /cc3200/ToggleLEDCmdL3 PAYLOAD: 0
Video showing the CC3220 MQTT Client functionality
Besides running a MQTT client on the CC3220, the board is capable of running both a MQTT Client and Server simultaneously. This allows Remote Nodes to publish and subscribe to topics managed but the MQTT server on the CC3220 and then the CC3220 can publish and subscribe to topics via a central MQTT Broker.
As with the MQTT Client example, import the project from the CC3220 SimpleLink SDK:
C:\ti\simplelink_cc32xx_sdk_1_40_01_00\examples\rtos\CC3220SF_LAUNCHXL\demos\mqtt_client_server
To configure the MQTT client and server, the details of the WiFi AP and MQTT Broker need to be added to the code.
File: network_if.h
#define SSID_NAME "MYSSID" /* Access point name to connect to. */ #define SECURITY_TYPE SL_WLAN_SEC_TYPE_WPA_WPA2 /* Security type of the Access point */ //#define SECURITY_TYPE SL_SEC_TYPE_WPA_WPA2 /* Security type of the Access point */ //#define PASSKEY "<Your_AP's_Password>" /* Password in case of secure AP */ #define SECURITY_KEY "MYPASSWD" /* Password in case of secure AP */ //#define PASSKEY "MYPASSWD" /* Password in case of secure AP */ #define PASSKEY_LEN pal_Strlen(PASSKEY) /* Password length in case of secure AP */ #define SSID_LEN_MAX 32 #define BSSID_LEN_MAX 6 #define SSID_AP_MODE "<ap-ssid>" #define SEC_TYPE_AP_MODE SL_WLAN_SEC_TYPE_OPEN #define PASSWORD_AP_MODE ""
A couple of changes between the CC3200 SimpleLInk SDK and the CC3220 SDK include:
CC3200 SDK
#define SECURITY_TYPE SL_SEC_TYPE_WPA_WPA2 /* Security type of the Access point */
CC3220 SDK
#define SECURITY_TYPE SL_WLAN_SEC_TYPE_WPA_WPA2 /* Security type of the Access point */
CC3200 SDK
#define PASSKEY "MYKEY" /* Password in case of secure AP */
CC3220 SK
#define SECURITY_KEY "MYKEY" /* Password in case of secure AP */
In file '"mqtt_server_app.c", set the MQTT config data
NOTE: For this example, I am using a Mosquitto MQTT Broker running on a Beaglebone Black. The default uses an IBM MQTT Broker.
/* Defining Broker IP address and port Number */ //#define SERVER_ADDRESS "messagesight.demos.ibm.com" //#define SERVER_ADDRESS "m2m.eclipse.org" //#define SERVER_IP_ADDRESS "192.168.178.67" //#define PORT_NUMBER 1883 //#define SECURED_PORT_NUMBER 8883 #define SERVER_ADDRESS "192.168.2.202" #define SERVER_IP_ADDRESS "192.168.2.202" #define PORT_NUMBER 8883 #define SECURED_PORT_NUMBER 8883
CC3220 console output showing MQTT config at board boot-up
============================================ MQTT client server Example Ver: 1.1.1 ============================================ CHIP: 0x30000019 MAC: 2.0.0.0 PHY: 2.2.0.5 NWP: 3.4.0.0 ROM: 0 HOST: 2.0.1.19 MAC address: 98:84:e3:f5:fe:08 ============================================ ************************************************* CC3220 MQTT client server Application ************************************************* Device came up in Station mode [WLAN EVENT] STA Connected to the AP: MYSSID , BSSID: f4:f2:6d:e2:20:98 [NETAPP EVENT] IP acquired by the device Device has connected to MYSSID Device IP Address is 192.168.2.102 Plugin module has been initialized. Version: Client LIB 1.1.0, Common LIB 1.2.0. S: MQTT Server Run invoked 123.... .C: FH-B1 0x10 to net 0, Sent (52 Bytes) [@ 2] C: Rcvd msg Fix-Hdr (Byte1) 0x20 from net 0 [@ 2] C: Cleaning session for net 0 CONNACK: Connection Success C: Msg w/ ID 0x0000, processing status: Good C: FH-B1 0x82 to net 0, Sent (24 Bytes) [@ 2] C: Rcvd msg Fix-Hdr (Byte1) 0x90 from net 0 [@ 2] C: Msg w/ ID 0x0001, processing status: Good Client subscribed on /Broker/To/cc32xx
The IP Address assigned to the CC3220 from the local WiFi can be obtained from the console output listed above which is used to configure the MQTT Client (MSP432 and CC3100 in this example)
Device has connected to MYSSID Device IP Address is 192.168.2.102
The MQTT Client should be configured to use the same WiFI AP as the server to ensure proper connectivity.
The example used here is the 'CC3100BOOT_MQTT -TwitterLED_MSP432PIR' example from the MSP432 SimpleLink SDK
/* * Values for below macros shall be modified per the access-point's (AP) properties * SimpleLink device will connect to following AP when the application is executed */ //#define SSID_NAME "<Your_AP's_SSID>" /* Access point name to connect to. */ #define SSID_NAME "MYSSID" /* Access point name to connect to. */ #define SEC_TYPE SL_SEC_TYPE_WPA_WPA2 /* Security type of the Access piont */ //#define PASSKEY "<Your_AP's_Password>" /* Password in case of secure AP */ #define PASSKEY "MYPASSKEY" /* Password in case of secure AP */ #define PASSKEY_LEN pal_Strlen(PASSKEY) /* Password length in case of secure AP */
Set the MQTT Broker Server for the Client to the CC3220 ipaddress.
#define MQTT_BROKER_SERVER "192.168.2.102" //#define SUBSCRIBE_TOPIC "/test/topic" //#define PUBLISH_TOPIC "/msp/cc3100/demo/fromLP" #define SUBSCRIBE_TOPIC "/cc32xx/ButtonPressEvtSw2" #define PUBLISH_TOPIC "/msp/cc3100/demo/fromL
Compile and run the example on the Client.
The following is an example of the Console output from the client during boot-up
============================================ MQTT client server Example Ver: 1.1.1 ============================================ CHIP: 0x30000019 MAC: 2.0.0.0 PHY: 2.2.0.5 NWP: 3.4.0.0 ROM: 0 HOST: 2.0.1.19 MAC address: 98:84:e3:f5:fe:08 ============================================ ************************************************* CC3220 MQTT client server Application ************************************************* Device came up in Station mode [WLAN EVENT] STA Connected to the AP: MYSSID , BSSID: f4:f2:6d:e2:20:98 [NETAPP EVENT] IP acquired by the device Device has connected to MYSSID Device IP Address is 192.168.2.102 Plugin module has been initialized. Version: Client LIB 1.1.0, Common LIB 1.2.0. S: MQTT Server Run invoked 123.... .C: FH-B1 0x10 to net 0, Sent (52 Bytes) [@ 2] C: Rcvd msg Fix-Hdr (Byte1) 0x20 from net 0 [@ 2] C: Cleaning session for net 0 CONNACK: Connection Success C: Msg w/ ID 0x0000, processing status: Good C: FH-B1 0x82 to net 0, Sent (24 Bytes) [@ 2] C: Rcvd msg Fix-Hdr (Byte1) 0x90 from net 0 [@ 2] C: Msg w/ ID 0x0001, processing status: Good Client subscribed on /Broker/To/cc32xx
As messages arrive, the Client console acknowledges the events.
MQTT Twitter Controlled RGB LED - Version 1.0.0 ******************************************************************************* Device is configured in default state Device started as STATION Connection established w/ AP and IP is acquired Connected to MQTT broker Started MQTT client successfully Subscribed to /cc32xx/ButtonPressEvtSw2 topic Subscribed to 765521EB topic Message arrrived Message arrrived Message arrrived
Start the MQTT Broker
sudo mosquitto -c /etc/mosquitto/mosquitto.conf [sudo] password for joiot: 1503768422: mosquitto version 1.4.12 (build date 2017-05-29 17:29:22+0000) starting 1503768422: Config loaded from /etc/mosquitto/mosquitto.conf. 1503768422: Opening ipv4 listen socket on port 1883. 1503768422: Opening ipv4 listen socket on port 8883. 1503768422: Opening websockets listen socket on port 8083. 1503768471: New connection from 192.168.2.102 on port 8883. 1503768471: New client connected from 192.168.2.102 as 9884e3f5fe08 (c1, k25).
IP: 192.168.2.102 - CC3220 MQTT Server
IP: 192.168.2.202 - BBB Mosquitto Broker IP
Subscribe to MQTT Client topic; This is the Button Press ID topic from the CC3100 SDK
When SW1 on the MSP432 is pressed, the message is sent to the CC3220 MQTT Server and then propagated to the '/msp/cc3100/demo/fromLP' topic
sudo mosquitto_sub -h 192.168.2.102 -p 8883 -t '/msp/cc3100/demo/fromLP' 765521EB
Sending messages to the board ID topic, '765521EB' in this instance, the MSP432 RGB LED can be controlled:
# Green LED on sudo mosquitto_pub -h 192.168.2.102 -p 8883 -t '765521EB' -m '0 255 0’ #Green LED off sudo mosquitto_pub -h 192.168.2.102 -p 8883 -t '765521EB' -m '0 0 0'
The Button Press topic from the CC3220 can be subscribed to using the MQTT Broker IP
sudo mosquitto_sub -h 192.168.2.202 -p 8883 -t '/cc32xx/ButtonPressEvtSw2' Push Button SW2 has been pressed on CC32XX device Push Button SW2 has been pressed on CC32XX device
CC3220 MQTT Client / Sever Example Video
A few months back I had seen a posting from the TI E2E forum as well as their LinkedIn page describing how to control the Ti CC3220 using a DevKit by Arrayent (recently acquired by Prodea Systems) using their IoT Cloud services and their Arrayent Alexa Skill. So, when I was selected to participate in the Element14 CC3220 RoadTest, I thought this would be the perfect opportunity to demonstrate this functionality. To get started, I reached out to Arrayent to request access to their CC3220 DevKit and to my surprise they agreed and sent me instructions on how to configure the CC3220 with their DevKit and use the Arrayent Cloud services to run the DevKit demos.
Typically Arrayent provides the CC3220 pre configured with its own ID on QR code that can be scanned from the Android app. However, I already had the CC3220 through the RoadTest so all I needed were the instructions to get the binary loaded and configure the board.
Arrayent provides very detailed instructions for getting the CC3220 loaded with the appropriate binary and to configure the environment, so outside of a few miss steps on my part (as well as some differences with the dev-kit) the install was fairly painless.
These can be obtained at the following:
Arrayent TI CC3220 Dev kitsite
http://developer.arrayent.com/dev-kits/ti-dev-kit/
NOTE: In this RoadTest, I will cover just some basics of the Arrayent CC3220 DevKit configuration. I'll create another post with more details at a later time.
Once the DevKit had been downloaded, there are two options to load the DevKit code on the CC3220:
1. Import the DevKit project into TI Code Composer
2. Load from a pre compiled binary via UniFlash
Due to time constraints, I opted for option 2.
Once the Binay is loaded on the CC3220 and the board has been power cycled, the DevKit provides a means to interact with the CC3220 via a Term Console which is used to configure the board to connect to the local WiFi as well as the Arrayent Cloud.
If the CC3220 has not been configure to attach to a WiFi network, the following will appear in the console output:
================================================= ERROR! device credentials have not been configured. Use commands like these using the credentials received from Arrayent demo&cset@000:dev_name,XXXXXXXX# demo&cset@001:dev_pass,XX# demo&cset@002:dev_aes_key,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX# demo&cset@003:cloud_url,XXXXXXXXX# =================================================
The board initially comes up in “Soft AP” mode where a it provides a SSID to connect PC to inorder to configure the board to the local Router.
The SSID will appear as “DevkitDemoXXXX”.
Once connected to the CC3220, the local WiFi info can be entered into the “Arrayent Device Configuration” window.
After entering the WiFi credentials and selecting “Connect” the window will present a message stating the board is attempting to connect to the web server and access point.
At this point I found it was best to power cycle the board.
After this step, the console output will no longer show the device credentials error and will be blank. Pressing enter in the console screen will bring up a “$” prompt.
From here there are a series of command line options that have to be entered to complete the config of the board. The console does not echo back these commands as they are typed and you can not back space if an error in entering the data so care must be taken to enter the data properly. (I also was not successful is trying to cut and paste the data so it was all manual entries).
I'll leave this for the Arrayent docs to show, but this is what the commands look like.
$demo&cset@000:dev_name, ARR00000031# demo&rp@000:status,0,0#
The 'cget' command can be used to retrieve the values from the board:
$demo&cget@000:dev_name demo&rp@000:dev_name,ARR00000031#
Once the board has been configured with the appropriate details to access the Arrayent cloud, provides a mobile app for IoS and Android to connect to the device and to set up a user account on the Arrayent cloud. I was provided a APK file to install on my Andoid Tablet.
The app can be used to Enable/Disable the two used LEDs on the board as well as display the SW1(SW3 on the board) status. Also, according to the app, a trigger can be sent to send an email or SMS message at a certain button press count but that did not seem to work.
Once the user account is set-up, the Arrayent Utility site can be accessed to control the board from the Arrayent cloud service as well as to configure the devices on the board for the Alexa Skill.
The “Monitor and Control” tab at the top will bring up a page that lists all of the options for setting up and controlling the CC3220. Here is where the Alexa Skills devices are configured.
After all this is complete, the Arrayent DevKit Alexa Skill will have to be added to the Amazon Echo account.
If all goes well, you should be able to ask Alexa to ask Arrayent to access the Alexa enabled devices on the CC3220. This demonstrates the Arrayent EcoAdaptor™ for Amazon Alexa feature.
These were configured for the demo:
counter_name = living room
Led1_name = kitchen
Led2_name = bedroom
thermostat_name = thermostat
Example:
“Alexa, ask Arrayent to list my devices”
Alexa: You have the following devices, kitchen, thermostat, bedroom, living room.
To turn on the kichen light (LED1)
“Alexa, ask Arrayent to turn on the light in the kitchen”
There are many more options that could be covered, but I just wanted to give a quick (well sort of) overview of the Arrayent CC3220 DevKit.
I want to thank Elena Fasolo and Bob Dahlberg from Arrayent for letting me work with the DevKIt and for their assistance with setting this up.
In this RoadTest of the CC3220, I touched only a sampling of the capabilities of the CC3220 LaunchPad from TI. The CC3220 Controller is a very powerful tool that can be used is a wide array of IoT applications. And considering a company such as Arrayent provides a DevKit to enable and test this functionality, it is apparent the CC3220 will be seen a number of Smart Devices in homes around the world. For my personal applications, I can see adding the CC3220 as a gateway device between remote nodes and the cloud for data collection and analysis.
I want to thank TI and Element14 for the opportunity to participate in the CC3220 RoadTest.
Top Comments
Very good road test report.
You did a very good job of explaining your tests and demonstrating the capabilities.
Well done.
DAB