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

NRF52810 can't initialize app_uart ( ERROR 8 [NRF_ERROR_INVALID_STATE])

Hi,

I'm developing a project which use softdevice and some peripherals together. I want to use serial communication with uart. But i couldn't initialize the app_uart module.

void uart_error_handle(app_uart_evt_t * p_event)
{
    if (p_event->evt_type == APP_UART_COMMUNICATION_ERROR)
    {
        APP_ERROR_HANDLER(p_event->data.error_communication);
    }
    else if (p_event->evt_type == APP_UART_FIFO_ERROR)
    {
        APP_ERROR_HANDLER(p_event->data.error_code);
    }
}

void uart_init(void)
{
    uint32_t err_code;
    const app_uart_comm_params_t comm_params =
        {
            RX_PIN_NUMBER,
            TX_PIN_NUMBER,
            RTS_PIN_NUMBER,
            CTS_PIN_NUMBER,
            UART_HWFC,
            false,
  #if defined (UART_PRESENT)
            NRF_UART_BAUDRATE_115200
  #else
            NRF_UARTE_BAUDRATE_9600
  #endif
        };

      app_uart_buffers_t m_buffers =
      {
          m_rx_buffer,
          UART_RX_BUF_SIZE,  //256
          m_tx_buffer,
          UART_TX_BUF_SIZE   //256
      };

      APP_UART_FIFO_INIT(&comm_params,
                           UART_RX_BUF_SIZE,
                           UART_TX_BUF_SIZE,
                           uart_error_handle,
                           APP_IRQ_PRIORITY_LOWEST,
                           err_code);

      APP_ERROR_CHECK(err_code);
      err_code = app_uart_init(&comm_params, &m_buffers, uart_error_handle, APP_IRQ_PRIORITY_LOW);
      APP_ERROR_CHECK(err_code);
  
}

app_uart_init function return "ERROR 8 [NRF_ERROR_INVALID_STATE]" error. I tried nrff_serial library a few days ago and i got same error also.

What does this error mean? I compiled app_uart example on my custom board and it worked  fine. I did everything same in my custom board but i couldn't make it.

Parents Reply Children
No Data
Related