UARTE

In UART async mode (CONFIG_UART_ASYNC_API=y) the UART transmit data and receive callback works fine. I've been able to set up the callback and enable the rx.

After switching to UARTE (CONFIG_NRFX_UARTE0=y), the UART transmit once, but the event handler is never called.

UARTE is set up like example from: "C:\ncs\v2.0.0\zephyr\samples\boards\nrf\nrfx_prs\src\main.c", the baudrate is set to 9600. nrfx_uarte_init() and nrfx_uarte_tx() show NRFX_SUCCESS. When nrfx_uarte_tx_in_progress() call is added, just after nrfx_uarte_tx(),  nrfx_uarte_tx_in_progress() hangs without any further (log) message.

Is it possible to implement UARTE like this on nRF9160 development board?

Do you need to enable rx on UARTE?

Is there any working sample for nRF9160?

  • Sorry, answer at wrong place, hope it is ok now.

    Hi nRF5FanBoy,

    The uarte configuration as you mention is in my config file the same.

    I have added the configuration of the pins, hardware flow control and parity now. Also added the nrfx_uarte_rx and nrf_uarte_enable (after nrfx_uarte_init ), but without any result. The rx and first tx return success, but the callback is never hit and next tx shows busy.

    It looks like it has something to do with the callback, but how can I figure out what goes wrong?

    Best regards, Elbert

  • Changing interrupt priority (default 7) does not help. UART event handler (callback) is never hit.

    The LOG_DBG statements in the callback are not executed and the global variable the event type is stored never changes. Is it possible to use log statements in UARTE event handler?

    Is there a working nRF9160 UARTE sample?

    Any other suggestions?

  • prj.conf contains the configuration option CONFIG_UART_ASYNC_API=y.

    This option is also present in the .config output file after pristine build. Other options in the .config are CONFIG_UART_0_NRF_UARTE=y and CONFIG_NRF_UARTE_PERIPHERAL=y.

    Does this mean that it is NOT necessary to use prj.conf CONFIG_NRFX_UARTE0=y to enable UARTE mode?

    If so, can I use the standard functions (to set up the callback routine and enable the uart rx) and be in UARTE mode?

    How can I verify running in UARTE mode?

  • This is the used overlay file:

    /*
     * Copyright (c) 2021 Nordic Semiconductor ASA
     *
     * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
     */
    
    /* Disable uart1 in nonsecure since it is used by the TFM secure app. */
    &uart1 {
    	status = "disabled";
    };
    
    /* Console uart0 baudrate 9600 */
    &uart0 {
        current-speed = < 9600 >;
    };
    
    / {
        aliases {
            console-uart = &uart0;
        };
    };

Related