cancel
Showing results for 
Search instead for 
Did you mean: 

How do I proceed a wakeup on SPC584Cx/SPC58ECx 32-bit MCU Chorus 4M?

Catalin
Associate

Hello everybody,

My name is Catalin and I work on an Automotive project on a gateway and I have a question regarding this microcontroler.

So basically I have to wakeup the gateway every 600 seconds +/- 15 seconds and perform a voltage measurement. As I read in the reference manual there is this RTC_APIVAL register which its bits are compared to the RTC counter bits and if a match occurs, an wakeup request is asserted. I tried in so many ways to make that work but I didn't manage to do it.

Here is my code so far:

void rtc_init(void)
{
	/*Disable Real Timer Counter Module for initialization*/
	RTC_API.RTCC.B.CNTEN = 0u;
 
	PMCDIG.MISC_CTRL_REG.B.SIRC_ENB = 0; // Enable SIRC in running modes
	RC128K_DIG.CTL.B.LPRCON_STDBY = 1; // Enable SIRC in STANDBY
 
	/*select clock SIRC 128 KHz*/
	RTC_API.RTCC.B.CLKSEL = 1u;
	/*enable divider by 32*/
	RTC_API.RTCC.B.DIV32EN = 1u;
	/*disable divider by 512*/
	RTC_API.RTCC.B.DIV512EN = 0u;
 
	RTC_API.RTCC.B.APIEN = 0;
	RTC_API.RTC_APIVAL.B.APIVAL = 2400000; // API period 1/4000Hz * 2400000= 600sec?
	RTC_API.RTCC.R = 0x80009001;  //Counter enabled, API enabled, SIRC@128KHz used, Trigger enabled for Analog Comparator Block
}

And this is how I call it:

{ 
...
	WKPU.WISR.R = 0x0002u; // clear possible RTC
	rtc_init();
	RTC_API.RTCS.R = 0x200002400; // Clear RTC flags
 
...
}

Can you have a look at this code? It doesn't seem to work but I build it based on the reference manual.

Maybe the value of the APIVAL(2400000) is not good(It's not 600 seconds)?

Thank you. Best regards,

Catalin

0 REPLIES 0