Interacting with the Cloud#
The Sidewalk solution allows an endpoint to natively exchange data with the AWS cloud. Before trying to send and receive message, you should verify that your endpoint achieved time sync. You should see the following line in your device logs.
[00482267] <I> registation status: 0, time sync: 0, link: 0
Send Data#
First, the endpoint sends data to the AWS cloud platform. An AWS Rule reroutes the data to an MQTT topic.
Go to the MQTT test client in AWS.
Type “#" in the Topic filter field.
Click Subscribe.
Press the main board's button (PB1 for KG100S and PB0 for all other boards). It triggers the Sidewalk endpoint to send a counter value to the AWS IoT Core. For more information on button and CLI action, see the readme of the Amazon Sidewalk - SoC Hello Neighbor sample application.
An MQTT message appears in the AWS MQTT console.
The application logs (Terminal 0) are as follows:
[01736985] <I> counter update event
[01736985] <I> sending counter update, counter: 0
[01737009] <I> message queued
[01737009] <I> link type: 7fffffff, msg id: 1, msg size: 10, msg type: 2, ack requested: 1, ttl: 120, max retry: 5, additional attr: 0
[01737011] <I> 30 00 00 00 00 00 00 00
[01737012] <I> 00 00
[01737012] <I> ASCII decoded message: 0
[01745316] <I> uplink message sent
[01745317] <I> link type: 2, msg id: 1, msg type: 2
[01749138] <I> downlink message received
[01749139] <I> link type: 2, msg id: 1, msg size: 0, msg type: 3, ack requested: 0, is ack: 1, is duplicate: 0, rssi: -26, snr: 64
The message is first queued with parameters. The message is sent when the line uplink message sent is displayed and, with default parameters, an acknowledge message is send back by the cloud as show by downlink message received and the message being of size 0 (msg size: 0).
Receive Data#
The Hello Neighbor applications don't support the MQTT test client publish feature to send message from the cloud to the endpoint. For this step, you will need AWS CLI configured and associated with your IAM user. Your user should at least have the following policies: AdministratorAccess and AWSIoTWirelessDataAccess. If your user is Administrator, you don't need to do anything. You can check your users in the IAM Identity Center.
You are now ready to receive data on your Sidewalk endpoint. Run the following command in a terminal:
aws iotwireless send-data-to-wireless-device --id=[Wireless-Device-ID] --transmit-mode 0 --payload-data="SGVsbG8gICBTaWRld2FsayE=" --wireless-metadata "Sidewalk={Seq=1}"
Where:
Seq=x, x should be unique any time you run the command.
--id should be the “Device ID” of the device in the AWS portal IoT Core -> Wireless Connectivity -> Devices -> Sidewalk.
--payload-data is the message to send in binary format (in this case, “Hello Sidewalk!”).
You should see “Hello Sidewalk!” on the EFR32 log console.
The application logs (Terminal 0) are as follows:
[01957048] <I> downlink message received
[01957049] <I> link type: 2, msg id: 5, msg size: 17, msg type: 2, ack requested: 0, is ack: 0, is duplicate: 0, rssi: -25, snr: 65
[01957051] <I> 48 65 6C 6C 6F 20 20 20
[01957052] <I> 53 69 64 65 77 61 6C 6B
[01957052] <I> 21
[01957052] <I> ASCII decoded message: Hello Sidewalk!