Hi,
I have tested my BLE code and UART code separately, and both worked correctly during individual testing.
However, when integrating both, I encountered an issue with UART. Specifically, when I try to enable UART RX, it triggers the callback for UART RX STOP
. Following this, UART RX STOP
is called, and then UART RX DISABLING
is triggered.
Here is the UART setup code for reference:
int err = device_is_ready(uart2_dev); if (err) { LOG_ERR("Device is ready: %d", err); } err = uart_callback_set(uart2_dev, uart_cb, NULL); if (err) { LOG_ERR("Failed to set UART callback: %d", err); return; } LOG_INF("uart callback ser %d", err); // k_msleep(1000); LOG_INF("before uart rx enable"); err = uart_rx_enable(uart2_dev, rx_buf, sizeof(rx_buf), UART_FIFO_TIMEOUT_MS); if (err) { LOG_ERR("Failed to enable UART RX: %d", err); return; } LOG_INF("after enbale uart rx"); LOG_INF("uart rx enable %d", err);
This are the LOG.
Advertising successfully started E: Device is ready: 1 I: uart callback ser 0 I: before uart rx enable II: UART_RX_STOPPED I: UART_RX_STOPPED I: UART_RX_DISABLED I: UART_RX_STOPPED : after enbale uart rx I: uart rx enable 0
For testing, I used the BLE LBS example.
Could you please assist me in resolving this issue?
Thank you.