I want enable wait mode and stopmode in kea128 MCu . please share any sample code
Wait mode is very simple:
__asm("wait");
Stop mode: consult the SDK examples.
I hope this helps,
Erich
Hi @prasannahv ,
I'm sorry, mixed up things. Wanted to write 'wfi' (wait for interrupt) which puts it into WAIT mode.
The more complete example would be to use
__asm volatile("dsb");
__asm volatile("wfi");
__asm volatile("isb");
The barrier instructions might not be strictly needed, but I always add them.
Erich
Hi @prasannahv ,
it looks like you are using Processor Expert. I'm not using your device, but with Processor Expert it should come with low power mode support in the CPU component.
As for wfi: it does exactly that: it enters CPU wait mode and waits for the next interrupt.
If there is no interrupt coming, it will wait forever.
Erich
Thanks ErichS
Hi Erich , Here i attached my testcode. Now device is going to waitmode , it is not going to while loop but after some time device is restarting.
int main(void)
/*lint -restore Enable MISRA rule (6.3) checking. */
{
/* Write your local variable definition here */
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/
/**** Board level initializations ****/
Clk_Init(); //clock initialization
GPIO_Init();
UART_Init(115200); /*Initialize Uart 2 debug port at 115200 bauds */
Enable_Interrupt(INT_UART2); /* Enable UART2 interrupt */
give_delay_in_ms(5);
print_debug("Test_main\r\n",(int)(int)strlen("Test_main\r\n"));
give_delay_in_ms(1000);
__asm volatile("dsb");
__asm volatile("wfi");
__asm volatile("isb");
while(1){
debugport_command_interpreter();
print_debug("Test_main\r\n",(int)(int)strlen("Test_main\r\n"));
give_delay_in_ms(1000);
}
/* Write your code here */
/* For example: for(;;) { } */
/*** Don't write any code pass this line, or it will be deleted during code generation. ***/
/*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/
#ifdef PEX_RTOS_START
PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of RTOS startup code. ***/
/*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
for(;;){}
/*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
/* END main */