nRF7002 DK MQTT messages not received.

Hi,

I have an nRF7002-DK. I am trying the MQTT over Wi-Fi following this blog below.

https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/implementing-mqtt-over-wi-fi-on-the-nrf7002-development-kit

I have a previous post regarding this and it did work one time. But, just today I tried again same procedure but I am not able receive the messages from the 

MQTT Dashboard Android app. I can see from the logs that the nRF7002-DK is connected to the MQTT broker, see below.

[00:02:00.018,341] <inf> MQTT_OVER_WIFI: broker_init: IPv4 Address found 91.121.93.94
[00:02:00.325,012] <inf> net_mqtt: client_connect: Connect completed
[00:02:00.634,368] <inf> MQTT_OVER_WIFI: mqtt_evt_handler: MQTT client connected
[00:02:00.634,399] <inf> MQTT_OVER_WIFI: subscribe: Subscribing to: devacademy/subscribe/topic44 len 28
[00:02:00.906,158] <inf> MQTT_OVER_WIFI: mqtt_evt_handler: SUBACK packet id: 1234

Also, at proj.conf I changed the the mqtt broker to broker.hivemq.com see below.

# Application
CONFIG_MQTT_PUB_TOPIC="devacademy/publish/topic4445"
CONFIG_MQTT_SUB_TOPIC="devacademy/subscribe/topic4445"
#Note If you notice that the test.mosquitto.org is unresponsive,
#there are several other public MQTT brokers that you can use (Ex: broker.hivemq.com at port 1883)
CONFIG_MQTT_BROKER_HOSTNAME="broker.hivemq.com"

CONFIG_MQTT_CLIENT_ID="a3ec5cba-4730-406c"
CONFIG_MQTT_BROKER_PORT=1883
At Kconfig file here are my changes below.
config MQTT_PUB_TOPIC
    string "MQTT publish topic"
    default "devacademy/publish/topic4445"

config MQTT_SUB_TOPIC
    string "MQTT subscribe topic"
    default "devacademy/subscribe/topic4445"

config MQTT_CLIENT_ID
    string "MQTT Client ID"
    help
      Use a custom Client ID string.
    default "a3ec5cba-4730-406c"

config MQTT_BROKER_HOSTNAME
    string "MQTT broker hostname"
    default "broker.hivemq.com"
I don't understand why I am still getting this log.
[00:02:00.634,399] <inf> MQTT_OVER_WIFI: subscribe: Subscribing to: devacademy/subscribe/topic44
I read some posts that I may need to change the protocol to MQTT 3.1.1, but I do not know where to set that.
Regards,
Markel

Parents
  • I reversed the publish and subscribe at the MQTT Dashboard Android App before that is why it does not work. After I corrected the published and subscribed it worked.

    I think the other issue with the program from the guide is it does not always connect to the mqtt broker. After some time it will connect. Sometimes it connects the first time.

    [00:00:19.607,818] <err> net_mqtt_rx: [CID 0x20003894]: Transport read error: -116
    [00:00:19.607,849] <inf> net_mqtt_sock_tcp: Closing socket 7
    [00:00:19.607,940] <inf> MQTT_OVER_WIFI: MQTT client disconnected: -116
    [00:00:19.607,971] <err> MQTT_OVER_WIFI: Error in mqtt_input: -116
    [00:00:19.607,971] <inf> MQTT_OVER_WIFI: Disconnecting MQTT client
    [00:00:19.608,001] <err> MQTT_OVER_WIFI: Could not disconnect MQTT client: -128
    [00:00:19.608,001] <inf> MQTT_OVER_WIFI: Reconnecting in 60 seconds...
    [00:01:19.939,208] <inf> net_mqtt: Connect completed
    [00:01:20.258,087] <inf> MQTT_OVER_WIFI: MQTT client connected
    [00:01:20.258,117] <inf> MQTT_OVER_WIFI: Subscribing to: devacademy/subscribe/topic44 len 28
    [00:01:20.581,604] <inf> MQTT_OVER_WIFI: SUBACK packet id: 1234
    [00:01:23.246,368] <err> net_mqtt_rx: [CID 0x20003894]: Connection closed.
    [00:01:23.246,398] <inf> net_mqtt_sock_tcp: Closing socket 7
    [00:01:23.246,490] <inf> MQTT_OVER_WIFI: MQTT client disconnected: -128
    [00:01:23.246,490] <err> MQTT_OVER_WIFI: Error in mqtt_input: -128
    [00:01:23.246,520] <inf> MQTT_OVER_WIFI: Disconnecting MQTT client
    [00:01:23.246,520] <err> MQTT_OVER_WIFI: Could not disconnect MQTT client: -128
    [00:01:23.246,551] <inf> MQTT_OVER_WIFI: Reconnecting in 60 seconds...

    Regards,

    Markel

Reply
  • I reversed the publish and subscribe at the MQTT Dashboard Android App before that is why it does not work. After I corrected the published and subscribed it worked.

    I think the other issue with the program from the guide is it does not always connect to the mqtt broker. After some time it will connect. Sometimes it connects the first time.

    [00:00:19.607,818] <err> net_mqtt_rx: [CID 0x20003894]: Transport read error: -116
    [00:00:19.607,849] <inf> net_mqtt_sock_tcp: Closing socket 7
    [00:00:19.607,940] <inf> MQTT_OVER_WIFI: MQTT client disconnected: -116
    [00:00:19.607,971] <err> MQTT_OVER_WIFI: Error in mqtt_input: -116
    [00:00:19.607,971] <inf> MQTT_OVER_WIFI: Disconnecting MQTT client
    [00:00:19.608,001] <err> MQTT_OVER_WIFI: Could not disconnect MQTT client: -128
    [00:00:19.608,001] <inf> MQTT_OVER_WIFI: Reconnecting in 60 seconds...
    [00:01:19.939,208] <inf> net_mqtt: Connect completed
    [00:01:20.258,087] <inf> MQTT_OVER_WIFI: MQTT client connected
    [00:01:20.258,117] <inf> MQTT_OVER_WIFI: Subscribing to: devacademy/subscribe/topic44 len 28
    [00:01:20.581,604] <inf> MQTT_OVER_WIFI: SUBACK packet id: 1234
    [00:01:23.246,368] <err> net_mqtt_rx: [CID 0x20003894]: Connection closed.
    [00:01:23.246,398] <inf> net_mqtt_sock_tcp: Closing socket 7
    [00:01:23.246,490] <inf> MQTT_OVER_WIFI: MQTT client disconnected: -128
    [00:01:23.246,490] <err> MQTT_OVER_WIFI: Error in mqtt_input: -128
    [00:01:23.246,520] <inf> MQTT_OVER_WIFI: Disconnecting MQTT client
    [00:01:23.246,520] <err> MQTT_OVER_WIFI: Could not disconnect MQTT client: -128
    [00:01:23.246,551] <inf> MQTT_OVER_WIFI: Reconnecting in 60 seconds...

    Regards,

    Markel

Children
Related