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
  • Hello,

    What HW are you using to replicate this error? Is it a DK? If so, is there a way for me to reproduce what you are seeing? Can you please zip the project and upload it here, so that I can test?

    Marcel said:
    so I have removed the k_sleep() call from line 30 and the TX works great now

    You mean the RX, right?

    Did you try to look into nrfx_uarte_rx() to see why/where it returns NRFX_ERROR_INTERNAL? Is it returned from line 555 in nrfx_uarte.c? If so, what is the error in the UART peripheral register? Try to read it using the command "nrfjprog --memrd 0x40002480" (given that you are using the nRF52811, as you stated in the tags in this case).

    best regards,

    Edvin

  • Its a custom nrf52811 board with external xtals (HF, LF)

    removing the k_sleep() indeed worked for a special situations, but im hitting the problem in interrupt based uarte config again 

    im getting NRFX_UARTE_EVT_ERROR from uarte event handler

    CONFIG_PN is enabled
    Ill post the code to you via PM
  • 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