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

MQTT-SN won't connect as SED while "THREAD_RADIO_MODE_RX_OFF_WHEN_IDLE"

Hello,

I'm struggling to connect to an MQTT-SN Gateway when the device is configured for low power.  Currently using MAC-OS Catalina 10.15.3, SES version 4.42 and have tried Nordic + Thread SDK's version 3.2 and version 4.

I can't register an MQTT-SN device when the thread_instance_init is called with ".radio_mode" set to "THREAD_RADIO_MODE_RX_OFF_WHEN_IDLE"  If I build the project with this configuration, the gateway configuration fails and returns "app: MQTT-SN event: Gateway discovery result: 0x3"

I can change the radio mode to "THREAD_RADIO_MODE_RX_ON_WHEN_IDLE" and it all works as expected, but the current consumption is unacceptably high for my proposed application.  I have looked at the gateway configuration on my MQTT-SN gateway and I don't see anything obvious that could change here to solve this issue.

Ultimately, I guess I'm asking"

  A: Can other people successfully register/publish/subscribe to MQTT using the "thread_mqtt_sn_sleepy_publisher_pcba10056" example project?  

  B: If not, is there a workaround for this to be able to use MQTT-SN as a SED?

Thanks and Best Regards,

Roger

  • Hi,

    Have you seen the test guidelines for the sleepy subscriber and publisher projects on the infocenter? Are you using our thread border router as the MQTT-SN gateway or a third party's? Are you struggling to connect the example out of the box or have you made any modifications?

    Best regards,

    Marjeris

  • Hi Marjeris,

    I have reviewed the test guidelines and I don't think there's anything I'm missing there (I could always be wrong on that).  I am using a Raspberry Pi with the Nordic Thread Border Router image and using an NRF52840 Dongle as the NCP.  I am pretty much using the SDK examples out of the box, the only modification I've made is to the sdk_config.h file to clear the NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED  flag for debugging within SES.  I've also set the channel and PANID over the CLI to connect to my network.  Those are the only changes.

    The mqttsn_client_publisher example works as described in the test guidelines.  The mqttsn_sleepy_publisher works as described if I change the thread configuration radio mode to RX_ON_WHILE_IDLE, but out of the box it isn't able to connect to the gateway.

  • Hi,

    I tested this on my setup. Initially, I got an error when changing the radio mode to :

    <info> app: MQTT-SN event: Gateway discovery result: 0x3.

    I then set the poll_period and child_timeout parameters, similar to the MQTT-SN Sleepy Subscriber example:

    thread_configuration_t thread_configuration =
    {
        .radio_mode        = THREAD_RADIO_MODE_RX_OFF_WHEN_IDLE,
        .autocommissioning = true,
        .poll_period           = DEFAULT_POLL_PERIOD,
        .default_child_timeout = DEFAULT_CHILD_TIMEOUT,
    };

    I was then able to find and connect the gateway as normal:

    <info> app: Thread version   : OPENTHREAD/20180926-01143-g8a1992e2; NRF52840; Dec 10 2019 22:48:00
    <info> app: Network name     : NordicOpenThread
    <info> app: Thread interface has been enabled.
    <info> app: 802.15.4 Channel : 11
    <info> app: 802.15.4 PAN ID  : 0xABCD
    <info> app: Radio mode       : rx-off-when-idle
    <warning> app_timer: RTC instance already initialized.
    <info> app: State changed! Flags: 0x011FD33D Current role: 1
    
    <info> app: State change<info> app: MQTT-SN event: Client has found an active gateway.
    <info> app: MQTT-SN event: Client connected.
    <info> app: MQTT-SN event: Client registered topic.
    <info> app: MQTT-SN event: Topic has been registered with ID: 1.
    <info> app: MQTT-SN event: Gateway discovery procedure has finished.
    <info> app: MQTT-SN event: Gateway discovery result: 0x0.
    <info> app: MQTT-SN event: Client has successfully published content.
    <info> app: MQTT-SN event: Client has successfully published content.

    Best regards,
    Jørgen

  • Thank you for the assistance Jørgen and Marjeris!

    Thanks,

    Roger

Related