Set up AWS
After some struggling, I finally got the AWS IoT account setup. However, I have problem to connect the PSoC 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WIFI-BT) to the cloud.
I found Cypress' start guide Getting Started with Amazon FreeRTOS and PSoC62 + 43xxx wasn't very helpful for setting up the AWS IoT. I was kind of lost between the start guide and AWS online help. To help my readers to set up AWS IoT, I listed the following steps with links:
1. create and activate a new Amazon Web Services account (https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/ )
2. Setting Up Your AWS Account and Permissions (https://docs.aws.amazon.com/freertos/latest/userguide/freertos-account-and-permissions.html )
3. Registering Your MCU Board with AWS IoT (https://docs.aws.amazon.com/freertos/latest/userguide/get-started-freertos-thing.html )
4. Download demo from Cypress' Github repository (https://github.com/cypresssemiconductorco/amazon-freertos )
5. Configuring the FreeRTOS Demos (https://docs.aws.amazon.com/freertos/latest/userguide/freertos-configure.html )
Problem to Connect Kit to Cloud
I followed the start guide Getting Started with Amazon FreeRTOS and PSoC62 + 43xxx and downloaded the demo from Cypress' Github repository, then built the project and programed the kit. Unfortunately, my kit failed to establish MQTT connection as shown in the screenshot below.
Here's the text version of the log shown above in the screenshot.
WLAN MAC Address : A0:C9:A0:46:BE:46
WLAN Firmware : wl0: Sep 5 2019 23:24:33 version 7.45.98.92 (r722362 CY) FWID 01-f7128517
WLAN CLM : API: 12.2 Data: 9.10.39 Compiler: 1.29.4 ClmImport: 1.36.3 Creation: 2019-09-05 23:10:00
WHD VERSION : v1.70.0 : v1.70.0 : GCC 7.2 : 2019-12-02 04:14:53 -0600
1 3848 [Tmr Svc] Wi-Fi Connected to AP. Creating tasks which use network...
2 3848 [Tmr Svc] IP Address acquired 192.168.1.105
3 5586 [Tmr Svc] Write certificate...
4 6176 [iot_threa] [INFO ][DEMO][lu] ---------STARTING DEMO---------
5 6178 [iot_threa] [INFO ][INIT][lu] SDK successfully initialized.
6 9195 [iot_threa] [INFO ][DEMO][lu] Successfully initialized the demo. Network type for the demo:
7 9195 [iot_threa] [INFO ][MQTT][lu] MQTT library successfully initialized.
8 9195 [iot_threa] [INFO ][DEMO][lu] MQTT demo client identifier is CY8CKIT-062-WIFI-BT (length 19).
9 13173 [iot_threa] [INFO ][MQTT][lu] Establishing new MQTT connection.
10 13176 [iot_threa] [INFO ][MQTT][lu] Anonymous metrics (SDK language, SDK version) will be provid
11 13178 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012798, CONNECT operation 0x80128b0) Wai.
12 18178 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012798, CONNECT operation 0x80128b0) Wai
13 18178 [iot_threa] [ERROR][MQTT][lu] Failed to establish new MQTT connection, error TIMEOUT.
14 18178 [iot_threa] [INFO ][MQTT][lu] Network connection closed on error.
15 18478 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012798) Network connection destroyed.
16 18478 [iot_threa] [ERROR][DEMO][lu] MQTT CONNECT returned error TIMEOUT.
17 18478 [iot_threa] [INFO ][MQTT][lu] MQTT library cleanup done.
18 18478 [iot_threa] [ERROR][DEMO][lu] Error running demo.
19 18478 [iot_threa] [INFO ][INIT][lu] SDK cleanup done.
20 18478 [iot_threa] [INFO ][DEMO][lu] -------DEMO FINISHED-------
I posted my question on Cypress' forum (https://community.cypress.com/thread/53437 ) and hope someone can help me solve the problem soon. If you know the solution, please post in the commenting area. I really appreciate your help.
Update: I found the issue after reading saicheong's Mbed connect to AWS iOT, OS, driver, security .. #2. My problem was, in the policy file, I replaced ":<region>:" with ":<us-east-2>:" which should be "us-east-2" (i.e., remove <>). After updating my policy, the kit is successfully connected to the cloud. The serial console output is:
WLAN MAC Address : A0:C9:A0:46:BE:46
WLAN Firmware : wl0: Sep 5 2019 23:24:33 version 7.45.98.92 (r722362 CY) FWID 01-f7128517
WLAN CLM : API: 12.2 Data: 9.10.39 Compiler: 1.29.4 ClmImport: 1.36.3 Creation: 2019-09-05 23:10:00
WHD VERSION : v1.70.0 : v1.70.0 : GCC 7.2 : 2019-12-02 04:14:53 -0600
1 3828 [Tmr Svc] Wi-Fi Connected to AP. Creating tasks which use network...
2 3828 [Tmr Svc] IP Address acquired 192.168.1.105
3 5581 [Tmr Svc] Write certificate...
4 6172 [iot_threa] [INFO ][DEMO][lu] ---------STARTING DEMO---------.
5 6174 [iot_threa] [INFO ][INIT][lu] SDK successfully initialized.
6 10547 [iot_threa] [INFO ][DEMO][lu] Successfully initialized the demo. Network type for the demo:
7 10547 [iot_threa] [INFO ][MQTT][lu] MQTT library successfully initialized.
8 10547 [iot_threa] [INFO ][DEMO][lu] MQTT demo client identifier is CY8CKIT-062-WIFI-BT (length 19..
9 19143 [iot_threa] [INFO ][MQTT][lu] Establishing new MQTT connection.
10 19146 [iot_threa] [INFO ][MQTT][lu] Anonymous metrics (SDK language, SDK version) will be provid
11 19148 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860, CONNECT operation 0x800c258) Wai
12 19221 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860, CONNECT operation 0x800c258) Wai
13 19221 [iot_threa] [INFO ][MQTT][lu] New MQTT connection 0x800d8c4 established.
14 19224 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) SUBSCRIBE operation scheduled.
15 19224 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860, SUBSCRIBE operation 0x800c258) W
16 19292 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860, SUBSCRIBE operation 0x800c258) W
17 19292 [iot_threa] [INFO ][DEMO][lu] All demo topic filter subscriptions accepted.
18 19292 [iot_threa] [INFO ][DEMO][lu] Publishing messages 0 to 1.
19 19294 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
20 19296 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
21 19296 [iot_threa] [INFO ][DEMO][lu] Waiting for 2 publishes to be received.
22 19386 [iot_threa] [INFO ][DEMO][lu] MQTT PUBLISH 0 successfully sent.
23 19414 [iot_threa] [INFO ][DEMO][lu] Incoming PUBLISH received:Subscription topic filter: iotde
24 19414 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
25 19415 [iot_threa] [INFO ][DEMO][lu] Acknowledgment message for PUBLISH 0 will be sent.
26 19470 [iot_threa] [INFO ][DEMO][lu] MQTT PUBLISH 1 successfully sent.
27 19501 [iot_threa] [INFO ][DEMO][lu] Incoming PUBLISH received:Subscription topic filter: iotde
28 19501 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
29 19501 [iot_threa] [INFO ][DEMO][lu] Acknowledgment message for PUBLISH 1 will be sent.
30 19503 [iot_threa] [INFO ][DEMO][lu] 2 publishes received.
31 19503 [iot_threa] [INFO ][DEMO][lu] Publishing messages 2 to 3.
32 19503 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
33 19505 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
34 19505 [iot_threa] [INFO ][DEMO][lu] Waiting for 2 publishes to be received.
35 19696 [iot_threa] [INFO ][DEMO][lu] MQTT PUBLISH 2 successfully sent.
36 19700 [iot_threa] [INFO ][DEMO][lu] MQTT PUBLISH 3 successfully sent.
37 19775 [iot_threa] [INFO ][DEMO][lu] Incoming PUBLISH received:Subscription topic filter: iotde
38 19775 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
39 19775 [iot_threa] [INFO ][DEMO][lu] Acknowledgment message for PUBLISH 2 will be sent.
40 19777 [iot_threa] [INFO ][DEMO][lu] Incoming PUBLISH received:Subscription topic filter: iotde
41 19777 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
42 19777 [iot_threa] [INFO ][DEMO][lu] Acknowledgment message for PUBLISH 3 will be sent.
43 19779 [iot_threa] [INFO ][DEMO][lu] 2 publishes received.
44 19779 [iot_threa] [INFO ][DEMO][lu] Publishing messages 4 to 5.
45 19779 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
46 19781 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
47 19781 [iot_threa] [INFO ][DEMO][lu] Waiting for 2 publishes to be received.
48 19945 [iot_threa] [INFO ][DEMO][lu] MQTT PUBLISH 4 successfully sent.
49 19945 [iot_threa] [INFO ][DEMO][lu] MQTT PUBLISH 5 successfully sent.
50 19973 [iot_threa] [INFO ][DEMO][lu] Incoming PUBLISH received:Subscription topic filter: iotde
51 19973 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
52 19973 [iot_threa] [INFO ][DEMO][lu] Acknowledgment message for PUBLISH 4 will be sent.
53 20043 [iot_threa] [INFO ][DEMO][lu] Incoming PUBLISH received:Subscription topic filter: iotde
54 20043 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
55 20043 [iot_threa] [INFO ][DEMO][lu] Acknowledgment message for PUBLISH 5 will be sent.
56 20044 [iot_threa] [INFO ][DEMO][lu] 2 publishes received.
57 20044 [iot_threa] [INFO ][DEMO][lu] Publishing messages 6 to 7.
58 20044 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
59 20046 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
60 20046 [iot_threa] [INFO ][DEMO][lu] Waiting for 2 publishes to be received.
61 20140 [iot_threa] [INFO ][DEMO][lu] MQTT PUBLISH 6 successfully sent.
62 20140 [iot_threa] [INFO ][DEMO][lu] MQTT PUBLISH 7 successfully sent.
63 20218 [iot_threa] [INFO ][DEMO][lu] Incoming PUBLISH received:Subscription topic filter: iotde
64 20218 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
65 20218 [iot_threa] [INFO ][DEMO][lu] Acknowledgment message for PUBLISH 7 will be sent.
66 20219 [iot_threa] [INFO ][DEMO][lu] Incoming PUBLISH received:Subscription topic filter: iotde
67 20220 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
68 20220 [iot_threa] [INFO ][DEMO][lu] Acknowledgment message for PUBLISH 6 will be sent.
69 20221 [iot_threa] [INFO ][DEMO][lu] 2 publishes received.
70 20221 [iot_threa] [INFO ][DEMO][lu] Publishing messages 8 to 9.
71 20221 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
72 20223 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
73 20223 [iot_threa] [INFO ][DEMO][lu] Waiting for 2 publishes to be received.
74 20365 [iot_threa] [INFO ][DEMO][lu] MQTT PUBLISH 8 successfully sent.
75 20372 [iot_threa] [INFO ][DEMO][lu] MQTT PUBLISH 9 successfully sent.
76 20381 [iot_threa] [INFO ][DEMO][lu] Incoming PUBLISH received:Subscription topic filter: iotde
77 20381 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
78 20381 [iot_threa] [INFO ][DEMO][lu] Acknowledgment message for PUBLISH 8 will be sent.
79 20384 [iot_threa] [INFO ][DEMO][lu] Incoming PUBLISH received:Subscription topic filter: iotde
80 20384 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
81 20384 [iot_threa] [INFO ][DEMO][lu] Acknowledgment message for PUBLISH 9 will be sent.
82 20386 [iot_threa] [INFO ][DEMO][lu] 2 publishes received.
83 20386 [iot_threa] [INFO ][DEMO][lu] Publishing messages 10 to 11.
84 20386 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
85 20388 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
86 20388 [iot_threa] [INFO ][DEMO][lu] Waiting for 2 publishes to be received.
87 20583 [iot_threa] [INFO ][DEMO][lu] MQTT PUBLISH 11 successfully sent.
88 20583 [iot_threa] [INFO ][DEMO][lu] MQTT PUBLISH 10 successfully sent.
89 20614 [iot_threa] [INFO ][DEMO][lu] Incoming PUBLISH received:Subscription topic filter: iotde
90 20614 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
91 20614 [iot_threa] [INFO ][DEMO][lu] Acknowledgment message for PUBLISH 10 will be sent.
92 20623 [iot_threa] [INFO ][DEMO][lu] Incoming PUBLISH received:Subscription topic filter: iotde
93 20623 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
94 20623 [iot_threa] [INFO ][DEMO][lu] Acknowledgment message for PUBLISH 11 will be sent.
95 20623 [iot_threa] [INFO ][DEMO][lu] 2 publishes received.
96 20625 [iot_threa] [INFO ][DEMO][lu] Publishing messages 12 to 13.
97 20626 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
98 20627 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) MQTT PUBLISH operation queued.
99 20627 [iot_threa] [INFO ][DEMO][lu] Waiting for 2 publishes to be received.
100 20885 [iot_threa] [INFO ][DEMO][lu] MQTT PUBLISH 12 successfully sent.
101 20889 [iot_threa] [INFO ][DEMO][lu] MQTT PUBLISH 13 successfully sent.
102 20911 [iot_threa] [INFO ][DEMO][lu] Incoming PUBLISH received:
104 20911 [iot_threa] [INFO ][DEMO][lu] Acknowledgment message for PUBLISH 12 will be sent.012860) MQTT PUBLISH operation queued.
105 20917 [iot_threa] [INFO ][DEMO][lu] Incoming PUBLISH received:
107 20917 [iot_threa] [INFO ][DEMO][lu] Acknowledgment message for PUBLISH 13 will be sent.012860) MQTT PUBLISH operation queued.
108 20917 [iot_threa] [INFO ][DEMO][lu] 2 publishes received.
109 20919 [iot_threa] [INFO ][DEMO][lu] Publishing messages 14 to 15.
112 20921 [iot_threa] [INFO ][DEMO][lu] Waiting for 2 publishes to be received.H operation queued.
113 21134 [iot_threa] [INFO ][DEMO][lu] MQTT PUBLISH 15 successfully sent.
114 21135 [iot_threa] [INFO ][DEMO][lu] MQTT PUBLISH 14 successfully sent.
115 21157 [iot_threa] [INFO ][DEMO][lu] Incoming PUBLISH received:
117 21157 [iot_threa] [INFO ][DEMO][lu] Acknowledgment message for PUBLISH 15 will be sent.012860) MQTT PUBLISH operation queued.
118 21159 [iot_threa] [INFO ][DEMO][lu] Incoming PUBLISH received:
120 21159 [iot_threa] [INFO ][DEMO][lu] Acknowledgment message for PUBLISH 14 will be sent.012860) MQTT PUBLISH operation queued.
121 21161 [iot_threa] [INFO ][DEMO][lu] 2 publishes received.
122 21161 [iot_threa] [INFO ][DEMO][lu] Publishing messages 16 to 17.
125 21163 [iot_threa] [INFO ][DEMO][lu] Waiting for 2 publishes to be received.H operation queued..
126 21465 [iot_threa] [INFO ][DEMO][lu] MQTT PUBLISH 17 successfully sent.
127 21468 [iot_threa] [INFO ][DEMO][lu] MQTT PUBLISH 16 successfully sent.
128 21493 [iot_threa] [INFO ][DEMO][lu] Incoming PUBLISH received:
130 21493 [iot_threa] [INFO ][DEMO][lu] Acknowledgment message for PUBLISH 17 will be sent.012860) MQTT PUBLISH operation queued.
131 21509 [iot_threa] [INFO ][DEMO][lu] Incoming PUBLISH received:
133 21510 [iot_threa] [INFO ][DEMO][lu] Acknowledgment message for PUBLISH 16 will be sent.012860) MQTT PUBLISH operation queued.
134 21511 [iot_threa] [INFO ][DEMO][lu] 2 publishes received.
135 21511 [iot_threa] [INFO ][DEMO][lu] Publishing messages 18 to 19.
138 21513 [iot_threa] [INFO ][DEMO][lu] Waiting for 2 publishes to be received.H operation queued.
139 21675 [iot_threa] [INFO ][DEMO][lu] MQTT PUBLISH 19 successfully sent.
140 21693 [iot_threa] [INFO ][DEMO][lu] MQTT PUBLISH 18 successfully sent.
141 21701 [iot_threa] [INFO ][DEMO][lu] Incoming PUBLISH received:
143 21701 [iot_threa] [INFO ][DEMO][lu] Acknowledgment message for PUBLISH 19 will be sent.012860) MQTT PUBLISH operation queued.
144 21723 [iot_threa] [INFO ][DEMO][lu] Incoming PUBLISH received:
146 21723 [iot_threa] [INFO ][DEMO][lu] Acknowledgment message for PUBLISH 18 will be sent.012860) MQTT PUBLISH operation queued.
147 21724 [iot_threa] [INFO ][DEMO][lu] 2 publishes received.
148 21724 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) UNSUBSCRIBE operation scheduled
149 21724 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860, UNSUBSCRIBE operation 0x8012978
150 21830 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860, UNSUBSCRIBE operation 0x8012978
151 21830 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) Disconnecting connection.
152 21832 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860, DISCONNECT operation 0x800c258)
153 21832 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860, DISCONNECT operation 0x800c258)
154 21832 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) Connection disconnected.
155 21836 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) Network connection closed.
156 22136 [iot_threa] [INFO ][MQTT][lu] (MQTT connection 0x8012860) Network connection destroyed.
157 22136 [iot_threa] [INFO ][MQTT][lu] MQTT library cleanup done.
158 22136 [iot_threa] [INFO ][DEMO][lu] Demo completed successfully.
159 22137 [iot_threa] [INFO ][INIT][lu] SDK cleanup done.
160 22137 [iot_threa] [INFO ][DEMO][lu] -------DEMO FINISHED-------
Update: I have to switch my region from us-east-2 to us-east-1 because us-east-2 doesn't support sending SMS and/or phone app notification push operations. I think in US, only two regions support both of them: us-east-1 and us-west-2.

Top Comments