MQTT-SN event: Retransmission retries limit has been reached

Hi,

I am using an pca10059 as a SED together with a border router in my thread network. The SED shall publish every 5 min sensor data. That works fine. But after some time (randomly after 40 min or 6h) I get this error message via logger and I cant publish the sensor data anymore:

<info> app: MQTT-SN event: Retransmission retries limit has been reached.

<info> app: MQTT-SN event: Timed-out message: 5. Message ID: 0.

While testing where the problem lies, I added a pca10056 (SED) and got the same error at the same time for both devices.

These are my parameters for the SED devices (standard):

#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  

#define SCHED_QUEUE_SIZE      32                              /**< Maximum number of events in the scheduler queue. */
#define SCHED_EVENT_DATA_SIZE APP_TIMER_SCHED_EVENT_DATA_SIZE /**< Maximum app_scheduler event size. */

Do I have to change some timeout parameter for the gateway? Or does the thread network need at least one FTD next to the border router?

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

  • Hi Sigurd,

    thank you anyway for your help. I will come back to you, if i need some help with the OTBR.

    Thanks!

    Markus

  • Hi Sigurd,

    it has been a while. I was working on the OTBR. I was able to install it to an RPi 4 using this tutorial and an pca10059 as RCP. Afterwards I installed the paho-mqtt-sn gateway to the RPi 4 using that website. Then i flashed a pca10056 with the standard "mqttsn_client_publisher" example and connect it to the thread network from the OTBR. Both devices are visible via CLI "> router table". OTBR is leader, DK is router, ping each other is also possible as well.

    After starting the mqtt-sn-gateway I tried to connect to it with the pca10056 by pressing the buttons. That is what I get:

    mqtt-sn-gateway:

    pi@raspberrypi:/etc/paho.mqtt-sn.embedded-c/MQTTSNGateway/bin $ sudo ./MQTT-SNGateway 
    
     ***************************************************************************
     * MQTT-SN Gateway
     * Part of Project Paho in Eclipse
     * (https://github.com/eclipse/paho.mqtt-sn.embedded-c.git)
     *
     * Author : Tomoaki YAMAGUCHI
     * Version: 1.5.1
     ***************************************************************************
     ConfigFile  : ./gateway.conf
     ClientList  : /path/to/your_clients.conf
     Broker      : mqtt.eclipseprojects.io : 1883, 8883
     RootCApath  : (null)
     RootCAfile  : (null)
     CertKey     : (null)
     PrivateKey  : (null)
     SensorN/W   : Multicast Address: [ff33:40:fdde:ad00:beef:0:0:1]:1883, Gateway Port:47193, Interface: wpan0, Hops:1
     Max Clients : 30
    
    20211202 092716.374 PahoGateway-01 starts running.
    
    
    20211202 092719.544   SEARCHGW          <---  Client                              03 01 01
    20211202 092719.545   GWINFO            --->  Clients                             03 02 01
    

    DK - JLinkLog:

    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     : 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-on-when-idle
    <warning> app_timer: RTC instance already initialized.
    <info> app: State changed! Flags: 0x011FD33D Current role: 1
    
    <info> app: State changed<info> app: State changed! Flags: 0x00000064 Current role: 3
    
    <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

    So the buttonpress somehow triggers the SEARCHGW and GWINFO but i still cant connect.

    While searching for a solution, I came across the gateway.conf.

    #  SensorNetworks parameters
    #==============================
    #
    # UDP | DTLS 
    # 
    
    GatewayPortNo=10000
    MulticastPortNo=1883
    MulticastIP=225.1.1.1
    MulticastTTL=1
    
    #
    # UDP6 | DTLS6
    #
    
    GatewayIPv6PortNo=47193
    MulticastIPv6PortNo=1883
    MulticastIPv6=ff33:40:fdde:ad00:beef:0:0:1
    MulticastIPv6If=wpan0
    MulticastHops=1

    I tried to configure it like on the nrf border router image. Especially the GatewayIPv6PortNo, MulticastIPv6 and MulticastIPv6If was different. It still didn't work.

    I guess it has something to do with the network prefixes, since when I use "~$ sudo ot-ctl netdata show", there are none.

    pi@raspberrypi:~ $ sudo ot-ctl netdata show
    Prefixes:
    Routes:
    Services:
    44970 01 4a04b000000e10 s 6000
    44970 5d fdf4f30b7d7292086c737a4e8b86d1eed11f s 6000
    Done

    I know I can add them by:

    ~ $ sudo ot-ctl add prefix <ipv6-prefix> paros med
    ~ $ sudo ot-ctl netdata register //activates them

    But I couldn't figure how to get the correct prefix.

    Do you have any idea?

  • Hi Maboo

    You get error code 0xE (14) which is NRF_ERROR_NULL.  (See nRF5_Thread_Zigbee/components/drivers_nrf/nrf_soc_nosd/nrf_error.h)
    This is likely from the function:

    uint32_t mqttsn_client_connect(mqttsn_client_t      * p_client,
                                   mqttsn_remote_t      * p_remote,
                                   uint8_t                gateway_id,
                                   mqttsn_connect_opt_t * p_options)
    {
        NULL_PARAM_CHECK(p_client);
        NULL_PARAM_CHECK(p_remote);
        NULL_PARAM_CHECK(p_options);
    
        if (gateway_id == 0 || p_options->alive_duration == 0 || p_options->client_id_len == 0)
        {
            return NRF_ERROR_NULL;
        }
    
        if (p_options->will_flag == 1 && (p_options->will_msg_len == 0 || p_options->will_topic_len == 0)) 
        {
            return NRF_ERROR_NULL;
        }
    
        if (!is_initialized(p_client))
        {
            return NRF_ERROR_FORBIDDEN;
        }
    
        if (!is_eligible_for_establishing_connection(p_client))
        {
            return NRF_ERROR_INVALID_STATE;
        }
    
        memset(&(p_client->gateway_info.addr), 0, sizeof(p_client->gateway_info.addr));
        memcpy(&(p_client->gateway_info.addr), p_remote, sizeof(p_client->gateway_info.addr));
    
        p_client->gateway_info.id = gateway_id;
    
        connect_info_init(p_client, p_options);
    
        uint32_t err_code = mqttsn_packet_sender_connect(p_client);
        if (err_code == NRF_SUCCESS)
        {   
            mqttsn_client_state_update(p_client, SENT_CONNECT);
        }   
    
        return err_code;
    }
    

    Could you find the values of these parameters, and which one causes the error?

    The  OTBR with MQTT-SN I linked to earlier should do about the same thing you are trying to do. Maybe have a look at this to see how it does things.

    Let me quote you from some time back:

    Maboo said:
    unfortunately I do have some problems to get the OTBR running.

    The OTBR I linked to was running in Docker, which should be relatively straight forward. If you describe the issues you are facing setting it up, I can try to help you make it work.

    If it is fast to set up, it would be interesting to see if it behaves differently that the version you are building.

    Regards,
    Sigurd Hellesvik

Related