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

Pure NRFX RTC code - how to?

Hi,

I'm trying to adopt my nRF52832 projects to the nRF5 SDK version 15.2.0 and the NRFX drivers framework. I'm using a short app_config.h with NRFX_RTC_ENABLED and NRFX_RTC0_ENABLED only. Unfortunately, it won't work because it's locked on the legacy stuff from the integration/nrfx/legacy/apply_old_config.h. Particularly, the following chunk of defs in the apply_old_config.h are enforced to redefine my NRFX_RTC0_ENABLED because sdk_config.h has the default RTC_ENABLED value (defined as 0):

#if defined(RTC_ENABLED)

#undef NRFX_RTC_ENABLED
#define NRFX_RTC_ENABLED  RTC_ENABLED

#if defined(RTC0_ENABLED)
#undef NRFX_RTC0_ENABLED
#define NRFX_RTC0_ENABLED  RTC0_ENABLED
...

What would be the recommended way to enable the pure NRFX RTC without legacy code involved?

Thanks!

Parents
  • Hi,

    I would recommend that you completely remove the legacy RTC config from sdk_config.h if switching to NRFX drivers. 

    Alternatively, you can also make modify apply_old_config.h by only overwriting the settings if the legacy drivers was enabled:

    #if defined(RTC_ENABLED) && (RTC_ENABLED == 1)
    
    #undef NRFX_RTC_ENABLED
    #define NRFX_RTC_ENABLED  RTC_ENABLED

    Best regards,
    Jørgen

  • Hi Jørgen,

    thanks for your reply! I'm using standard unmodified SDK 15.2 config from the config/nrf52832/config/sdk_config.h. All overrides are going into a local app_config.h (-DUSE_APP_CONFIG) - it allows me to keep my codebase clean and portable, and don't bother about changes in the SDK (for example when upgrading it). Therefore there is no legacy configs - only the new shiny NRFX defs.

    Your patch will definitely do its job. Of course I can walk through the apply_old_config.h and patch all definitions. Or is it better to eliminate old definitions with something like this:

    #if defined(NRF_DEV_LEGACY_COMPAT) && (NRF_DEV_LEGACY_COMPAT==1)
    #include <legacy/apply_old_config.h>
    #endif

    In any case hope to see it addressed in the next SDK release :-)

    Thanks!

Reply
  • Hi Jørgen,

    thanks for your reply! I'm using standard unmodified SDK 15.2 config from the config/nrf52832/config/sdk_config.h. All overrides are going into a local app_config.h (-DUSE_APP_CONFIG) - it allows me to keep my codebase clean and portable, and don't bother about changes in the SDK (for example when upgrading it). Therefore there is no legacy configs - only the new shiny NRFX defs.

    Your patch will definitely do its job. Of course I can walk through the apply_old_config.h and patch all definitions. Or is it better to eliminate old definitions with something like this:

    #if defined(NRF_DEV_LEGACY_COMPAT) && (NRF_DEV_LEGACY_COMPAT==1)
    #include <legacy/apply_old_config.h>
    #endif

    In any case hope to see it addressed in the next SDK release :-)

    Thanks!

Children
No Data
Related