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

What needs to be done to enable the Serial and UARTE features?

Hi!  I am trying to enable UARTE and Serial in my app, but somehow the nrf_serial code is not compiled because it fails the "#if NRF_MODULE_ENABLED(NRF_SERIAL)" test.

How do I select this?  I do not see "NRF_SERIAL" in the sdk_config.h file. I have enabled UARTE and the Queue service.

Thanks!

-Ben Burch

BTR Controls, Inc.

  • In order to use the functions in nrf_serial.h/c, you have to set NRF_SERIAL_ENABLED to 1 in sdk_config.h, then the test "NRF_MODULE_ENABLED(NRF_SERIAL)" will succeed. The reason for this is because the macro NRF_MODULE_ENABLED will append "_ENABLED" at the end of the input and check that configuration:

    #define NRF_MODULE_ENABLED(module) \
        ((defined(module ## _ENABLED) && (module ## _ENABLED)) ? 1 : 0)
    #endif

    Best regards,

    Simon

Related