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?

Parents
  • Update on code (see earlier post) run:

    nrfx_uarte_init log result:
    <wrn> NRFX_UARTE: Function: nrfx_uarte_init, error code: NRFX_SUCCESS.
    nrfx_uarte_tx log result:
    <inf> NRFX_UARTE: Transfer tx_len: 40.
    <inf> NRFX_UARTE: Function: nrfx_uarte_tx, error code: NRFX_SUCCESS.
    Data is transmitted OK.
    The next statement in the debugger is not executed, a manual break in the debugger shows running in function uarte_nrfx_isr_int, uarte_handler is never addressed.
    NRFX_UARTE_DEFAULT_CONFIG() with nRF9160-dk pin configuration instead of NRF_UARTE_PSEL_DISCONNECTED does not give another result.
    Any idea what might be the reason? Configuration issue?
  • Hi Elbert,

    Are uart(e) related things enabled in the config file?

    // nrfx_config.h
    #define NRFX_UARTE_ENABLED 1
    #define NRFX_UARTE0_ENABLED 1

    Can you please present your config file here to analyse uart stuff is enabled.

    I don't see the interrupt being set nor the handler?
    I don't see the flow control being enabled/disabled

    My uart c++ class has this inside:

    /** Setup the pins. */
    uarte_modem_config.pseltxd = tx_pin;
    uarte_modem_config.pselrxd = rx_pin;
    uarte_modem_config.pselcts = NRF_UARTE_PSEL_DISCONNECTED;
    uarte_modem_config.pselrts = NRF_UARTE_PSEL_DISCONNECTED;
    uarte_modem_config.baudrate = IntegerToBadurate ( baudrate );
    uarte_modem_config.hwfc = NRF_UARTE_HWFC_DISABLED;
    uarte_modem_config.parity = NRF_UARTE_PARITY_EXCLUDED;
    uarte_modem_config.interrupt_priority = 2; ///< TODO Make configurable.
    uarte_modem_config.p_context = this;

    assert ( uarte_modem_config.baudrate != -1 );
    nrfx_uarte_init ( &uarte_drv_, &uarte_modem_config, &Uart::uartEventHandler );
    nrfx_uarte_rx ( &uarte_drv_, NextRxBuffer (), 1 );
    nrf_uarte_enable ( uarte_drv_.p_reg ); 



    Best regards,
       nRF5FanBoy

  • 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

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

Children
No Data
Related