KEA-128 waitmode and stopmode

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

KEA-128 waitmode and stopmode

4,345件の閲覧回数
prasannahv
Contributor II

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

ラベル(1)
0 件の賞賛
返信
6 返答(返信)

4,342件の閲覧回数
ErichStyger
Specialist I

Wait mode is very simple:

__asm("wait");

Stop mode: consult the SDK examples.

 

I hope this helps,

Erich

0 件の賞賛
返信

4,340件の閲覧回数
prasannahv
Contributor II

Thank you ErichS for your replay..

__asm("wait");

for this command it is giving error. 

0 件の賞賛
返信

4,338件の閲覧回数
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,327件の閲覧回数
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,323件の閲覧回数
prasannahv
Contributor II

Thanks ErichS

4,331件の閲覧回数
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 件の賞賛
返信