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

lfclk, rtc issue on SDK13

I am trying to set up RTC2 by following an example github.com/.../saadc_low_power I ported it to my project which is running a softdevice on nRF52. It works perfectly fine on SDK11 but has problems on SDK13.0 / 13.1. Seems like nrf_drv_clock_init() or nrf_drv_rtc_init() has conflict with the BLE stack. Any idea what has changed from SDK11 to SDK13?

Parents
  • I have the same problem with SDK 14.1. If I initialize CLOCK and RTC driver before BLE stack I have an error in return of nrf_sdh_enable_request():

    <error> app: ERROR 4097 [Unknown error code] 
    

    If I initialize BLE stack first, I can initialize CLOCK (nrf_drv_clock_init()) but RTC initialization fails (nrf_drv_rtc_init()) with the error:

    <error> app: SOFTDEVICE: INVALID MEMORY ACCESS
    

    RTC section of sdk_config.h:

    // <e> RTC_ENABLED - nrf_drv_rtc - RTC peripheral driver
    //==========================================================
    #ifndef RTC_ENABLED
    #define RTC_ENABLED 1
    #endif
    // <o> RTC_DEFAULT_CONFIG_FREQUENCY - Frequency  <16-32768> 
    
    
    #ifndef RTC_DEFAULT_CONFIG_FREQUENCY
    #define RTC_DEFAULT_CONFIG_FREQUENCY 32768
    #endif
    
    // <q> RTC_DEFAULT_CONFIG_RELIABLE  - Ensures safe compare event triggering
     
    
    #ifndef RTC_DEFAULT_CONFIG_RELIABLE
    #define RTC_DEFAULT_CONFIG_RELIABLE 0
    #endif
    
    // <o> RTC_DEFAULT_CONFIG_IRQ_PRIORITY  - Interrupt priority
     
    
    // <i> Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice
    // <0=> 0 (highest) 
    // <1=> 1 
    // <2=> 2 
    // <3=> 3 
    // <4=> 4 
    // <5=> 5 
    // <6=> 6 
    // <7=> 7 
    
    #ifndef RTC_DEFAULT_CONFIG_IRQ_PRIORITY
    #define RTC_DEFAULT_CONFIG_IRQ_PRIORITY 7
    #endif
    
    // <q> RTC0_ENABLED  - Enable RTC0 instance
     
    
    #ifndef RTC0_ENABLED
    #define RTC0_ENABLED 0
    #endif
    
    // <q> RTC1_ENABLED  - Enable RTC1 instance
     
    
    #ifndef RTC1_ENABLED
    #define RTC1_ENABLED 0
    #endif
    
    // <q> RTC2_ENABLED  - Enable RTC2 instance
     
    
    #ifndef RTC2_ENABLED
    #define RTC2_ENABLED 1
    #endif
    
    // <o> NRF_MAXIMUM_LATENCY_US - Maximum possible time[us] in highest priority interrupt 
    #ifndef NRF_MAXIMUM_LATENCY_US
    #define NRF_MAXIMUM_LATENCY_US 2000
    #endif
    
Reply
  • I have the same problem with SDK 14.1. If I initialize CLOCK and RTC driver before BLE stack I have an error in return of nrf_sdh_enable_request():

    <error> app: ERROR 4097 [Unknown error code] 
    

    If I initialize BLE stack first, I can initialize CLOCK (nrf_drv_clock_init()) but RTC initialization fails (nrf_drv_rtc_init()) with the error:

    <error> app: SOFTDEVICE: INVALID MEMORY ACCESS
    

    RTC section of sdk_config.h:

    // <e> RTC_ENABLED - nrf_drv_rtc - RTC peripheral driver
    //==========================================================
    #ifndef RTC_ENABLED
    #define RTC_ENABLED 1
    #endif
    // <o> RTC_DEFAULT_CONFIG_FREQUENCY - Frequency  <16-32768> 
    
    
    #ifndef RTC_DEFAULT_CONFIG_FREQUENCY
    #define RTC_DEFAULT_CONFIG_FREQUENCY 32768
    #endif
    
    // <q> RTC_DEFAULT_CONFIG_RELIABLE  - Ensures safe compare event triggering
     
    
    #ifndef RTC_DEFAULT_CONFIG_RELIABLE
    #define RTC_DEFAULT_CONFIG_RELIABLE 0
    #endif
    
    // <o> RTC_DEFAULT_CONFIG_IRQ_PRIORITY  - Interrupt priority
     
    
    // <i> Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice
    // <0=> 0 (highest) 
    // <1=> 1 
    // <2=> 2 
    // <3=> 3 
    // <4=> 4 
    // <5=> 5 
    // <6=> 6 
    // <7=> 7 
    
    #ifndef RTC_DEFAULT_CONFIG_IRQ_PRIORITY
    #define RTC_DEFAULT_CONFIG_IRQ_PRIORITY 7
    #endif
    
    // <q> RTC0_ENABLED  - Enable RTC0 instance
     
    
    #ifndef RTC0_ENABLED
    #define RTC0_ENABLED 0
    #endif
    
    // <q> RTC1_ENABLED  - Enable RTC1 instance
     
    
    #ifndef RTC1_ENABLED
    #define RTC1_ENABLED 0
    #endif
    
    // <q> RTC2_ENABLED  - Enable RTC2 instance
     
    
    #ifndef RTC2_ENABLED
    #define RTC2_ENABLED 1
    #endif
    
    // <o> NRF_MAXIMUM_LATENCY_US - Maximum possible time[us] in highest priority interrupt 
    #ifndef NRF_MAXIMUM_LATENCY_US
    #define NRF_MAXIMUM_LATENCY_US 2000
    #endif
    
Children
Related