2021-04-10 02:34 AM
hi friend
I am trying to set my borad into halt mode and then wake it up and set it to run mode.
I read AN3316 and write this code but its not work.
if(pal_lld_readpad(PORT_E, pushbutton)==0)
{
StopmodeFlag = 1U;
pal_lld_togglepad(PORT_H,LEDTEST);
osalThreadDelayMilliseconds(100);
pal_lld_togglepad(PORT_H,LEDTEST);
}
if (StopmodeFlag == 1U){
/*( Mode set in HALT) dar safhe 25 Application noteSPC560B power and mode management*/
ME.HALT0.B.CFLAON=2; //(code Flash in Low Power mode)
ME.HALT0.B.DFLAON=2; //(data Flash in Low Power mode)
ME.HALT0.B.FXOSC0ON = 1; //(turn-on the XTAL)
ME.HALT0.B.FMPLLON = 1; //(turn-on the PLL)
ME.HALT0.B.SYSCLK = 4; //(set PLL as device system clock)
/*(Peripheral mode set HALT mode:)*/
ME.LPPC[0].B.HALT0 = 1; //(activate low power peripheral configuration ’0’ in HALT)
ME.PCTL[4].B.LP_CFG = 0; // to select the low power peripheral configuration ’0’ for DSPI0 identified by offset = 4 (refer to figure x)
ME.PCTL[32].B.LP_CFG = 0; //to select the low power peripheral configuration ’0’ for ADC identified by offset = 32 (refer to figure x)
ME.PCTL[48].B.LP_CFG = 0; //to select the low power peripheral configuration ’0’ for lin identified by offset = 48 (refer to figure x)
ME.PCTL[16].B.LP_CFG = 0; //to select the low power peripheral configuration ’0’ for FlexCAN0 identified by offset = 16 (refer to figure x)
/*Timer set:See Step 5 (RUN0 to HALT mode)*/
/*Request transition to RUN0 mode: So, in case of RUN0 to HALT transition, these two register writing should be done:*/
ME.MCTL.R = 0x80005AF0;
ME.MCTL.R = 0x8000A50F;
while (ME.GS.B.S_MTRANS != 0){}
while (ME.IS.B.I_MTC != 0){}
}
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 << 0); // enable wakeup pin of:\n
WKUP.WIREER.R = (1U << 0); // enable rising edge interrupt for
WKUP.WISR.R = 0xFFFFFFFFU; // clear interrupt flags that an external interrupt occours
}
Solved! Go to Solution.
2021-04-14 02:28 AM
Hi,
in attachment you can find an example developed with SPC5Studio that shows you how to move the SPC560B in HALT mode and then move it back to RUN0 mode by using the interrupt generated by the RTC_API. All the details related to the application are summarizing in the readme file in the zip file.
Regards,
Luigi
2021-04-12 12:12 AM
no one to help?
please help me
2021-04-14 02:28 AM
Hi,
in attachment you can find an example developed with SPC5Studio that shows you how to move the SPC560B in HALT mode and then move it back to RUN0 mode by using the interrupt generated by the RTC_API. All the details related to the application are summarizing in the readme file in the zip file.
Regards,
Luigi