Hi,
As per my use-case i am receiving 10 KB of data in 27 bytes chunks from UART, After receiving data, I am writing 20 bytes data back on UART as an acknowledgement, then sending 20 byte from UART received data to all connected BLE central devices (MAX devices = 8) though BLE notification. But sometimes in this scenario ble device getting hanged or all connected central devices got disconnected.
UART BAUD_RATE is 115200,
/*********************************************************************
* @fn UART_Configuration
*
* @brief function for initializing UART.
*
* @param None.
*
* @return None.
*/
bool UART_Configuration(void)
{
UART_init();
UART_Params_init(&SbpUartParams);
SbpUartParams.readMode = UART_MODE_CALLBACK;
SbpUartParams.writeMode = UART_MODE_BLOCKING;
SbpUartParams.readCallback = &uart_readcallback;
SbpUartHandle = UART_open(Board_UART0, &SbpUartParams);
if( SbpUartHandle == NULL ) {
return false;
}
memset(send_data_buff, 0, sizeof(send_data_buff));
memset(read_buff, 0, sizeof(read_buff));
rx_data_len = PACKET_HEADER_INFO_LEN;
UART_read(SbpUartHandle, read_buff, rx_data_len);
return true;
}
this is my uart intialization code.
void uart_readcallback(UART_Handle handle, void *ptr, size_t size)
{
// Copy UART RX data to buffer
memcpy(&read_data[rd_index], read_buff, rx_data_len);
// Cancel uart read
UART_readCancel(SbpUartHandle);
// Post event to wake up the application
SimplePeripheral_enqueueMsg(UART_TX_EVT, NULL);
// notifing data here.
// length of 20 bytes
// Enable uart read.
UART_read(SbpUartHandle, read_buff, rx_data_len);
}
Above is my Uart read callback function and in UART_TX_EVT i am calling UART_Write function;
Please help me why my device getting hanged/disconnected and how to resolve this issue?