cancel
Showing results for 
Search instead for 
Did you mean: 

WAKEUP not working in SPC560B

SEphr
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
Erwan YVIN
ST Employee

Hello ,

there a nice example in the Application Wizard

Have you tried SPC560Dxx_RLA WKPU API Test Application for Discovery ?

Best regards

Erwan

View solution in original post

2 REPLIES 2
SEphr
Associate II

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

Erwan YVIN
ST Employee

Hello ,

there a nice example in the Application Wizard

Have you tried SPC560Dxx_RLA WKPU API Test Application for Discovery ?

Best regards

Erwan