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

Using multiple UART instances with APP_UART[_FIFO]_INIT()

In the documentation for app_uart_init() - there is a statement indicating:

Function for initializing the UART module. Use this initialization when several instances of the UART module are needed.

It is not clear how multiple instances are managed within the app_uart framework. For example, if I want to call nrf_drv_uart_rx_disable() - I need to pass in an nrf_drv_uart_t instance. It is not clear how I would obtain this when using the app_uart framework.

How can I obtain the nrf_drv_uart_t instance from a UART instance created via app_uart_init() ?

Parents
  • Hello Koniho

    First of all I apologise for the very delayed answer.

    The instances mentioned in your quote refers to hardware instances of the UART peripheral. As of today our chips only has one UART instance, UART0.

    On the nRF52840 there are 2 instances of UARTE (UARTE0 & UARTE1), however the app_uart module is hardcoded to use instance 0 through the APP_UART_DRIVER_INSTANCE define in nrf_drv_uart.h which is used as id argument in the NRF_DRV_UART_INSTANCE macro-call in app_uart_fifo.c

    Best regards

    Jørn Frøysa

  • Hi,

    How could I initialise both UARTE0 and UARTE1 instances then? Do I have to modify app_uart_fifo.c? I want to use an UART port for peripheral communication and NRF_LOG simultaneously in another port, but they keep initialising with the same UART instance. 

    Thanks!

Reply Children
No Data
Related