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

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

  • 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

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

Children
  • then

    err_code = nrf_libuarte_async_init(&libuarte, &nrf_libuarte_async_config1, uart_event_handler1, (void *)&libuarte);

    void uart_event_handler1(void * context, nrf_libuarte_async_evt_t * p_evt)
    {
        
    }    

    ?

  • Please correct me, it's not responding when I run libuarte1 :

    NRF_LIBUARTE_ASYNC_DEFINE(libuarte, 0, 0, 0, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 255, 3);
    NRF_LIBUARTE_ASYNC_DEFINE(libuarte1, 1, 0, 0, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 255, 3);
    
    
    nrf_libuarte_async_config_t nrf_libuarte_async_config = {
                .tx_pin     = TX_PIN_NUMBER,
                .rx_pin     = RX_PIN_NUMBER,
                .baudrate   = NRF_UARTE_BAUDRATE_115200,
                .parity     = NRF_UARTE_PARITY_EXCLUDED,
                .hwfc       = NRF_UARTE_HWFC_DISABLED,
                .timeout_us = 100,
                .int_prio   = APP_IRQ_PRIORITY_LOW
        };
            
            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_9600,
                .parity     = NRF_UARTE_PARITY_EXCLUDED,
                .hwfc       = NRF_UARTE_HWFC_DISABLED,
                .timeout_us = 100,
                .int_prio   = APP_IRQ_PRIORITY_LOW
        };
    
    
    err_code = nrf_libuarte_async_init(&libuarte, &nrf_libuarte_async_config, uart_event_handler, (void *)&libuarte);
            err_code = nrf_libuarte_async_init(&libuarte1, &nrf_libuarte_async_config1, uart_event_handler1, (void *)&libuarte1);

  • Hi,

    Have you enabled the second instance of the UARTE in the config file?  

    RixtronixLAB said:
    it's not responding when I run libuarte1

     Be more specific. What exactly happens? What does the init function return? Use the debugger and see if the application asserts somewhere. 

    regards

    Jared 

  • How can I implement this app with libuarte ?

    \nRF5_SDK_15.2.0_9412b96\examples\peripheral\serial_uartes

    thanks

Related