NRFX UARTE TX failure (using nRF connect SDK v2.1.0)

I am trying to implement a simple uart echo test using nRF21540 DB board, but I always get NRFX_ERROR_FORBIDDEN when trying to transmit.

This is the initialization code:

    nrfx_uarte_t        uarteInstance = NRFX_UARTE_INSTANCE( 1 );
    
    uarteConfig.pseltxd = nRF52Host_TX_DBG;
    uarteConfig.pselrxd = nRF52Host_RX_DBG;
    uarteConfig.pselcts = NRF_UARTE_PSEL_DISCONNECTED;
    uarteConfig.pselrts = NRF_UARTE_PSEL_DISCONNECTED;
    uarteConfig.p_context = NULL;
    uarteConfig.baudrate = NRF_UARTE_BAUDRATE_9600;
    uarteConfig.interrupt_priority = NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY;
    uarteConfig.hal_cfg.hwfc = NRF_UARTE_HWFC_DISABLED;
    uarteConfig.hal_cfg.parity = NRF_UARTE_PARITY_EXCLUDED;
    uarteConfig.hal_cfg.stop = NRF_UARTE_STOP_ONE;
    uarteConfig.skip_gpio_cfg = false;
    uarteConfig.skip_psel_cfg = false;
    
    if (nrfx_uarte_init(&uarteInstance, &uarteConfig, NULL) == NRFX_SUCCESS)
    {
        printf("success\r\n");
    }

then trying to transmit using this call, is always returning error:

    static uint8_t test_bytes[4] = {0xA5, 0xA6, 0xA7, 0xA8};

    nrfx_uarte_tx(&uarteInstance, test_bytes, 4);

Is there some configuration I am missing?

Parents
  • Hello,

    Could you please show the entire log where you receive the error code?
    I notice that the nrfx_uarte_tx call does not check its return value. Is this the exact section of the code that returns the error, or could it be returned elsewhere?
    What other peripherals are you using concurrently in your project, are there any other serial interfaces enabled when this happens? If so, which, and which instances are they running on?

    Best regards,
    Karl

  • Hi, thanks for your answer

    This is the log where I get the error code:

    Function: nrfx_uarte_tx, error code: NRFX_ERROR_FORBIDDEN.failed!

    I am checking the error code returned by nrfx_uarte_tx, that´s where I get the error.

    I am using QSPI, SPI and a couple of GPIOs. Then zephyr shell uart is enabled, using UART0.

  • Hugo.Dev said:
    I am trying to use it in blocking mode. But tried providing handler too and it is failing in a different way.

    Could you elaborate on how it fails in this case?

    Hugo.Dev said:
    Talking about blocking mode, I am not triggering TXSTOP. And yes, it happens every time, the call to nrf_uarte_event_check(p_instance->p_reg, NRF_UARTE_EVENT_TXSTOPPED) returns always true

    Are you using the power manager in your application?

    Best regards,
    Karl

  • Providing handler, it halts everything when trying to TX. Shell thread got unresponsive.

    I am not sure about the power management, the only I can see enabled in proj.conf is CONFIG_NRFX_POWER=y

  • Hugo.Dev said:
    Providing handler, it halts everything when trying to TX. Shell thread got unresponsive.

    Halts, without any returned error codes?
    Do you have a minimal example that demonstrates this behavior, that you could share with me, in its entirety, so that I may take a look?

    Hugo.Dev said:
    I am not sure about the power management, the only I can see enabled in proj.conf is CONFIG_NRFX_POWER=y

    Could you share with me your entire prj.conf, and any other overlays that are active in the build configuration here?
    The Power management I referenced in my previous comment is governed by the CONFIG_PM Kconfig.

    Best regards,
    Karl

  • Hi, 

    Attached my proj.conf

    # Enabling assert
    CONFIG_ASSERT=y
    
    # Logger configuration
    CONFIG_LOG=y
    CONFIG_LOG_DEFAULT_LEVEL=3
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_LOG_BACKEND_RTT=y
    CONFIG_LOG_BACKEND_UART=n
    
    # Enable temperature sensor
    CONFIG_NRFX_TEMP=y
    
    # Enable DC/DC Support
    CONFIG_NRFX_POWER=y
    
    # Enable RNG
    CONFIG_NRFX_RNG=y
    # Use XOROSHIRO PRNG
    CONFIG_XOROSHIRO_RANDOM_GENERATOR=y
    
    # Enable Timer
    CONFIG_NRFX_TIMER2=y
    
    # Enabling radio driver
    CONFIG_NRF_802154_RADIO_DRIVER=y
    
    # Allow sharing the RTC between IEEE 802.15.4 and Zephyr
    CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT=2
    
    # Workaround for a bug in the MPSL Glue Layer (not required for nRF52840)
    CONFIG_BT=y
    
    # Enable ring buffers
    CONFIG_RING_BUFFER=y
    
    # Set temperature sensor update period in ms
    CONFIG_NRF_802154_TEMPERATURE_UPDATE_PERIOD=10000
    
    CONFIG_NRF_802154_ENCRYPTION=n
    
    # Shell configuration
    CONFIG_SHELL=y
    CONFIG_SHELL_PROMPT_UART=">"
    CONFIG_SHELL_VT100_COLORS=n
    
    #enable qspi
    CONFIG_NRFX_QSPI=y
    
    #enable spi
    CONFIG_NRFX_SPI0=y
    
    #enable uart
    CONFIG_NRFX_UARTE1=y
    
    # Debug configuration
    CONFIG_DEBUG_OPTIMIZATIONS=y
    CONFIG_DEBUG_THREAD_INFO=y
    
    

    Then, I dont have any custom overlay file.

    My project is using the default nrf52840dk_nrf52840.dts located at ncs\v2.1.0\zephyr\boards\arm\nrf52840dk_nrf52840

  • Hello,

    I can not see anything that should cause this behavior from the prj.conf alone.
    Would it be possible for you to send me a minimal version of this project that replicates this behavior, so that I may take a look at this myself?

    Best regards,
    Karl

Reply Children
No Data
Related