Hi,
I have a problem where I am getting NRF_ERROR_RESOURCES errors 2 out of 3 times when sending notifications from my peripheral to my central. I think this is caused because the central can't keep up with the peripheral. I know the NRF_ERROR_RESOURCES means that the buffer is full, but I am only sending one packet every connection interval, so the buffer should be emptied after each connection interval, but this is not the case.
My setup:
- 2 nRF52832, one is central, the other peripheral
- SDK14.1, softdevice s132 5.0.0
- connection interval: 100ms
- the peripheral is reading sensor data through I2C after every connection event (when radio goes off)
- After the I2C, the peripheral sends one data structure of 141 bytes (data length extensions enabled, correct MTU is used) using the sd_ble_gatts_hvx function
The central is only receiving one packet for every three connection intervals, while it should receive a packet every connection interval.
Below you can see a screencapture of my logical analyzer on which you can see the timings. The radio of my peripheral and central are turned on every 100ms, then the I2C reading is done, and then the peripheral sends the data.
Bigger image: https://i.imgur.com/d2VWmiM.png
As you can see, the BLE_NUS_C_EVT_NUS_TX_EVT is only called on the central after three connection intervals, while it should be called every connection event, because the peripheral is sending data after every connection event.
Any idea what could be the cause? Please ask if you need any extra info.
Edit: I just tested to send the data to my smartphone using nRF Connect app and I see the same behaviour. The problem appears to be on the peripheral side.