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 

  • 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
        };
            
            
        nrf_libuarte_async_init(&libuarte, &nrf_libuarte_async_config, uart_event_handler, (void *)&libuarte);
            APP_ERROR_CHECK(err_code);
            nrf_libuarte_async_init(&libuarte1, &nrf_libuarte_async_config1, uart_event_handler1, (void *)&libuarte1);
            APP_ERROR_CHECK(err_code);
    
    
    

    Correct me ?

Reply
  • 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
        };
            
            
        nrf_libuarte_async_init(&libuarte, &nrf_libuarte_async_config, uart_event_handler, (void *)&libuarte);
            APP_ERROR_CHECK(err_code);
            nrf_libuarte_async_init(&libuarte1, &nrf_libuarte_async_config1, uart_event_handler1, (void *)&libuarte1);
            APP_ERROR_CHECK(err_code);
    
    
    

    Correct me ?

Children
No Data
Related