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.4. Creating and updating device keys and certificates to SE

  1. Complete Section 9.3 Steps needed before running ssscli tool

  2. Check the vcom port number

  3. 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.

  4. Certificates and Keys are generated at simw-top/pycli/Provisioning/aws

5.3.1.5. Building the Demo

  1. Open cmake project found under <SIMW-TOP>projects in MCUXPRESSO IDE

  2. Update cmake options::
    • RTOS=FreeRTOS

    • mbedTLS_ALT=SSS

  3. Update the build target in make file
    • Project:cloud_aws

5.3.1.6. Running the Demo

  1. 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
    
  2. 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.

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

  5. The BLUE LED is turned ON during boot

  6. Persistent RED LED ON indicates error

  7. First time during connection, the device certificate needs to be
    • Activated

    • Attached with a policy that allows usage of this certificate

  8. 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