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

MQTT connection fail while "THREAD_RADIO_MODE_RX_OFF_WHEN_IDLE" - SED

Hi,

I use a pca10056 with the "mqttsn_sleepy_publisher" example. Unfortunately, I cant connect to the mqttsn gateway. It throws me:

"NRF_LOG_ERROR("CONNECT message could not be sent. Error: 0x%x\r\n", err_code);"

I use the standard code for the DK and the border router. I just formed my own thread network and adjusted the credentials (panid ...) within the DK. Connecting and transmitting with radio ON works fine. 

I have found that ticket. So I guess it might has something to do with those values:

#define DEFAULT_CHILD_TIMEOUT    40                                     /**< Thread child timeout [s]. */
#define DEFAULT_POLL_PERIOD      1000                                     /**< Thread Sleepy End Device polling period when MQTT-SN Asleep. [ms] */
#define SHORT_POLL_PERIOD        100                                      /**< Thread Sleepy End Device polling period when MQTT-SN Awake. [ms] */
#define SEARCH_GATEWAY_TIMEOUT   5                                          /**< MQTT-SN Gateway discovery procedure timeout in [s]. */                                   

Do you have any idea, whether those values need to change? I know what they should do, but changing them didnt help much. 

Ps: I use Linux, SDK17, VS-Code, pca10056

  • I managed to get JLink-RTT-Viewer up running. These are the logging results.

    Test 1:
    Settings:
    * GatewayUDP6Broadcast = ff03::1
    * FTD
     Results:

    <info> app_timer: RTC: initialized.
    <info> app: Thread version   : OPENTHREAD/20191113-00534-gc6a258e3; NRF52840; Apr  5 2020 21:51:18
    <info> app: Network name     : OpenThreadDemo
    <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-on-when-idle
    <warning> app_timer: RTC instance already initialized.
    <info> app: State changed! Flags: 0x011FD33D Current role: 1
    
    <info> app: State changed! [0000024087] TEST
    <error> app: TEST
    <info> app: TEST
    TEST<info> app: MQTT-SN event: Client has found an active gateway.
    
    <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 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: Client has successfully published content.

    Test 2:
    Settings:
    * GatewayUDP6Broadcast = ff03::1
    * SED
    Results:

    SEGGER J-Link V7.50 - Real time terminal output
    J-Link OB-SAM3U128-V2-NordicSemi compiled Feb  2 2021 16:47:20 V1.0, SN=683835218
    Process: JLinkExe
    <info> app_timer: RTC: initialized.
    <info> app: Thread version   : OPENTHREAD/20191113-00534-gc6a258e3; NRF52840; Apr  5 2020 21:53:43
    <info> app: Network name     : OpenThreadDemo
    <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: 0x0117D33D Current role: 1
    
    <info> app: State changed!<info> app: MQTT-SN event: Gateway discovery procedure has finished.
    
    <info> app: MQTT-SN event: Gateway discovery result: 0x3.
    
    <error> app: CONNECT message could not be sent. Error: 0xE
    

    Test 3:
    Settings:
    * GatewayUDP6Broadcast = ff33:40:fdde:ad00:beef:0:0:1
    * FTD
    Results:

    SEGGER J-Link V7.50 - Real time terminal output
    J-Link OB-SAM3U128-V2-NordicSemi compiled Feb  2 2021 16:47:20 V1.0, SN=683835218
    Process: JLinkExe
    <info> app_timer: RTC: initialized.
    <info> app: Thread version   : OPENTHREAD/20191113-00534-gc6a258e3; NRF52840; Apr  5 2020 21:51:18
    <info> app: Network name     : OpenThreadDemo
    <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-on-when-idle
    <warning> app_timer: RTC instance already initialized.
    <info> app: State changed! Flags: 0x011FD33D Current role: 1
    
    <info> app: State changed! [0000577562] TEST
    <error> app: TEST
    <info> app: TEST
    TEST<info> app: MQTT-SN event: Gateway discovery procedure has finished.
    
    <info> app: MQTT-SN event: Gateway discovery result: 0x3.
    
    <error> app: CONNECT message could not be sent. Error: 0xE
    
    <error> app: CONNECT message could not be sent. Error: 0xE

    Test 4:
    Settings:
    * GatewayUDP6Broadcast = ff33:40:fdde:ad00:beef:0:0:1
    * SED
    Results:

    SEGGER J-Link V7.50 - Real time terminal output
    J-Link OB-SAM3U128-V2-NordicSemi compiled Feb  2 2021 16:47:20 V1.0, SN=683835218
    Process: JLinkExe
    <info> app_timer: RTC: initialized.
    <info> app: Thread version   : OPENTHREAD/20191113-00534-gc6a258e3; NRF52840; Apr  5 2020 21:53:43
    <info> app: Network name     : OpenThreadDemo
    <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: 0x0117D33D Current role: 1
    
    <info> app: State changed!<info> app: MQTT-SN event: Gateway discovery procedure has finished.
    
    <info> app: MQTT-SN event: Gateway discovery result: 0x3.
    
    <error> app: CONNECT message could not be sent. Error: 0xE

  • Hello, Maboo!

    Apologies for the very late response on your question. We have been understaffed due to the summer holiday here in Norway. Øyvind went on holiday himself, so I have taken over your case. 

    First, thank you for the extensive logs. The result you see in Test 2 is expected, as SEDs doesn't support multicast address "ff03::1". I reached out to a colleague about the issue with the other address. It seems like you may be using the wrong mesh-local prefix. The default (from wpan status) should be: 

    "IPv6:MeshLocalPrefix" => "fdde:ad00:beef::/64"

    but you have,
    "IPv6:MeshLocalPrefix" => "fd11:1111:1122::/64"


    You must change the address to match the network prefix.

    Best regards,
    Carl Richard

  • Hi Carl Richard,

    Sorry for my very late reply, I was on holiday as well. First, thanks alot for your reply. It helped me alot, to understand where the problem lies. Still, I don't quite understand where I can change my MeshLocalPrefix. I tried to figure it out by reading the Open Thread - Get Started, but I couldn't. I am somehow confused, since the GatewayUDP6Broadcast address is another parameter. 

    1. Could you recommend a website/tutorial just to better understand the network parameters? (Open Thread website was a good start, but it doesn't goes that deep)
    2. Where can I change the MeshLocalPrefix?
    3. What is the difference between the MeshLocalPrefix and the OnMeshPrefix?

    Greetings Maboo

  • Hello Maboo,

    I'll handle this ticket, since Carl Richard is currently out of office. 

    Maboo said:
    Where can I change the MeshLocalPrefix?

    I am not sure you can change this, or if it is just given when the network forms. Is there a particular reason why you want to change this?

    Maboo said:
    1. What is the difference between the MeshLocalPrefix and the OnMeshPrefix?

    Where did you find "OnMeshPrefix"? A quick search on the openthread - get started guide didn't give any search results. Perhaps you can show me where you found it?

    Maboo said:
    Could you recommend a website/tutorial just to better understand the network parameters? (Open Thread website was a good start, but it doesn't goes that deep)

    I am not aware of any other guides that go that much deeper. I guess you can check with Open Thread's website and forums. 

    Best regards,

    Edvin

  • Hi Edvin,

    thanks for taking over. Basically I struggling with the answer from Carl Richard.

    You must change the address to match the network prefix

    What address? Does he mean the "GatewayUDP6Broadcast" address in /etc/paho-mqtt-sn-gateway.conf. And how do I form/change the address to match the network prefix? (==mesh local prefix???).

    I found this on Open Thread webpage:

    You might notice that Sleepy End Devices (SEDs) are not included as a recipient in the multicast table above. Instead, Thread defines link-local and realm-local scope unicast prefix-based IPv6 multicast address used for All Thread Nodes, including SEDs. These multicast addresses vary by Thread network, because it is built on the unicast Mesh-Local prefix (see RFC 3306 for more details on unicast-prefix-based IPv6 multicast addresses).

    But the explanations on the RFC 3306 webside are too confusing for me.

    The problem why I ask is, as long as I use the standard values from nRF it would work I guess. But when I create my own network it automatically creates its own mesh local prefix (learned this last week). That is the point were I need to understand how to change or form the right address to match it.

    Ps: The OnMeshPrefix is located under "/etc/border_router.conf.

    Best regards,

    Markus

Related