We have an external interrupt every 4ms that collects one 24-bit sample from an analog front end via SPI. After Collecting 6 samples (18 bytes) we send a notification with the data which should then be every 4ms * 6 = 24ms. We're based on the ble_app_template example SDK v13 S132 (nRF52832) with default config settings and MIN_CONN_INTERVAL set to 7.5ms however, We're getting lots of NRF_ERROR_RESOURCES, what could be the problem?
Send function:
SEND_ERROR_CHECK(hrz_ecg_send_channel(&m_ecgs, m_ecgs.ecg_channel_1_handles, hrz_channel1, HRZ_ECGS_MAX_BUFFER_SIZE));
Error check:
#define SEND_ERROR_CHECK(ERR_CODE) \
do \
{ \
const uint32_t LOCAL_ERR_CODE = (ERR_CODE); \
if (LOCAL_ERR_CODE == NRF_ERROR_RESOURCES) { \
NRF_LOG_ERROR("Buffer full\r\n"); \
} \
else if ((LOCAL_ERR_CODE != NRF_SUCCESS) && \
(LOCAL_ERR_CODE != NRF_ERROR_INVALID_STATE) && \
(LOCAL_ERR_CODE != BLE_ERROR_GATTS_SYS_ATTR_MISSING) \
) \
{ \
NRF_LOG_ERROR("Error code: %d\r\n", LOCAL_ERR_CODE); \
APP_ERROR_HANDLER(LOCAL_ERR_CODE); \
} \
} while (0)
BLE_GATTS_EVT_HVN_TX_COMPLETE:
case BLE_GATTS_EVT_HVN_TX_COMPLETE:
NRF_LOG_INFO("Buffer free ");
NRF_LOG_INFO("Count: %d\r\n",p_ble_evt->evt.gatts_evt.params.hvn_tx_complete.count);
break;
Maximum packets per connection event:
memset(&ble_cfg, 0, sizeof ble_cfg);
ble_cfg.conn_cfg.conn_cfg_tag = CONN_CFG_TAG;
ble_cfg.conn_cfg.params.gatts_conn_cfg.hvn_tx_queue_size = 20;
err_code = sd_ble_cfg_set(BLE_CONN_CFG_GATTS, &ble_cfg, ram_start);
APP_ERROR_CHECK(err_code);
Console output: