3 Replies Latest reply on May 12, 2017 3:55 AM by bharadhwajas_91

    S6E1C3 RTC Irq Handler (PDL 2.1.0, PSoC Creator 4.0)



      I have some issues when trying to use interrupts from the RTC module. After configuring configuring properly the module by activating timer interrupt, then initializing the RTC and starting the timer, I'm strictly unable to trigger the interrupt.


      After digging in the generated code, I found that in case of Type 3 - FM0+, the Rtc_IrqHandler() function isn't called anywhere.


      By looking at the file interrupts_fm0p_type_3.c, the function WC_RTC_DT_IRQHandler(void) which is supposed to call Rtc_IrqHandler is not defined as PDL_INTERRUPT_ENABLE_RTC0 is not tested (line 1055).


      I tried to add it manually without any success - is it a bug in PDL, or am I missing something when configuring the RTC module ?


      There is no code example for the S6E1C3 with RTC, so I tried to use one for a Type 1 which has the same RTC configuration, again no luck



        • 1. Re: S6E1C3 RTC Irq Handler (PDL 2.1.0, PSoC Creator 4.0)

          Wow I finally got it - seems that asking the question out loud helps to find the answer !


          Together with the missing test of PDL_INTERRUPT_ENABLE_RTC0 in interrupts_fm0p_type_3.c, there is also some errors in rtc.c file in RTCInitNvic function which enables TIM_IRQn (IRQ 14)  instead of WC_RTC_DT_IRQn (IRQ 15)


          Hope it helps anyone trying to make RTC interrupts working on the S6E1C3 !



          • 2. Re: S6E1C3 RTC Irq Handler (PDL 2.1.0, PSoC Creator 4.0)

            To conclude, here is a summary of the changes I've made to make it work :

            /* Changes to make RTC interrupts working :  rtc.c, lines 254 - 256     NVIC_ClearPendingIRQ(WC_RTC_DT_IRQn);     NVIC_EnableIRQ(WC_RTC_DT_IRQn);     NVIC_SetPriority(WC_RTC_DT_IRQn, PDL_IRQ_LEVEL_DT_RTC_WC);  rtc.c lines 286 - 288     NVIC_ClearPendingIRQ(WC_RTC_DT_IRQn);     NVIC_DisableIRQ(WC_RTC_DT_IRQn);     NVIC_SetPriority(WC_RTC_DT_IRQn, PDL_DEFAULT_INTERRUPT_LEVEL);  interrupts_fm0p_type_3.c, lines 1053 - 1056 #if (PDL_ON == PDL_INTERRUPT_ENABLE_WC) || \     (PDL_ON == PDL_INTERRUPT_ENABLE_RTC) || \     (PDL_ON == PDL_INTERRUPT_ENABLE_RTC0) || \    (PDL_ON == PDL_INTERRUPT_ENABLE_DT0)  interrupts_fm0p_type_3.c, lines 1083 - 1084         #if (PDL_ON == PDL_INTERRUPT_ENABLE_RTC) || \             (PDL_ON == PDL_INTERRUPT_ENABLE_RTC0) */

            Unfortunately, I think it is to be done for every code generation...



            • 3. Re: S6E1C3 RTC Irq Handler (PDL 2.1.0, PSoC Creator 4.0)

              Hi Bylos,


              I will bring this the notice of our PDL team.