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

UARTE multiple instance with new nrfx exam

Hello,

I would like to use the two UARTEs available on nRF52840 with external asynchronous chips.

I've started a new development with the last sdk (15.3.0) and would like to know if there is a clear example on how to initialize the peripherals.

I'd like to use the UARTES on interrupt but I can't figure out how to use the new nrfx drivers.

Best regards,

JY

Parents
  • Hi Jean-Yves

    Have you taken a look at the new nrf_serial driver in nRF5 SDK v15.3.0?

    It is well suited for asynchronous UART devices, and will use the nrfx_uarte driver under the hood. 

    There is an example for this driver in the examples/peripheral/serial folder in the SDK. 

    While this example only uses a single UART, you should be able to register two instances of the driver as long as you enable the required peripherals in the sdk_config.h file. 

    Best regards
    Torbjørn

Reply
  • Hi Jean-Yves

    Have you taken a look at the new nrf_serial driver in nRF5 SDK v15.3.0?

    It is well suited for asynchronous UART devices, and will use the nrfx_uarte driver under the hood. 

    There is an example for this driver in the examples/peripheral/serial folder in the SDK. 

    While this example only uses a single UART, you should be able to register two instances of the driver as long as you enable the required peripherals in the sdk_config.h file. 

    Best regards
    Torbjørn

Children
  • Hi,

    thank you for your answer.

    Yes, I had more than a look on the examples you mentionned but I'm turning arround.

    Shall I inspire myself from app_uart_fifo.c and rewrite it to be multi Uart ?

    During my tests, I discovered that the exmaple works the same whatever I configure in sdk_config.h.

    i.e:

    // <e> NRFX_UARTE_ENABLED - nrfx_uarte - UARTE peripheral driver
    //==========================================================
    #ifndef NRFX_UARTE_ENABLED
    #define NRFX_UARTE_ENABLED 0
    #endif
    // <o> NRFX_UARTE0_ENABLED - Enable UARTE0 instance 
    #ifndef NRFX_UARTE0_ENABLED
    #define NRFX_UARTE0_ENABLED 0
    #endif
    
    // <o> NRFX_UARTE1_ENABLED - Enable UARTE1 instance 
    #ifndef NRFX_UARTE1_ENABLED
    #define NRFX_UARTE1_ENABLED 0
    #endif

    // <e> NRFX_UART_ENABLED - nrfx_uart - UART peripheral driver
    //==========================================================
    #ifndef NRFX_UART_ENABLED
    #define NRFX_UART_ENABLED 0
    #endif
    // <o> NRFX_UART0_ENABLED - Enable UART0 instance 
    #ifndef NRFX_UART0_ENABLED
    #define NRFX_UART0_ENABLED 0
    #endif
    

    this shall disable all UART functions no ?

    JY

  • Hi,

    I just realized I work with uart example and not serial example. Sorry for the mistake.

    In this example, modifications in sdk_config.h still doesn't seem's to have any effect on the software behavior.

    Regards,

    JY

  • Hi Jean-Yves

    The reason for this is that the SDK has a 'legacy' layer, that converts the old pre-NRFX defines to the new NRFX defines. 

    In the case of the UART this is the UART0_ENABLED and UART1_ENABLED define that you can also find in sdk_config.h

    If you disable UART0_ENABLED it should cause a build error, and if you enabled UART1_ENABLED you should be able to use both of the UART's. 

    Best regards
    Torbjørn

Related