Hi,
I am creating a central device with some similar services and code as the NUS example in the SDK. I posted with an issue here I was having earlier but I am writing this as a followup question. Basically, in my function that takes the data sent from the peripheral device to the central device and sends it over UART stalls after running for a while. In the code below, it stalls in the do{}while loop I think because it's app_uart_put keeps returning NRF_ERROR_NO_MEM. If I take the while loop out it seems to run but it starts losing data. Any suggestions on what I can do to stop the NRF_ERROR_NO_MEM error. From looking at the code, it looks like the buffers are filling up and not clearing. Should I try to increase the buffer size (currently 2048) more or is the problem more with the code in the function?
For reference, I'm trying to send about 20000 bytes per second to the central from the peripheral. Code for both is below. Also, I am using SDK version 15.3.0 on the 52480 DK.
static void ble_emg_chars_received_uart_print(uint8_t * p_data, uint16_t data_len) { ret_code_t ret_val; //NRF_LOG_DEBUG("Receiving data."); //NRF_LOG_HEXDUMP_DEBUG(p_data, data_len); for (uint32_t i = 0; i < data_len; i++) { do { ret_val = app_uart_put(p_data[i]); if ((ret_val != NRF_SUCCESS) && (ret_val != NRF_ERROR_NO_MEM)) { APP_ERROR_CHECK(ret_val); } } while (ret_val == NRF_ERROR_NO_MEM || ret_val == NRF_ERROR_BUSY); } }
Central
Peripheral