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

Sending Multiple Mesh Messages Consecutively

Hello,

I want to be able to send 1 MB of data from a server node to a client node

I have made a simple model with an array that holds 300 bytes.

and upon a timer the server node will wake up and attempt to send this message 3125 times each time with different contents in the array.

At the start i was receiving NRF_ERROR_NO_MEM

and after a little bit of digging i found a post about waiting for NRF_MESH_EVT_TX_COMPLETE

So in my MeshEventCallbackHandler i wait for NRF_MESH_EVT_TX_COMPLETE and send but every 2 / 3rd time i will receive NRF_ERROR_NO_MEM

static int counter = 0;
static void TriggerSending()
{
    if(counter < 3125)
    {
        uint8_t random_data[300];
        for(int j = 0; j < 300; j++)
        {
            random_data[j] = counter;
        }
         asset_check_in_server_update_on_waking(&m_server, currentTemp, occupancy, random_data);
        counter++;
        serverUpdateSent = true;
    }
    else
    {
        fullMessageSent = true;
        counter = 0;
    }

}

static void meshEventCallbackHandler(const nrf_mesh_evt_t * p_evt){
  if(p_evt->type == NRF_MESH_EVT_TX_COMPLETE){
      if(serverUpdateSent){
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Asset Tx complete\n");
        serverUpdateSent = false;
        if(!fullMessageSent)
        {
            TriggerSending();
        }
      }
      else if(healthUpdateSent){
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Health Tx complete\n");
        ERROR_CHECK(app_timer_start(WaitAfterPublishTimer, APP_TIMER_TICKS(200), NULL));
        healthUpdateSent = false;
      }

  }
}
}

static void PublishAfterProvisioningTimer_handler(void * p_context){
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Publish\n");
   
    fullMessageSent = false;
    TriggerSending();
}

Any Help would be appreciated.

Regards,

David Hutchinson

Parents Reply
  • When you send packets that are longer than 11 bytes, they will be sent as segmented packets. 

    If you send the packets to a unicast address, the receiver have to ACK all the packets and if they aren't received they have to be sent again. If you send the packets to a group address, there will be no ACK so the packets have to be sent multiple times to compensate.

    Seeing the amount of data you are sending, it will probably take 1 second between each transmission. The Mesh aren't really optimized for sending large amount of data.

    Number of retries are set in  TRANSPORT_SAR_TX_RETRIES_DEFAULT (4) and can be adjusted with NRF_MESH_OPT_TRS_SAR_TX_RETRIES in nrf_mesh_opt.h You can also adjust the timing in nrf_mesh_opt.h.

Children
No Data
Related