K32L2A41A LLWU fail to wake up micro from VLLS1

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

K32L2A41A LLWU fail to wake up micro from VLLS1

ソリューションへジャンプ
1,692件の閲覧回数
pciampanelli
Contributor I

I tried (and failed) to create a working project to test deep sleep micro functionality.

I configured NMI pin as pin26 and have micro to go to sleep after it receives this interrupt. This part seems to work properly.

I also configured pin 35 al LLWU_P5 source on rising edge, my intent was to have a rising front wake the micro up from sleeping mode.

This part does not seem to work at all, What am I missing?

This is the very simple code of my program, all initialization are taken care by the SDK

bool goToSleep = false;
/* TODO: insert other definitions and declarations here. */
void APP_PowerModeSwitch()
{
smc_power_mode_vlls_config_t vlls_config;

vlls_config.enablePorDetectInVlls0 = true;
vlls_config.enableLpoClock = true;
vlls_config.subMode = kSMC_StopSub1;

SMC_PreEnterStopModes();
SMC_SetPowerModeVlls(SMC, &vlls_config);
SMC_PostExitStopModes();
}
/*
* @brief Application entry point.
*/
int main(void) {

/* Init board hardware. */
BOARD_InitBootPins();
BOARD_InitBootClocks();
BOARD_InitBootPeripherals();

printf("Hello World\n");

/* Force the counter to be placed into memory. */
volatile static int i = 0 ;

//Toggle LED
GPIO_PortToggle(BOARD_INITPINS_GREEN_LED_GPIO, BOARD_INITPINS_GREEN_LED_GPIO_PIN_MASK);

/* Unlock all the power modes of chip. */
SMC_SetPowerModeProtection(SMC, kSMC_AllowPowerModeAll);
// Clear the low power lock bit.
if (kRCM_SourceWakeup & RCM_GetPreviousResetSources(RCM)) // Wakeup from VLLS
{
PMC_ClearPeriphIOIsolationFlag(PMC);
NVIC_ClearPendingIRQ(LLWU_IRQn);
//Toggle LED
GPIO_PortToggle(BOARD_INITPINS_GREEN_LED_GPIO, BOARD_INITPINS_GREEN_LED_GPIO_PIN_MASK);
}

//APP_PowerModeSwitch();
//GPIO_PinWrite(BOARD_INITPINS_TEST_PIN_GPIO, BOARD_INITPINS_TEST_PIN_PIN, 1);

/* Enter an infinite loop, just incrementing a counter. */
while(1)
{
i++ ;
if (i==0x0000FFFF)
{
//Toggle LED
GPIO_PortToggle(BOARD_INITPINS_GREEN_LED_GPIO, BOARD_INITPINS_GREEN_LED_GPIO_PIN_MASK);
//
i = 0;
}

if(goToSleep == true)
{
goToSleep = false;
APP_PowerModeSwitch();
}
/* 'Dummy' NOP to allow source level single stepping of
tight while() loop */
__asm volatile ("nop");
}
return 0 ;
}

/* LLWU_IRQn interrupt handler */
void LLWU_IRQHANDLER(void) {
/* Place your code here */
asm("nop");
PMC_ClearPeriphIOIsolationFlag(PMC);
NVIC_ClearPendingIRQ(LLWU_IRQn);
NVIC_SystemReset();
//Toggle LED
//GPIO_PortToggle(BOARD_INITPINS_GREEN_LED_GPIO, BOARD_INITPINS_GREEN_LED_GPIO_PIN_MASK);
//while(1);
/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F
Store immediate overlapping exception return operation might vector to incorrect interrupt. */
#if defined __CORTEX_M && (__CORTEX_M == 4U)
__DSB();
#endif
}

void NMI_Handler(void)
{
goToSleep = true;
}

0 件の賞賛
返信
1 解決策
1,639件の閲覧回数
Miguel04
NXP TechSupport
NXP TechSupport

Hi @pciampanelli 

I'm glad you find a workaround for your problem, you can find more information of the power modes on the your boards reference manual Chapters: 7.4, 44.2, 26 and 37. Also, the application note AN4503 Power Management For Kinetis MCU's has more information too.

Best Regards, Miguel.

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
1,672件の閲覧回数
Miguel04
NXP TechSupport
NXP TechSupport

Hi @pciampanelli 

Could you tell me the SDK example you used for the initialization please?

Best Regards, Miguel.

0 件の賞賛
返信
1,643件の閲覧回数
pciampanelli
Contributor I

Hi Miguel,

I'm not using any SDK I created a FW myself.

Anyway I somehow managed to have it work, or so it seems.

Let me summarize here what I did for you to give me you opinion:

1. I usually run the micro in HSRUN mode, if i directly send the micro to VLLS1 from this run mode it does not wakeup

2. To be able to send the micro in VLLS1 and have it to wakr up I movo to VLPR before going to VLLS1

3. I use SOSC as oscillator, I had to configure it to work also in stop mode, otherwise the micro wouldn't wake up

Is there anythng wrong or that you would like to add to this procedure?

Thanks

Paolo

0 件の賞賛
返信
1,640件の閲覧回数
Miguel04
NXP TechSupport
NXP TechSupport

Hi @pciampanelli 

I'm glad you find a workaround for your problem, you can find more information of the power modes on the your boards reference manual Chapters: 7.4, 44.2, 26 and 37. Also, the application note AN4503 Power Management For Kinetis MCU's has more information too.

Best Regards, Miguel.

0 件の賞賛
返信
1,622件の閲覧回数
pciampanelli
Contributor I
Thanks a lot Miguel,

best regards

Paolo
0 件の賞賛
返信