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

Mesh Sending many messages in a row

Hello

Im trying to find a way to send multiple messages (unreliable) in a row within a Mesh network in order to measure time taken, 

Im using a modified version of the light switch example project files where the client node sends specified(e.g. 20) number of messages.

To do this Im simply pressing a board button that triggers a for-loop where I use access_model_publish() and an error check, but I receive NRF_ERROR_NO_MEM on about 16/20 messages and the remaining is successfully sent. Do I need to release resources to other event or something? how would I do this

Ive tried searching for other doing the same but cant find any answers except for using the health model to measure throughput but that's not what I'm after

access_message_tx_t message;

void msg_set(uint8_t *msg, uint16_t length){
    send_command_msg_t command_msg;

    command_msg.length = length;
    strncpy(command_msg.command, msg, length);
    
    message.opcode.opcode = SEND_COMMAND;
    message.opcode.company_id = ACCESS_COMPANY_ID_NORDIC;
    message.p_buffer = (const uint8_t*) &command_msg;
    message.length = length;
}

void msg_send(){
    for(int i = 0;i<20;i++){
      status = send_command_client(&m_clients[0]);
          if (status == NRF_ERROR_INVALID_STATE ||
              status == NRF_ERROR_NO_MEM ||
              status == NRF_ERROR_BUSY) {
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Cannot send. Device is busy: 0x%08lX \r\n", status);
          } else {
            ERROR_CHECK(status);
          }
    	nrf_delay_ms(50);
    }
}

uint32_t send_command_client(simple_on_off_client_t *p_client)
{
    
    uint32_t status = NRF_SUCCESS;
    status = access_model_publish(p_client->model_handle, &message);

    return status;
}

Tried with different delays between each send as well from 0 to 50micro up to 500 ms

Related