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

NRF_ERROR_NO_MEM

Hi,

Some time ago I ask a question about changing the publish address of a node in the mesh locally. I received the answer in the following threat and verified it:

https://devzone.nordicsemi.com/f/nordic-q-a/40666/send-data-from-client-to-specific-server-via-unicast-address/158509#158509

The answer was the follwing code example:

uint32_t status = NRF_SUCCESS;

  dsm_handle_t publish_address_handle = DSM_HANDLE_INVALID;
  nrf_mesh_address_t publish_address_stored;

  if (access_model_publish_address_get(m_clients[0].model_handle, &publish_address_handle) != NRF_SUCCESS) {

    status = dsm_address_publish_add(destination_address, &publish_address_handle);

  } else {

    if (dsm_address_get(publish_address_handle, &publish_address_stored) == NRF_SUCCESS) {

      if ((publish_address_stored.type == NRF_MESH_ADDRESS_TYPE_VIRTUAL) ||
          (publish_address_stored.type != NRF_MESH_ADDRESS_TYPE_VIRTUAL &&
              publish_address_stored.value != destination_address)) {
        /* This should never assert */
        NRF_MESH_ASSERT(dsm_address_publish_remove(publish_address_handle) == NRF_SUCCESS);
        status = dsm_address_publish_add(destination_address, &publish_address_handle);
      } else {
        /* Use the retrieved publish_address_handle */
      }
    } else {

      status = dsm_address_publish_add(destination_address, &publish_address_handle);
    }
  }

  switch (status) {
  case NRF_ERROR_NO_MEM:
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "NRF_ERROR_NO_MEM\n");
    //            status_error_pub_send(handle, p_message, sig_model, ACCESS_STATUS_INSUFFICIENT_RESOURCES);
    return;

  case NRF_SUCCESS:
    break;

  default:
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "ACCESS_STATUS_UNSPECIFIED_ERROR\n");
    //            status_error_pub_send(handle, p_message, sig_model, ACCESS_STATUS_UNSPECIFIED_ERROR);
    return;
  }

  NRF_MESH_ASSERT(access_model_publish_address_set(m_clients[0].model_handle, publish_address_handle) == NRF_SUCCESS);

I now realized that if after I add 5 different addresses to the dsm I receive a NRF_ERROR_NO_MEM as status.

I can not figure out what is wrong. Can you please help me.

Best regards,

Michel

Parents Reply Children
Related