Skip to main content
SEphr
Associate
March 11, 2020
Solved

WAKEUP not working in SPC560B

  • March 11, 2020
  • 2 replies
  • 1045 views

I am using SPC560B microcontroller, I want to program in such a way that the module should produce a wakeup interrupt ever 0.1S once. What is the value to be loaded in RTCVAL field in the RTCC register for 0.1s interrupt.

I have used a clock source of 128KHZ. So, to get the 0.1s interrupt the RTCVAL loaded 12800

void ConfigureWKPU(void) {

 /* Enable WKPU PCTL */

 SPCSetPeripheralClockMode(69,

 SPC5_ME_PCTL_RUN(2) | SPC5_ME_PCTL_LP(3));

 INTC_PSR(46) = 7;

 WKUP.WRER.R = (1U << 1);                    // enable wakeup pin of:\n

 WKUP.WIREER.R = (1U << 1);                   // enable rising edge interrupt

 WKUP.WISR.R = 0xFFFFFFFFU;       // clear interrupt flags that an external rs

 WKUP.IRER.R=0xFFFFFFFFU;

 WKUP.WIPUER.R=0xFFFFFFFFU;

}

void ConfigureAPI(void){

 /* Enable RTC */

 SPCSetPeripheralClockMode(91,

 SPC5_ME_PCTL_RUN(2) | SPC5_ME_PCTL_LP(3));

  RTC.RTCC.B.CNTEN =0U ;                        //counter reset and stop

 RTC.RTCS.B.RTCF=1U;

 RTC.RTCC.B.CLKSEL = 1U ;                     //selected the 128Khz clock source

 RTC.RTCC.B.DIV32EN= 0U;                     //Divide clock for 32 is not used

 RTC.RTCC.B.DIV512EN = 0U;                     //divide clock for 512

 RTC.RTCC.B.RTCVAL=(uint16_t)(12800);      //=12.8K/128KHz=0.1 sec*

 RTC.RTCC.B.RTCIE=1U;

}

But the interrupt is not hitting the ISR. Can u help in getting the issue solved.

Thanks

    This topic has been closed for replies.
    Best answer by Erwan YVIN

    Hello ,

    there a nice example in the Application Wizard

    Have you tried SPC560Dxx_RLA WKPU API Test Application for Discovery ?

    Best regards

    Erwan

    2 replies

    SEphr
    SEphrAuthor
    Associate
    March 13, 2020

    @Erwan YVIN​  can you please help me with the above issue

    Erwan YVIN
    Erwan YVINBest answer
    ST Employee
    March 17, 2020

    Hello ,

    there a nice example in the Application Wizard

    Have you tried SPC560Dxx_RLA WKPU API Test Application for Discovery ?

    Best regards

    Erwan