KEA-128 waitmode and stopmode

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

KEA-128 waitmode and stopmode

4,340 次查看
prasannahv
Contributor II

I want enable wait mode and stopmode in kea128 MCu . please share any sample code

标签 (1)
0 项奖励
回复
6 回复数

4,337 次查看
ErichStyger
Specialist I

Wait mode is very simple:

__asm("wait");

Stop mode: consult the SDK examples.

 

I hope this helps,

Erich

0 项奖励
回复

4,335 次查看
prasannahv
Contributor II

Thank you ErichS for your replay..

__asm("wait");

for this command it is giving error. 

0 项奖励
回复

4,333 次查看
ErichStyger
Specialist I

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

0 项奖励
回复

4,322 次查看
ErichStyger
Specialist I

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

0 项奖励
回复

4,318 次查看
prasannahv
Contributor II

Thanks ErichS

4,326 次查看
prasannahv
Contributor II

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 */

0 项奖励
回复