5.3.1. AWS Demo for KSDK¶
This demo demonstrates connection to AWS IoT Console using pre-provisioned device credentials and publish/subscribe procedure using MQTT.
5.3.1.1. Prerequisites¶
Active AWS account
MCUXpresso installed (for running aws demo on K64F)
Any Serial communicator
Flash VCOM binary on the device. VCOM binary can found under
<PROJECT>binariesMCU
folder.Refer to CLI Tool for ssscli tool setup
Build Plug & Trust middleware stack. (Refer Building / Compiling)
5.3.1.2. Using WiFi with LPC55S¶
WiFi shield CMWC1ZZABR-107-EVB by muRata is supported with LPCS55S. Mount the WiFi shield on to the mikroBUS stackable headers.
5.3.1.3. Creating a device on AWS account¶
Refer - https://docs.aws.amazon.com/iot/latest/developerguide/iot-gs-first-thing.html
5.3.1.4. Creating and updating device keys and certificates to SE¶
Complete Section 9.3 Steps needed before running ssscli tool
Check the vcom port number
To create certificates on windows and provision, go to
simw-top/pycli
directory and call:call venv\Scripts\activate.bat cd Provisioning python GenerateAWSCredentials.py <COM_PORT> python ResetAndUpdate_AWS.py <COM_PORT>
Note
Provisioning of the keys is done with default policies. Refer - Section 9.9 to change the scripts to add required policies.
Certificates and Keys are generated at
simw-top/pycli/Provisioning/aws
5.3.1.5. Building the Demo¶
Open cmake project found under
<SIMW-TOP>projects
in MCUXPRESSO IDE- Update cmake options::
RTOS=FreeRTOS
mbedTLS_ALT=SSS
- Update the build target in make file
Project:
cloud_aws
5.3.1.6. Running the Demo¶
Open a serial terminal on PC for OpenSDA serial device with these settings:
- 115200 baud rate - 8 data bits - No parity - One stop bit - No flow control - change Setup->Terminal->New-line->Receive->AUTO
Connect the boards’s RJ45 to network with Internet access (IP address to the board is assigned by the DHCP server). Make sure the connection on port 8883 is not blocked.
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
The BLUE LED is turned ON during boot
Persistent RED LED ON indicates error
- First time during connection, the device certificate needs to be
Activated
Attached with a policy that allows usage of this certificate
All lights off along with the following message indicates readiness to subscribe messages from AWS:
Subscribing... -->sleep -->sleep Publish done
In AWS IOT shadow, the following indicates the state of the LED:
{ "desired": { "COLOR": "RED", "MODE": "OFF" } }
MODE can be ON or OFF and COLOR can be RED, GREEN or BLUE