This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

APP_UART_COMMUNICATION_ERROR on nRF52832

Hello,

I have to send 15 bytes on uart of nRF52832 (nordic micro is the receiver), but I have APP_UART_COMMUNICATION_ERROR. If I send 5 bytes everything works fine, if I insert a delay (1ms) between bytes (in the packet of 15) everything works fine. But if I send all bytes consecutively (with no delay intra bytes) I have the error. The initialization of uart is:

/**@brief  Function for initializing the UART module.
 */
/**@snippet [UART Initialization] */
static void uart_init(void)
{
    uint32_t                     err_code;
    app_uart_comm_params_t const comm_params =
    {
        .rx_pin_no    = PIN_P0_05_RXD,
        .tx_pin_no    = PIN_P0_06_TXD,
        .rts_pin_no   = NULL,
        .cts_pin_no   = NULL,
        .flow_control = APP_UART_FLOW_CONTROL_DISABLED,
        .use_parity   = false,
#if defined (UART_PRESENT)
        .baud_rate    = UART_BAUDRATE_BAUDRATE_Baud250000
#else
        .baud_rate    = NRF_UARTE_BAUDRATE_115200
#endif
    };

    APP_UART_FIFO_INIT(&comm_params,
                       UART_RX_BUF_SIZE,
                       UART_TX_BUF_SIZE,
                       uart_event_handle,
                       APP_IRQ_PRIORITY_LOWEST,
                       err_code);
    APP_ERROR_CHECK(err_code);

  nrf_gpio_cfg_input(PIN_P0_05_RXD,NRF_GPIO_PIN_PULLUP);

  BYTE_BT_TEL = 0; 

}

The uart event handler is:

/**@brief   Function for handling app_uart events.
 *
 * @details This function will receive a single character from the app_uart module and append it to
 *          a string. The string will be be sent over BLE when the last character received was a
 *          'new line' '\n' (hex 0x0A) or if the string has reached the maximum data length.
 */
/**@snippet [Handling the data received over UART] */
void uart_event_handle(app_uart_evt_t * p_event)
{
    //static uint8_t data_array[BLE_NUS_MAX_DATA_LEN];
    //static uint8_t index = 0;
    uint32_t       err_code;
    uint8_t dato;

    switch (p_event->evt_type)
    {
        case APP_UART_DATA_READY:
            //UNUSED_VARIABLE(app_uart_get(&data_array[index]));
            UNUSED_VARIABLE(app_uart_get(&dato));

           // NRF_LOG_INFO("OK RX");


            break;

        case APP_UART_COMMUNICATION_ERROR:
            APP_ERROR_HANDLER(p_event->data.error_communication);
            break;

        case APP_UART_FIFO_ERROR:
            APP_ERROR_HANDLER(p_event->data.error_code);
            break;

        default:
            break;
    }
}

#define UART_TX_BUF_SIZE     256
#define UART_RX_BUF_SIZE    256

I'm using nRF5_SDK_15.0.0. The softdevice is switched off.

What could be the problem?

Best regards

Parents Reply Children
Related