Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

please clarify UART / UART0 in SDK

in sdk_config.h  it says this

// <e> NRFX_UART_ENABLED - nrfx_uart - UART peripheral driver
//==========================================================
#ifndef NRFX_UART_ENABLED
#define NRFX_UART_ENABLED 1
#endif
// <o> NRFX_UART0_ENABLED - Enable UART0 instance 
#ifndef NRFX_UART0_ENABLED
#define NRFX_UART0_ENABLED 0
#endif
on page 24 of the nRF52832 datasheet, it seems that UART and UARTE cannot both be used (they share the same ID). Is this correct? effectively only one UART on this device? and then what do UART and UART0 refer to in the sdk config?
thank you
  • Hi

    Indeed, the nRF52832 only has one UART/UARTE instance available, so you will have to choose one or the other. The reason there is both NRFX_UART_ENABLED and NRFX_UART0_ENABLED is that we have SoCs that have more instances, and the NRFX_UART_ENABLED define only enables the UART peripheral driver, while NRFX_UART0_ENABLED must be set to 1 to enable the instance as well, as the UART_ENABLED define does not set this.

    Best regards,

    Simon

  • thank you Simon. What do you mean by "NRFX_UART_ENABLED define only enables the UART peripheral driver, while NRFX_UART0_ENABLED must be set to 1 to enable the instance as well"?

    what do you mean by the "driver"and the "instance" - are they not basically the same thing? (Ok typically you create an instance in your code and instantiate it in the driver?)

    but the botttom line is both should be enabled? (we have code running that has only one, it does seem to work, although we have some issues we are working on ...)

  • Hi

    I understand the confusion, but no these defines aren't exactly the same. As the driver ENABLE define won't specify what instance to use in the UART drivers/libraries of the SDK. Both NRFX_UART_ENABLED and NRFX_UART0_ENABLED should be set to 1.

    Our example projects in the nRF5 SDK use the UART_ENABLED and UART0_ENABLED defines by default, as they use the nrf_drv_uart driver to enable the UART and UART instance by default. 

    Best regards,

    Simon

  • ok! I will take that advice! thank you! all the best.

Related