S12ZVL32 Autonomous Periodical Interrupt in STOP mode

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

S12ZVL32 Autonomous Periodical Interrupt in STOP mode

469件の閲覧回数
chaitanya_kalyani
Contributor III

I am having an issue with Autonomous Periodical Interrupt in Stop Mode.

I want to read ADC value in stop mode. So before going into stop mode starting Autonomous Periodical Interrupt.

But I am not sure that when interrupt comes it is executing only ISR or it is exiting from stop mode and executing main logic also.

Implemented below code

1. At the time of initialization 

void func_api_init(void)
{
CPMUAPICTL = 0x80U; 
CPMUAPIR = 0x2EE0U; 
CPMUACLKTR = 0x00U; 
CPMUAPICTL = 0x83U; 
}

2. Entering into stop mode

void GoToSleep(void)
{
DisableInterrupts;
SCI0ASR1_RXEDGIF = 1; // clear flag
SCI0ACR1_RXEDGIE = 1; // edge interrupt enabled for wake up
CPMUAPICTL_APIFE = 1; //Autonomous periodical interrupt is enabled and timer starts running.
EnableInterrupts;
__asm(STOP);
//After come out of stop mode disable interrupts
SCI0ACR1_RXEDGIE = 0;
SCI0ACR1_RXEDGIE = 0;
CPMUAPICTL_APIFE = 0; // 0 Autonomous periodical interrupt is disabled
}

3. ISR 

#pragma CODE_SEG __NEAR_SEG NON_BANKED
ISR(API_IntISR)
{
CPMUAPICTL_APIF = 1; // Interrupt flag cleared by writing a 1.
API_Interrupt = TRUE;
}
#pragma CODE_SEG DEFAULT

4. When it exit from stop mode due tp API interrupt checking in main

if (TRUE == API_Interrupt)
{
API_Interrupt = FALSE;
ReadAnalog
if(TRUE == HW_Interrupt)
{
l_ifc_wake_up(LIN0);
State = Operating;
Sleep = FALSE;
}
else
{
State = Standby;
Sleep = TRUE;
}

What exact action will happen when Autonomous Periodical Interrupt come.

0 件の賞賛
1 返信

392件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hello chaitanya.kalyani@seoyonelec-rnd.in,

The API interrupt brings the MCU out of the Stop mode.

Once the ISR is finished, the execution continues with the next instruction after ASM STOP unless there is another interrupt pending.

Regards,

Daniel

0 件の賞賛