examples\ble_peripheral\ble_app_uart - PREPROCESSORS not being defined as expected

Hi, i am working on the example - examples\ble_peripheral\ble_app_uart from nRF SDK 17.1.0 using SES. I intend to use it on nRF52840 KD (pca10056 s140).

At first I started working with SES 6.34a. Since I needed a quick ramp up, after getting troubled by the SEGGER_RTT issues similar to nrf5-sdk-17-1-0-examples-is-not-compiling-in-latest-ses-6-20a , I decided to use SES 5.60. 

It was straight-forward to use this SES version and build and download the example, which I required. But after downloading, the Advertisement LED wasn't blinking. An issue similar to this ble-app-uart-example-not-running-after-flashing, as mentioned there entering debug mode enabled the Adverstisement to start.

Now, my intention is to use this example and branch out for adding more features, which is not necessary to be explained here. So, for the new project, I moved this examples\ble_peripheral\ble_app_uart out of the examples folder - I update the paths in the ble_app_uart_pca10056_s140.emProject file. Then building the project threw the following error: 

Comparing with the successfully build example in the SDK folder, gave me the hint that, in nrf_drv_uart.h the preprocessor NRF_DRV_UART_WITH_UART undefined.

#if defined(UART_PRESENT) && NRFX_CHECK(NRFX_UART_ENABLED)
    #define NRF_DRV_UART_WITH_UART
#endif

But NRF_DRV_UART_WITH_UART must be  defined as UART_PRESENT (in nrf52840_peripherals.h) and  

/* Universal Asynchronous Receiver-Transmitter */
#define UART_PRESENT

NRFX_UART_ENABLED (in sdk_config.h) are defined and set respectively.

// <e> NRFX_UART_ENABLED - nrfx_uart - UART peripheral driver
//==========================================================
#ifndef NRFX_UART_ENABLED
#define NRFX_UART_ENABLED 1
#endif

I suspect, this issue is similar to apply_old_config-h-not-working-as-expected.

Unfortunately, I haven't found a reliable solution/ work around for this. I would appreciate a lot if you could give a coherent response, as I am in fast prototyping stage four research.

Best regards,

Lal

  • Hi Lal,

    Have you cleaned and rebuilded your project after moving from SES 6.20 to 5.60?

    If not, I would recommend you start with an unmodified ble_app_uart example, apply your necessary location change configurations, and build from a clean state with SES v5.60.

    Another thing to check is, have you cleaned the flash memory before flashing your sample? If not, please do that.

    I use the ble_app_uart fairly regularly and it does not require any modification like you are doing.

    The threads you linked are also for older versions of the SDK. If I remember correctly, the legacy driver integration, for example, has changed quite much between v15.0.0 and v17.1.0, so the information might not be applicable. I still suspect the "mixed compiler build" to be the issue.

    Best regards,

    Hieu

  • Hi Hieu,

    thanks for your reply.

    Yes I did a clean build and also tried with a clean falsh. No difference.

    ble_app_uart works fine, when I try to compile it from the examples.

    As I mentioned above this build error is coming up when building at different location ( with correct paths); other examples are working fine with this location.

    To keep the doubt simple:

    a. is there somewhere other than sdk_config.h, the preprocessor UART_ENABLED ?

    b. If not why apply_old_config.h doesn't recognize UART_ENABLED as set even if it is in sdk_config.h?

    c. Very similarly why would NRFX_CHECK(NRFX_UART_ENABLED) is FALSE even though NRFX_UART_ENABLED is 1 in sdk_config.h?

    I will be very thankful for your answers.

    Bests,

    Lal

  • Hi Lal,

    maveli said:
    a. is there somewhere other than sdk_config.h, the preprocessor UART_ENABLED ?

    No, it should only be defined there. You can search the entire SDK file content to confirm this.

    maveli said:
    b. If not why apply_old_config.h doesn't recognize UART_ENABLED as set even if it is in sdk_config.h?

    Is there a symptom that makes you think so? If it is the IDE UI, sometimes it just doesn't unravel the preprocessor correctly.

    maveli said:
    c. Very similarly why would NRFX_CHECK(NRFX_UART_ENABLED) is FALSE even though NRFX_UART_ENABLED is 1 in sdk_config.h?

    apply_old_config.h can set it to 0 depends on other configurations. Are you absolutely sure you didn't change anything other than paths in the project file?

    Regards,

    Hieu

  • Hi Hieu, thank you very much for your quick reply.

    GOT it solved !!!

    The path to sdk_config.h was pointing to "nRF5_SDK_17.1.0_ddde560\config\nrf52840\config" not to the example specific "examples\ble_peripheral\ble_app_uart\pca10056\s140\config"

    Thanks again and best regards,

    Lal

  • Hi Lal,

    I feel like I hardly help at all. Glad you got it working!

    Enjoy coding!

    Hieu

Related