TRK KEA8 How can I exit from sleep mode with KBI ?

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

TRK KEA8 How can I exit from sleep mode with KBI ?

1,603 次查看
ahnjoseph
Contributor III

Hi 

 

I had TRK KEA8 EVM 

 

I should be wake up from sleep mode with KBI 

But I can`t wake up from sleep mode 

 

Pls ref my code and let me know " How can I exit from sleep mode with KBI"

 

1st : I had setup "SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;" (For Sleep mode)

2nd : My code  is to enter sleep mode by SW2 input

 

The KBI IRQ Handler work well.  

       

void KBI1_IRQHandler()
{
KBI1_SC |= KBI_SC_KBACK_MASK; /*Clear flag*/
if((GPIOA_PDIR & GPIO_PDIR_PDI(0x100000))>>20) /* If SW1 has been pressed */
{

__asm("nop");

LED0_TOGGLE;

}
else if((GPIOA_PDIR & GPIO_PDIR_PDI(0x200000))>>21) /* If SW2 has been pressed *
{
__asm("nop");
__asm__("wfi");
__asm("nop");

}
}

Original Attachment has been moved to: KEA8_test.zip

0 项奖励
回复
4 回复数

1,417 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hello Ahn Joesph,

    Your code alwys have problem after I download it to my TRK-KEA8 board.

8.jpg

You said, you can't enter stop mode, I think your can enter it, just be waked up by your PIT, because you didn't disable the PIT before your enter stop mode.

So, after you enter stop mode, if the PIT interrupt happens, your stop will be waked up.

Before you enter stop mode, please call:

PIT_ChannelDisable(uint8_t u8Channel)

Then try again on your side.

Wish it helps you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,417 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hello Ahn Joesph,

 1.  You can write the enter stop code like this:

void stop (void)
{
    /* Set the SLEEPDEEP bit to enable deep sleep mode (STOP) */
    SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;    

    /* WFI instruction will start entry into STOP mode */
#ifndef KEIL
        // If not using KEIL's uVision use the standard assembly command
    asm("WFI");
#else
        // If using KEIL's uVision, use the CMSIS intrinsic
    __wfi();
#endif
}

void wait (void)
{
    /* Clear the SLEEPDEEP bit to make sure we go into WAIT (sleep) mode instead
     * of deep sleep.
     */
    SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk;    

    /* WFI instruction will start entry into WAIT mode */
#ifndef KEIL
        // If not using KEIL's uVision use the standard assembly command
    asm("WFI");
#else
        // If using KEIL's uVision, use the CMSIS intrinsic
    __wfi();
#endif
}

2. Don't enter the stop mode in the interrupt.

  You can use a flag to indicate the interrupt, then check the flag in the main while(1), if the flag is set, then enter stop mode.

Please try it again on your side.

If you still have problem, please tell me what the IDE you are using, I will check it on my side.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

1,417 次查看
ahnjoseph
Contributor III

Hi Kerryzhou

Thanks your Kindly answer

But My code don`t Enter Stop mode

Can you check my code?

Pls check attached Zip file that is Project file

*******

I test on EVM KIT that is TRK-KEA8

MY IDE is Kinetis Design Studio Version: 3.2.0

Joseph Ahn

joseph.ahn@avnet.com<mailto:joseph.ahn@avnet.com>

Assistant Software Design Manager

Avnet Electronic Marketing. / ADS

12th Floor, KBS Media Center,

Maebongsan-ro 45 (Sangam-dong),

Mapo-gu, Seoul, 03909, Korea

O 82.2.6277.6395

M 82.10.5386.8985

F 82.2.761.2133

avnet.com/apac<http://avnet.com/apac>

0 项奖励
回复

1,417 次查看
ahnjoseph
Contributor III

Hi Kerryzhou

 

 Thanks your Kindly answer

 But My code don`t Enter Stop mode

 

Can you check my code?

 Pls check attached Zip file that is Project file  

 

*******

 I test on EVM KIT that is TRK-KEA8

MY IDE is Kinetis Design Studio Version: 3.2.0

0 项奖励
回复