This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Using UARTE0 and UARTE1 in different pins ?

Dear Members,

I saw this example,

https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.2.0%2Fserial_uartes_example.html

I can not find this example on SDK 17,

How can I use UARTE0 and UARTE1 on separate port ? one is for debugging via USB and the other one for communicating with GPS UART ?

Any suggestions ?

Thanks

  • Hi,

    The Serial port library has been deprecated and has been replaced with the libUARTE module. We have a libUARTE example in the SDK that only uses one instance but clearly shows how to define an instance and initialize it. It should be possible to repeat this for a second UARTE instance. If you want to use two UARTE instances then you have to enable both instances in the config file and resources that the module is dependent on ( Timer and PPI) . Next you have to define an instance of the module and initialize it in the project.

    regards

    Jared 

  • Hi Jared,

    Thanks for the reply,

    I will learn this libUARTE example and keep posted,

    Is libUARTE in the example working by DMA or interrupt ?

    This example is not working with Softdevice, isn't it ?

    Cheers

  • Hi Jared,

    In my my mind,

    I'm going to use

    #define RX_PIN_NUMBER  8
    #define TX_PIN_NUMBER  6

    with

    NRF_LOG_INFO() function then

    #define SER_APP_RX_PIN              NRF_GPIO_PIN_MAP(1,13)    // UART RX pin number.
    #define SER_APP_TX_PIN              NRF_GPIO_PIN_MAP(1,14)  

    with

    void uart_event_handler calling this function :

     nrf_libuarte_drv_rx_start at nrf_libuarte_drv.h, how can I start and stop ?

    Thanks


       

  • Hi,

    The logging in the example is done over RTT as the UARTE is already in use in the application. The example is a loopback which means that it sends the data back after it has received it.

    A NRF_LIBUARTE_ASYNC_EVT_RX_DATA event is generated each time data is received, while NRF_LIBUARTE_ASYNC_EVT_TX_DONE is generated each time data has been successfully sent. nrf_libuarte_async_tx() is used for transmitting data. 

    The libUARTE module is based on the UARTE peripheral which uses EasyDMA. The example does not use the Softdevice. You can merge it with a SD example such as ble_app_beacon if you also want to use the Softdevice. 

    regards

    Jared 

  • How can I " ... enable both instances in the config file and resources that the module is dependent on " ?

    ?

    like this :

    nrf_libuarte_async_config_t nrf_libuarte_async_config1 = {
                .tx_pin     = SER_APP_TX_PIN,
                .rx_pin     = SER_APP_RX_PIN,
                .baudrate   = NRF_UARTE_BAUDRATE_115200,
                .parity     = NRF_UARTE_PARITY_EXCLUDED,
                .hwfc       = NRF_UARTE_HWFC_DISABLED,
                .timeout_us = 100,
                .int_prio   = APP_IRQ_PRIORITY_LOW
        };

    then on sdk_config.h ?

    Thanks

Related