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

Reply
  • 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

Children
Related