Getting Started with PIC32MZEF - MQTT message issue

Janeu wrote on October 22, 2019:

Hi,

I have similar problem as https://forums.aws.amazon.com/thread.jspa?threadID=277259&tstart=125.

I’m using the Quick Connect way, ie without any policy and so.

I’m trying to subscribe via iotdemo/# in the MQTT client Test page in AWS, but nothing happen.
What should happen?

My connected terminal shows:
Bootloader version 00.09.00
[prvBOOT_Init] Watchdog timer initialized.
[prvBOOT_Init] Crypto initialized.

[prvValidateImage] Validating image at Bank : 0
[prvValidateImage] No application image or magic code present at: 0xbd000000
[prvBOOT_ValidateImages] Validation failed for image at 0xbd000000

[prvValidateImage] Validating image at Bank : 1
[prvValidateImage] No application image or magic code present at: 0xbd100000
[prvBOOT_ValidateImages] Validation failed for image at 0xbd100000

[prvBOOT_ValidateImages] Booting default image.

                                            1 3199 [IP-task] vDHCPProcess: o                                                                                                                                                             ffer c0a8008cip
           2 3200 [IP-task] Write certificate...

3 3250 [IP-task] Device credential provisioning succeeded.
4 3250 [IP-task]

IP Address: 192.168.0.140
5 3250 [IP-task] Subnet Mask: 255.255.255.0
6 3250 [IP-task] Gateway Address: 192.168.0.1
7 3250 [IP-task] DNS Server Address: 192.168.0.1

