Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

nrfx_uarte_rx from nrfx throwing NRFX_ERROR_INTERNAL

I have a code build on top of nrfx 2.0 and after a few received bytes I get NRFX_ERROR_INTERNAL back from nrfx_uarte_rx call in blocking mode.

So I can process around 20 or so bytes before I start getting the error.

Every subsequend call to nrfx_uarte_rx yelds the error until the board is reset.

Im unsure where to move from here as the documentation is not specific in what this error may be related to.

prj: 

CONFIG_NRFX_UARTE0=y

code:

static nrfx_uarte_t uarte_instance = NRFX_UARTE_INSTANCE(0);
  nrfx_uarte_config_t uarte_config = {
      .pselrxd = NRF_GPIO_PIN_MAP(0, 15),
      .pseltxd = NRF_GPIO_PIN_MAP(0, 14),
      .pselcts = NRF_UARTE_PSEL_DISCONNECTED,
      .pselrts = NRF_UARTE_PSEL_DISCONNECTED,
      .hal_cfg = {.hwfc = NRF_UARTE_HWFC_DISABLED, .parity = NRF_UARTE_PARITY_EXCLUDED, .stop = NRF_UARTE_STOP_ONE},
      .baudrate = NRF_UARTE_BAUDRATE_115200,
      .skip_gpio_cfg = 0,
      .skip_psel_cfg = 0};
  nrfx_uarte_init(&uarte_instance, &uarte_config, NULL);
  LOG_INF("Done with UART init.");

  char uart_rx_data[100] = { 0 };
  
  // test code
  while (1) {
      retcode = nrfx_uarte_rx(&uarte_instance, uart_rx_data, 10);
      if (retcode == NRFX_SUCCESS) {
        LOG_INF("UARTE RX OK: %d\n", retcode);
      } else if (retcode == NRFX_ERROR_BUSY) {
        LOG_INF(" NRFX_ERROR_BUSY");
      } else if (retcode == NRFX_ERROR_FORBIDDEN) {
        LOG_INF(" NRFX_ERROR_FORBIDDEN");
      } else if (retcode == NRFX_ERROR_INTERNAL) {
        LOG_INF(" NRFX_ERROR_INTERNAL");
      } else if (retcode == NRFX_ERROR_INVALID_ADDR) {
        LOG_INF(" NRFX_ERROR_INVALID_ADDR");
      }
      k_sleep(K_SECONDS(1));
  }

Parents Reply Children
  • If the error register is 0x00000001, it means that it is an overrun error. Meaning that a new byte (bit actually) is received while the old is still in the RXD register. So you need to read it out to keep on top of the buffer. Did you consider to use an event based UART instead of reading it out manually? For reference, you can see the peripheral_uart example found in NCS\nrf\samples\bluetooth\peripheral_uart.

    I will be out of office for the next couple of weeks, so if you have any follow up questions, it may be better to create a new ticket. You can link to this one for reference, but the new ticket will be assigned to someone who is working the next weeks.

    Best regards,

    Edvin

Related