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

NRF_ERROR_NO_MEM at sd_ble_gatts_hvx

I am getting a no memory error (NRF_ERROR_NO_MEM) after using sd_ble_gatts_hvx several times in a loop. I think the error is indeed 0x04 and not BLE_ERROR_NO_TX_PACKETS 0x3004 as one would expect from a such use case.. What could be potential reason for this? (SDK 11 - SD130)

Parents
  • Some additional info about this. it works as expected when i stop as soon as i receive 0x04 and resume @ BLE_EVT_TX_COMPLETE. However if i try to put another packet after 0x04 comm goes into non recoverable state and cannot send anything thereafter. So in short it works, but 0x04 is disturbing me.. any clarification would be much appreciated.   

Reply
  • Some additional info about this. it works as expected when i stop as soon as i receive 0x04 and resume @ BLE_EVT_TX_COMPLETE. However if i try to put another packet after 0x04 comm goes into non recoverable state and cannot send anything thereafter. So in short it works, but 0x04 is disturbing me.. any clarification would be much appreciated.   

Children
  • Hello ataii,

    I just ran in to the same problem after modifying ble_nus.h to support more than one server (that is, I modified BLE_NUS_DEF to work like BLE_NUS_C_ARRAY_DEF connect in to the ctx manager. NRF_ERROR_NO_MEM (0x04) is returned to ble_nus_data_send() at this line:

    err_code = blcm_link_ctx_get(p_nus->p_link_ctx_storage, conn_handle, (void *) &p_client);

    so it doesn't really come directly from the soft device but rather the blcm_link_ctx_get call.

    I haven't nailed down the root cause but because I've only allocated 3 NUS instances, and in that conn_handle at the time for the NO_MEM error is 3, it seems that either one needs to allocate one extra service instance or the context storage pool is shared with something else. I'm suspecting the latter but seeking wisdom.

    Best Regards, Howard

    PS To keep moving on I allocated enough instances in my application to cover all connections, both client and server, even though it's probably too many.

Related