8 3253 [iot_thread] [INFO ][INIT][3253] SDK successfully initialized.
9 3253 [iot_thread] [INFO ][DEMO][3253] Successfully initialized the demo. Netwo rk type for the demo: 4
10 3253 [iot_thread] [INFO ][MQTT][3253] MQTT library successfully initialized.
11 3253 [iot_thread] [INFO ][DEMO][3253] MQTT demo client identifier is PIC32_1 (length 7).
12 5961 [iot_thread] [INFO ][MQTT][5961] Establishing new MQTT connection.
13 5962 [iot_thread] [INFO ][MQTT][5962] Anonymous metrics (SDK language, SDK ve rsion) will be provided to AWS IoT. Recompile w14 5962 [iot_thread] [INFO ][MQTT ][5962] (MQTT connection 0x8000d8f0, CONNECT operation 0x8000da78) Waiting for o peration compl15 6193 [iot_thread] [INFO ][MQTT][6193] (MQTT connection 0x8000d8 f0, CONNECT operation 0x8000da78) Wait complete with result S16 6194 [iot_thread ] [INFO ][MQTT][6194] New MQTT connection 0x80011cf8 established.
17 6194 [iot_thread] [INFO ][MQTT][6194] (MQTT connection 0x8000d8f0) SUBSCRIBE operation scheduled.
18 6194 [iot_thread] [INFO ][MQTT][6194] (MQTT connection 0x8000d8f0, SUBSCRIBE operation 0x8000da78) Waiting for operation com19 6484 [iot_thread] [INFO ][MQTT ][6484] (MQTT connection 0x8000d8f0, SUBSCRIBE operation 0x8000da78) Wait comple te with result20 6484 [iot_thread] [INFO ][DEMO][6484] All demo topic filter sub scriptions accepted.
21 6484 [iot_thread] [INFO ][DEMO][6484] Publishing messages 0 to 1.
22 6484 [iot_thread] [INFO ][MQTT][6484] (MQTT connection 0x8000d8f0) MQTT PUBLI SH operation queued.
23 6486 [iot_thread] [INFO ][MQTT][6486] (MQTT connection 0x8000d8f0) MQTT PUBLI SH operation queued.
24 6486 [iot_thread] [INFO ][DEMO][6486] Waiting for 2 publishes to be received.
25 6682 [iot_thread] [INFO ][DEMO][6682] MQTT PUBLISH 0 successfully sent.
26 6708 [iot_thread] [INFO ][DEMO][6708] Incoming PUBLISH received:
Subscription topic filter: iotdemo/topic/1
Publish topic 27 6708 [iot_thread] [INFO ][MQTT][6708] (MQTT connection 0x8000d8 f0) MQTT PUBLISH operation queued.
28 6708 [iot_thread] [INFO ][DEMO][6708] Acknowledgment message for PUBLISH 0 wi ll be sent.
29 6872 [iot_thread] [INFO ][DEMO][6872] MQTT PUBLISH 1 successfully sent.
30 6900 [iot_thread] [INFO ][DEMO][6900] Incoming PUBLISH received:
Subscription topic filter: iotdemo/topic/2
Publish topic 31 6900 [iot_thread] [INFO ][MQTT][6900] (MQTT connection 0x8000d8 f0) MQTT PUBLISH operation queued.
32 6901 [iot_thread] [INFO ][DEMO][6900] Acknowledgment message for PUBLISH 1 wi ll be sent.
33 6902 [iot_thread] [INFO ][DEMO][6902] 2 publishes received.
34 6902 [iot_thread] [INFO ][DEMO][6902] Publishing messages 2 to 3.
35 6902 [iot_thread] [INFO ][MQTT][6902] (MQTT connection 0x8000d8f0) MQTT PUBLI SH operation queued.
36 6903 [iot_thread] [INFO ][MQTT][6903] (MQTT connection 0x8000d8f0) MQTT PUBLI SH operation queued.
37 6903 [iot_thread] [INFO ][DEMO][6903] Waiting for 2 publishes to be received.
38 7264 [iot_thread] [INFO ][DEMO][7264] MQTT PUBLISH 3 successfully sent.
39 7266 [iot_thread] [INFO ][DEMO][7266] MQTT PUBLISH 2 successfully sent.
40 7289 [iot_thread] [INFO ][DEMO][7289] Incoming PUBLISH received:
Subscription topic filter: iotdemo/topic/4
Publish topic 41 7289 [iot_thread] [INFO ][MQTT][7289] (MQTT connection 0x8000d8 f0) MQTT PUBLISH operation queued.
42 7289 [iot_thread] [INFO ][DEMO][7289] Acknowledgment message for PUBLISH 3 wi ll be sent.
43 7292 [iot_thread] [INFO ][DEMO][7292] Incoming PUBLISH received:
Subscription topic filter: iotdemo/topic/3
Publish topic 44 7292 [iot_thread] [INFO ][MQTT][7292] (MQTT connection 0x8000d8 f0) MQTT PUBLISH operation queued.
45 7292 [iot_thread] [INFO ][DEMO][7292] Acknowledgment message for PUBLISH 2 wi ll be sent.
46 7292 [iot_thread] [INFO ][DEMO][7292] 2 publishes received.
47 7292 [iot_thread] [INFO ][DEMO][7292] Publishing messages 4 to 5.
48 7294 [iot_thread] [INFO ][MQTT][7294] (MQTT connection 0x8000d8f0) MQTT PUBLI SH operation queued.
49 7295 [iot_thread] [INFO ][MQTT][7295] (MQTT connection 0x8000d8f0) MQTT PUBLI SH operation queued.
50 7295 [iot_thread] [INFO ][DEMO][7295] Waiting for 2 publishes to be received.
51 7717 [iot_thread] [INFO ][DEMO][7717] MQTT PUBLISH 5 successfully sent.
52 7743 [iot_thread] [INFO ][DEMO][7743] Incoming PUBLISH received:
Subscription topic filter: iotdemo/topic/2
Publish topic 53 7743 [iot_thread] [INFO ][MQTT][7743] (MQTT connection 0x8000d8 f0) MQTT PUBLISH operation queued.
54 7743 [iot_thread] [INFO ][DEMO][7743] Acknowledgment message for PUBLISH 5 wi ll be sent.
55 7779 [iot_thread] [INFO ][DEMO][7779] MQTT PUBLISH 4 successfully sent.
56 7805 [iot_thread] [INFO ][DEMO][7805] Incoming PUBLISH received:
Subscription topic filter: iotdemo/topic/1
Publish topic 57 7805 [iot_thread] [INFO ][MQTT][7805] (MQTT connection 0x8000d8 f0) MQTT PUBLISH operation queued.
58 7805 [iot_thread] [INFO ][DEMO][7805] Acknowledgment message for PUBLISH 4 wi ll be sent.
59 7806 [iot_thread] [INFO ][DEMO][7806] 2 publishes received.
60 7806 [iot_thread] [INFO ][DEMO][7806] Publishing messages 6 to 7.
61 7806 [iot_thread] [INFO ][MQTT][7806] (MQTT connection 0x8000d8f0) MQTT PUBLI SH operation queued.
62 7807 [iot_thread] [INFO ][MQTT][7807] (MQTT connection 0x8000d8f0) MQTT PUBLI SH operation queued.
63 7807 [iot_thread] [INFO ][DEMO][7807] Waiting for 2 publishes to be received.
64 8165 [iot_thread] [INFO ][DEMO][8165] MQTT PUBLISH 7 successfully sent.
65 8167 [iot_thread] [INFO ][DEMO][8167] MQTT PUBLISH 6 successfully sent.
66 8192 [iot_thread] [INFO ][DEMO][8192] Incoming PUBLISH received:
Subscription topic filter: iotdemo/topic/4
Publish topic 67 8192 [iot_thread] [INFO ][MQTT][8192] (MQTT connection 0x8000d8 f0) MQTT PUBLISH operation queued.
68 8192 [iot_thread] [INFO ][DEMO][8192] Acknowledgment message for PUBLISH 7 wi ll be sent.
69 8194 [iot_thread] [INFO ][DEMO][8194] Incoming PUBLISH received:
Subscription topic filter: iotdemo/topic/3
Publish topic 70 8194 [iot_thread] [INFO ][MQTT][8194] (MQTT connection 0x8000d8 f0) MQTT PUBLISH operation queued.
71 8194 [iot_thread] [INFO ][DEMO][8194] Acknowledgment message for PUBLISH 6 wi ll be sent.
72 8195 [iot_thread] [INFO ][DEMO][8195] 2 publishes received.
73 8195 [iot_thread] [INFO ][DEMO][8195] Publishing messages 8 to 9.
74 8196 [iot_thread] [INFO ][MQTT][8196] (MQTT connection 0x8000d8f0) MQTT PUBLI SH operation queued.
75 8197 [iot_thread] [INFO ][MQTT][8197] (MQTT connection 0x8000d8f0) MQTT PUBLI SH operation queued.
76 8197 [iot_thread] [INFO ][DEMO][8197] Waiting for 2 publishes to be received.
77 8621 [iot_thread] [INFO ][DEMO][8621] MQTT PUBLISH 9 successfully sent.
78 8622 [iot_thread] [INFO ][DEMO][8622] MQTT PUBLISH 8 successfully sent.
79 8648 [iot_thread] [INFO ][DEMO][8648] Incoming PUBLISH received:
Subscription topic filter: iotdemo/topic/2
Publish topic 80 8648 [iot_thread] [INFO ][MQTT][8648] (MQTT connection 0x8000d8 f0) MQTT PUBLISH operation queued.
81 8648 [iot_thread] [INFO ][DEMO][8648] Acknowledgment message for PUBLISH 9 wi ll be sent.
82 8648 [iot_thread] [INFO ][DEMO][8648] Incoming PUBLISH received:
Subscription topic filter: iotdemo/topic/1
Publish topic 83 8649 [iot_thread] [INFO ][MQTT][8649] (MQTT connection 0x8000d8 f0) MQTT PUBLISH operation queued.
84 8649 [iot_thread] [INFO ][DEMO][8649] Acknowledgment message for PUBLISH 8 wi ll be sent.
85 8650 [iot_thread] [INFO ][DEMO][8650] 2 publishes received.
86 8650 [iot_thread] [INFO ][DEMO][8650] Publishing messages 10 to 11.
87 8650 [iot_thread] [INFO ][MQTT][8650] (MQTT connection 0x8000d8f0) MQTT PUBLI SH operation queued.
88 8651 [iot_thread] [INFO ][MQTT][8651] (MQTT connection 0x8000d8f0) MQTT PUBLI SH operation queued.
89 8651 [iot_thread] [INFO ][DEMO][8651] Waiting for 2 publishes to be received.
90 9159 [iot_thread] [INFO ][DEMO][9159] MQTT PUBLISH 11 successfully sent.
91 9159 [iot_thread] [INFO ][DEMO][9159] MQTT PUBLISH 10 successfully sent.
92 9187 [iot_thread] [INFO ][DEMO][9187] Incoming PUBLISH received:
Subscription topic filter: iotdemo/topic/3
Publish topic 93 9187 [iot_thread] [INFO ][MQTT][9187] (MQTT connection 0x8000d8 f0) MQTT PUBLISH operation queued.
94 9187 [iot_thread] [INFO ][DEMO][9187] Acknowledgment message for PUBLISH 10 w ill be sent.
95 9188 [iot_thread] [INFO ][DEMO][9188] Incoming PUBLISH received:
Subscription topic filter: iotdemo/topic/4
Publish topic 96 9188 [iot_thread] [INFO ][MQTT][9188] (MQTT connection 0x8000d8 f0) MQTT PUBLISH operation queued.
97 9188 [iot_thread] [INFO ][DEMO][9188] Acknowledgment message for PUBLISH 11 w ill be sent.
98 9189 [iot_thread] [INFO ][DEMO][9189] 2 publishes received.
99 9189 [iot_thread] [INFO ][DEMO][9189] Publishing messages 12 to 13.
100 9189 [iot_thread] [INFO ][MQTT][9189] (MQTT connection 0x8000d8f0) MQTT PUBL ISH operation queued.
101 9190 [iot_thread] [INFO ][MQTT][9190] (MQTT connection 0x8000d8f0) MQTT PUBL ISH operation queued.
102 9190 [iot_thread] [INFO ][DEMO][9190] Waiting for 2 publishes to be received .
103 9679 [iot_thread] [INFO ][DEMO][9679] MQTT PUBLISH 13 successfully sent.
104 9680 [iot_thread] [INFO ][DEMO][9680] MQTT PUBLISH 12 successfully sent.
105 9710 [iot_thread] [INFO ][DEMO][9710] Incoming PUBLISH received:
Subscription topic filter: iotdemo/topic/2
Publish topic106 9710 [iot_thread] [INFO ][MQTT][9710] (MQTT connection 0x8000d8 f0) MQTT PUBLISH operation queued.
107 9710 [iot_thread] [INFO ][DEMO][9710] Acknowledgment message for PUBLISH 13 will be sent.
108 9710 [iot_thread] [INFO ][DEMO][9710] Incoming PUBLISH received:
Subscription topic filter: iotdemo/topic/1
Publish topic109 9710 [iot_thread] [INFO ][MQTT][9710] (MQTT connection 0x8000d8 f0) MQTT PUBLISH operation queued.
110 9711 [iot_thread] [INFO ][DEMO][9710] Acknowledgment message for PUBLISH 12 will be sent.
111 9712 [iot_thread] [INFO ][DEMO][9712] 2 publishes received.
112 9712 [iot_thread] [INFO ][DEMO][9712] Publishing messages 14 to 15.
113 9712 [iot_thread] [INFO ][MQTT][9712] (MQTT connection 0x8000d8f0) MQTT PUBL ISH operation queued.
114 9713 [iot_thread] [INFO ][MQTT][9713] (MQTT connection 0x8000d8f0) MQTT PUBL ISH operation queued.
115 9713 [iot_thread] [INFO ][DEMO][9713] Waiting for 2 publishes to be received .
116 10138 [iot_thread] [INFO ][DEMO][10138] MQTT PUBLISH 14 successfully sent.
117 10145 [iot_thread] [INFO ][DEMO][10145] MQTT PUBLISH 15 successfully sent.
118 10164 [iot_thread] [INFO ][DEMO][10164] Incoming PUBLISH received:
Subscription topic filter: iotdemo/topic/3
Publish top119 10164 [iot_thread] [INFO ][MQTT][10164] (MQTT connection 0x8000d8 f0) MQTT PUBLISH operation queued.
120 10164 [iot_thread] [INFO ][DEMO][10164] Acknowledgment message for PUBLISH 1 4 will be sent.
121 10171 [iot_thread] [INFO ][DEMO][10171] Incoming PUBLISH received:
Subscription topic filter: iotdemo/topic/4
Publish top122 10171 [iot_thread] [INFO ][MQTT][10171] (MQTT connection 0x8000d8 f0) MQTT PUBLISH operation queued.
123 10171 [iot_thread] [INFO ][DEMO][10171] Acknowledgment message for PUBLISH 1 5 will be sent.
124 10172 [iot_thread] [INFO ][DEMO][10172] 2 publishes received.
125 10172 [iot_thread] [INFO ][DEMO][10172] Publishing messages 16 to 17.
126 10173 [iot_thread] [INFO ][MQTT][10173] (MQTT connection 0x8000d8f0) MQTT PU BLISH operation queued.
127 10174 [iot_thread] [INFO ][MQTT][10174] (MQTT connection 0x8000d8f0) MQTT PU BLISH operation queued.
128 10174 [iot_thread] [INFO ][DEMO][10174] Waiting for 2 publishes to be receiv ed.
129 10593 [iot_thread] [INFO ][DEMO][10593] MQTT PUBLISH 16 successfully sent.
130 10596 [iot_thread] [INFO ][DEMO][10596] MQTT PUBLISH 17 successfully sent.
131 10620 [iot_thread] [INFO ][DEMO][10620] Incoming PUBLISH received:
Subscription topic filter: iotdemo/topic/1
Publish top132 10620 [iot_thread] [INFO ][MQTT][10620] (MQTT connection 0x8000d8 f0) MQTT PUBLISH operation queued.
133 10621 [iot_thread] [INFO ][DEMO][10621] Acknowledgment message for PUBLISH 1 6 will be sent.
134 10622 [iot_thread] [INFO ][DEMO][10622] Incoming PUBLISH received:
Subscription topic filter: iotdemo/topic/2
Publish top135 10622 [iot_thread] [INFO ][MQTT][10622] (MQTT connection 0x8000d8 f0) MQTT PUBLISH operation queued.
136 10622 [iot_thread] [INFO ][DEMO][10622] Acknowledgment message for PUBLISH 1 7 will be sent.
137 10622 [iot_thread] [INFO ][DEMO][10622] 2 publishes received.
138 10622 [iot_thread] [INFO ][DEMO][10622] Publishing messages 18 to 19.
139 10625 [iot_thread] [INFO ][MQTT][10625] (MQTT connection 0x8000d8f0) MQTT PU BLISH operation queued.
140 10626 [iot_thread] [INFO ][MQTT][10626] (MQTT connection 0x8000d8f0) MQTT PU BLISH operation queued.
141 10626 [iot_thread] [INFO ][DEMO][10626] Waiting for 2 publishes to be receiv ed.
142 11053 [iot_thread] [INFO ][DEMO][11053] MQTT PUBLISH 18 successfully sent.
143 11055 [iot_thread] [INFO ][DEMO][11055] MQTT PUBLISH 19 successfully sent.
144 11081 [iot_thread] [INFO ][DEMO][11081] Incoming PUBLISH received:
Subscription topic filter: iotdemo/topic/4
Publish top145 11081 [iot_thread] [INFO ][MQTT][11081] (MQTT connection 0x8000d8 f0) MQTT PUBLISH operation queued.
146 11081 [iot_thread] [INFO ][DEMO][11081] Acknowledgment message for PUBLISH 1 9 will be sent.
147 11082 [iot_thread] [INFO ][DEMO][11082] Incoming PUBLISH received:
Subscription topic filter: iotdemo/topic/3
Publish top148 11082 [iot_thread] [INFO ][MQTT][11082] (MQTT connection 0x8000d8 f0) MQTT PUBLISH operation queued.
149 11082 [iot_thread] [INFO ][DEMO][11082] Acknowledgment message for PUBLISH 1 8 will be sent.
150 11083 [iot_thread] [INFO ][DEMO][11083] 2 publishes received.
151 11083 [iot_thread] [INFO ][MQTT][11083] (MQTT connection 0x8000d8f0) UNSUBSC RIBE operation scheduled.
152 11083 [iot_thread] [INFO ][MQTT][11083] (MQTT connection 0x8000d8f0, UNSUBSC RIBE operation 0x8000da78) Waiting for operatio153 11536 [iot_thread] [INFO ][MQ TT][11536] (MQTT connection 0x8000d8f0, UNSUBSCRIBE operation 0x8000da78) Wait c omplete with r154 11536 [iot_thread] [INFO ][MQTT][11536] (MQTT connection 0x800 0d8f0) Disconnecting connection.
155 11536 [iot_thread] [INFO ][MQTT][11536] (MQTT connection 0x8000d8f0, DISCONN ECT operation 0x8000da78) Waiting for operation156 11536 [iot_thread] [INFO ][MQ TT][11536] (MQTT connection 0x8000d8f0, DISCONNECT operation 0x8000da78) Wait co mplete with re157 11536 [iot_thread] [INFO ][MQTT][11536] (MQTT connection 0x800 0d8f0) Connection disconnected.
158 11537 [iot_thread] [INFO ][MQTT][11537] (MQTT connection 0x8000d8f0) Network connection closed.
159 11762 [iot_thread] [INFO ][MQTT][11762] (MQTT connection 0x8000d8f0) Network connection destroyed.
160 11762 [iot_thread] [INFO ][MQTT][11762] MQTT library cleanup done.
161 11762 [iot_thread] [INFO ][DEMO][11762] Demo completed successfully.
162 11763 [iot_thread] [INFO ][INIT][11763] SDK cleanup done.

Maybe you can see what is going wrong here?

Thanks,
Jan

Janeu wrote on October 23, 2019:

Well, for some reason it works now.

The MQTT client receives messages from my development board.