Hello,
Hardware: nRF52840
SKD: nRF5_SDK_16.0.0
SoftDevice v7.0.1
I am working on creating a multilink central application where my central device connects to 3 peripherals. I used the multilink_central and the ble_app_uart_c examples to start my project. My code mostly works as expected. I can connect to the 3 devices and send data back and forth. However, sometimes I get the NRF_ERROR_SVC_HANDLER_MISSING error in APP_UART_COMMUNICATION_ERROR when I use the UART to send data. The error mostly appears when I try to send data via the UART once I reach the BLE_GAP_EVT_AUTH_STATUS.
case BLE_GAP_EVT_AUTH_STATUS:
NRF_LOG_INFO("BLE_GAP_EVT_AUTH_STATUS: status=0x%x bond=0x%x lv4: %d kdist_own:0x%x kdist_peer:0x%x",
p_gap_evt->params.auth_status.auth_status,
p_gap_evt->params.auth_status.bonded,
p_gap_evt->params.auth_status.sm1_levels.lv4,
*((uint8_t *)&p_gap_evt->params.auth_status.kdist_own),
*((uint8_t *)&p_gap_evt->params.auth_status.kdist_peer));
ble_uart_handler_t event;
event.conn_handle = p_gap_evt->conn_handle;
event.auth_status = p_gap_evt->params.auth_status.auth_status;
event.bonded = p_gap_evt->params.auth_status.bonded;
event.evt_state = EVT_BOND_STATE;
response_send(event);
break;
void response_send(ble_uart_handler_t p_data)
{
... // Collecting the read information and filling output_buffer
// Send response.
ret_code_t ret_val;
for(uint32_t i = 0; i < output_length; i++){
do
{
ret_val = app_uart_put(output_buffer[i]);
if ((ret_val != NRF_SUCCESS) && (ret_val != NRF_ERROR_BUSY))
{
NRF_LOG_ERROR("app_uart_put failed for index 0x%04x.", i);
APP_ERROR_CHECK(ret_val);
}
} while (ret_val == NRF_ERROR_BUSY);
}
memset(p_data.rsp_buf, 0, index);
memset(output_buffer, 0, sizeof(output_buffer));
}
Additionally from the above area, sometimes, the error also appears randomly when sending data via the UART using the same "response_send" function mentioned above.
I am currently using the app_uart_fifo library (as used in the ble_app_uart_c example) with a baud rate of 115200.
I tried fixing this issue increasing the UART_TX_BUF_SIZE and the RAM, but this didn't help. Also, researching online, the majority of the people recommended to use flow control to fix this problem, but my device does not have access to the CTS and RTS pins, so I cannot take that route.
Error message:
<info> app: BLE_GAP_EVT_AUTH_STATUS: status=0x0 bond=0x1 lv4: 0 kdist_own:0x3 kdist_peer:0x3 <debug> app: Sending signal <error> app: Communication error occurred while handling UART <error> app: ERROR 1 [NRF_ERROR_SVC_HANDLER_MISSING] at C:\nano\nano2_5\ble_nrf\app\src\main.c:675 PC at: 0x00033783 <error> app: End of error report
I am kinda lost right now, so any input will be really appreciated.