Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF58232/SDK15 Where can I find sample code to use NRFX_UARTE ?

Hi,

I'm looking for an example of how NRFX_UARTE works.

I would like to set up a serial port with EasyDMA to send and receive a thirty bytes.

Thanks in advance for your help.

Best regards, 

Parents
  • Hi awneil,

    Thanks for your answer but I don't want send and receive bytes by BLE, just with serial port. 

    I need to use UARTE, not BLE Service NUS.

  • Hi Hakon,

    Thanks for your help.

    For disabling nrfx, I need to modify sdk_config.h and not included nrfx_uarte.h ?

    I need to include just "nrf_uarte.h" ?

    How to create UARTE0_UART0_IRQ in my main software ?

    Sorry for all these questions, but I feel like going round with all these UART driver ...

    Best regards,

  • You need to edit your sdk_config.h file, and set:

    #define NRFX_UARTE_ENABLED 0
    and
    #define NRFX_UART_ENABLED 0
     
    After this, you implement your interrupt handler:
     
    Fullscreen
    1
    2
    3
    4
    void UARTE0_UART0_IRQHandler(void)
    {
    // Code
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
     
     
    Best regards,
    Håkon
  • Ok.

    I include only "nrf_uarte.h"

    and with void UARTE0_UART0_IRQHandler(void) I have an error : 

    1> main.o: In function `UARTE0_UART0_IRQHandler':
    1> main.c:729: multiple definition of `UARTE0_UART0_IRQHandler'
    1> Nordic_BLE\nRF5_SDK_15.0.0\modules\nrfx\drivers\src/nrfx_uarte.c:571: first defined here

    If I keep NRFX_PRS_ENABLED = 1 and NRFX_PRS_BOX_4_ENABLED 1, I have an error : 

    1> main.o: In function `UARTE0_UART0_IRQHandler':
    1> main.c:728: multiple definition of `UARTE0_UART0_IRQHandler'
    1> Nordic_BLE\nRF5_SDK_15.0.0\modules\nrfx\drivers\src\prs/nrfx_prs.c:81: first defined here

  •  

    Did you set this in your sdk_config.h file and re-compile the whole project (clean first, then build)?

    #define NRFX_UARTE_ENABLED 0

     

    The first error is because nrfx_uarte.c is still enabled, and the second is due to the "nrfx_prs" library being used by nrfx_uarte is in use.

     
     
    Best regards,
    Håkon
  • I have : 

    NRFX_UARTE_ENABLED 0

    NRFX_UARTE0_ENABLED 0

    NRFX_UART_ENABLED 0

    NRFX_UART0_ENABLED 0

    UART_ENABLED 1

    UART_EASY_DMA_SUPPORT 1

    UART_LEGACY_SUPPORT 0

    UART0_ENABLED 1

    UART0_CONFIG_USE_EASY_DMA 1

    NRFX_PRS_ENABLED 1

    NRFX_PRS_BOX_4_ENABLED 1

Reply
  • I have : 

    NRFX_UARTE_ENABLED 0

    NRFX_UARTE0_ENABLED 0

    NRFX_UART_ENABLED 0

    NRFX_UART0_ENABLED 0

    UART_ENABLED 1

    UART_EASY_DMA_SUPPORT 1

    UART_LEGACY_SUPPORT 0

    UART0_ENABLED 1

    UART0_CONFIG_USE_EASY_DMA 1

    NRFX_PRS_ENABLED 1

    NRFX_PRS_BOX_4_ENABLED 1

Children
  • Could you try to remove the nrfx_uarte.c and nrfx_prs.c from your project and see if it works then?

  • Thank you, it seems to work now. I test it all and come back here to say if everything is ok.
    I will not have compatibility problems with future SDKS?

  • Glad to hear that it works now.

    A general rule is that as long as you do not add or use any modules that depends on the UART peripheral, it should be fine. As you're doing a bare-metal implementation, it is _very unlikely_ that the register definitions will ever change for the current device that you are using.

    However; I cannot guarantee that a module that you require in the future does not depend on the UART in some way (for logging or similar).

     

    Best regards,

    Håkon

  • Many thanks for your help. I think I can do what I want now.

    Ok for the compatibility, I understand.