Hi,
I'm using nrf52840 to connect a mobile device via BLE.
I've noticed that when a lot of messages are sent, a disconnection occurs with reason code of NRF_ERROR_RESOURCES.
Can you please help me?
Thanks!
Hi,
I'm using nrf52840 to connect a mobile device via BLE.
I've noticed that when a lot of messages are sent, a disconnection occurs with reason code of NRF_ERROR_RESOURCES.
Can you please help me?
Thanks!
Hi,
NRF_ERROR_RESOURCES simply means that the softdevice have already buffered all notification in can hold, so you need to wait until BLE_GATTS_EVT_HVN_TX_COMPLETE event and retry.
Best regards,
Kenneth
Hi,
Just to clarify - NRF_ERROR_RESOURCES is received as an error code for disconnections. Do you think I need to try waiting for BLE_GATTS_EVT_HVN_TX_COMPLETE?
Thanks!
If the link have disconnected, then simply ignore the error code, and wait until next connection seems like a reasonable solution.
Kenneth
If the link have disconnected, then simply ignore the error code, and wait until next connection seems like a reasonable solution.
Kenneth
Sorry, I'm not sure I understand.
How can I prevent the disconnection? Can I increase buffer size?
Thanks
Re-reading the case I think I may have misunderstood.
Can you tell me the disconnect reason on BLE_GAP_EVT_DISCONNECTED event?
It should be possible to read this by:
p_ble_evt->evt.gap_evt.params.disconnected.reason
The available disconnect reasons are listed in ble_hci.h, there is no disconnect reason NRF_ERROR_RESOURCES.
Hi,
NRF_ERROR_RESOURCES is the disconnect reason code from p_ble_evt->evt.gap_evt.params.disconnected.reason, after I'm using nrf_strerror_get() to convert it to a string. Am I doing something wrong?
Thanks
You can't use nrf_strerror_get(), since it's not an error, it is a reason. I suspect that the value it is converting here is '19', this means BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION. So the peer is disconnecting the link, difficult to say why, I cannot see any reason it should depend on the messages sent.
Kenneth
That is correct - the value is 19. In addition - I can see the log "Generating ECC key pair" from function nrf_ble_lesc_keypair_generate, before disconnection. Do you think it may be related?
Thanks