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

RTC1 Initialisation with soft device

I am building my application up on the blinky free rtos. I want to use RTC and ble stack. i am initialising RTC1 first and ble stack stact.

The problem is that I am getting 0x1001 error code (which stands for "Incorrect interrupt configuration") from softdevice_handler_init() if I initialize soft device after the nrf_drv_rtc_init().

I didn't face any problem with the nRF5_SDK_11.0.0-2.alpha_bc3f6a0, problem is coming with nRF5_SDK_11.0.0_89a8197 only.

Thanks in advance!

  • What do you mean by 'SystemCore Clock'? Do you mean SysTick? Which chip are you using, nRF51 or nRF52? Systick doesn't tick when the device sleeps so that won't work, the RTOS ports for nRF5x use RTC1 because nRF51 doesn't have Systick and nRF52 does but it's not usable as an always-on timer.

    RTC2_CONFIG_IRQ_PRIORITY is a define, what have you defined it as?

  • Sorry SysTick, I am using nrF52.

    RTC2_CONFIG_IRQ_PRIORITY has low priority. It defined in nrf_drv_config.h

  • Systick won't work - not if you sleep the chip at all, you should use one of the nRF52 ports if you want FreeRTOS to work properly.

    What is the numerical value of the IRQ priority, what actual number are you using? I keep asking you this, I can't see your nrf_drv_config.h file.

    Similarly what priorities has the RTOS set for other peripherals, if it's set Systick to a high interrupt priority - that won't work either. I suggest dumping the contents of the NVIC enabled and priority registers just before the softdevice enable call and finding what's enabled and what priorities they have. The error message is pretty clear - one of your interrupt priorities at least is wrong, you just need to look at them all and find out which one.

  • .. actually looking at the nRF52 FreeRTOS port I'm not entirely sure what it does use as a timer source. The notes don't say, it does define the portable systick macro as RTC1 as the nrf51 port does but without following all the includes I can't work out whether it manages to use systick after all. I don't quite see how it does, as Systick doesn't tick when the processor sleeps, which means there's nothing to wake tasks.

  • The freertos in our SDK uses RTC1 as a tick clock. From portmacro_cmsis.h line 120:

    /* RTC register */
    #define portNRF_RTC_REG        NRF_RTC1
    

    By using the RTC instead of Systick, we can implement tickless idle mode.

    Are you using the freertos port provided in our SDK, or have you made your own port?

    @RK, in my config the i have the following definition of RTC2_CONFIG_IRQ_PRIORITY: APP_IRQ_PRIORITY_LOW =_PRIO_APP_LOW = 6

Related