This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

MQTT subscriber example doesn't work

I tried MQTT subscriber example code, it compiles and loads successfully but it doesn't show the LED lights accordingly as I press the buttons, meaning that MQTT state is still in the idle mode. (at least I think so...) It makes sense for me cause my nRF52 didn't even start advertising (I checked with nRF connect on iPad), so it definitely does not connect to the broker.

Then I used RTT viewer to see the real-time logging and wrote log in the first line of main(), but it doesn't even enter the main loop. (cause RTT didn't show the corresponding message.) To double check it, I wrote only LED_ON in the main(), and LEDs doesn't react as well. (It works for other example codes Nordic provides)

My questions are

  1. Does MQTT example code really enable advertising? cause I did not find any related function called in the main.c of MQTT subscriber example.

  2. Does it really not enter main()? or is it because #ifdef commission_enable is written in some parts of the main.c, so if the commission is not enabled, those parts will not executed? or something else?

  3. Is anyone successfully use MQTT subscriber example?

maybe this info could help to understand my question: I use IoT Gateway app on iPad and setup a broker (server) on cloudmqtt.com, which i am 100% sure that the broker works well cause i used MQTTool to test it. It can both subscribe and publish info on the broker. And I am sure of the IPv6 address, which I wrote in MQTT subscriber example, of the server is correct.

Related