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

Adding UARTE1 to CLI OpenThread Example

Hi everyone,

I wanted to add a second UART (UARTE1) to the CLI example in the OpenThread SDK 0.10.0 since UART0 is used by CLI but I was not able to find any documentation on using two UARTs at the same time other than a clue in the header file "app_uart.h" where it states:

"[app_uart_init(...)]: Function for initializing the UART module. Use this initialization when several instances of the UART module are needed."

Does this mean you initiate the UART twice using the above function? Another question I have is can the CLI example have multiple UARTs (I noticed a macro flag '-DUART_ENABLED=0' and was wondering if UART settings are to be disabled fully from the user's control)?

Any help would be greatly appreciated.

Thank you.

Parents
  • Hi, As you already noticed, OpenThread CLI uses UART0 and that cannot be changed without modyfing OpenThread driver and rebuilding libraries.

    You should be able though to use UARTE1 with app_uart in OpenThread CLI as a secondary UART. Unfortunately OpenThread CLI example does not provide app_uart support by default, so you will have to add app_uart and nrf_drv_uart manually to the project. You can use UART peripheral example as a reference. Make sure to copy respective configuration from sdk_config.h as well.

    Keep in mind, that you have to modify default sdk_config.h configuration. Disable UART0 in nrf_drv_uart by setting UART0_ENABLED 0, as this peripheras is owned by OpenThread driver. To enable UARTE1 in app_uart, set UART1_ENABLED 1 and APP_UART_DRIVER_INSTANCE 1. When initializing app_uart make sure to use other pins than UART0 does.

    The last thing is to remove -DUART_ENABLED=0 from the makefile, as we do want to use the UART driver from SDK now.

  • OpenThread CLI uses hardware pins 6 and 8 for UART communication, which are connected to SEGGER J-LINK chip on the development board, which in turn enables to communicate with PC through USB. If you want to use another instance of UART, you need to choose other, unused pins to initialize the UART instance. In order to communicate with PC thorough that UART, you need an UART-USB converter though.

Reply Children
No Data
Related