How to wake up KE02 from stop mode with UART?

cancel
Showing results for 
Search instead for 
Did you mean: 

How to wake up KE02 from stop mode with UART?

Jump to solution
575 Views
qi249
Contributor I

Hello,

i have brought my KE02 microcontroller into stop mode (deep sleep). In my application I want to wake it up with UART0 RX interrupt. According to the reference manual it should be realized with AWIC module but I have no idea how. How to assign UART as wake up source? Which registers do I need to configure? I guess I have to work with the UART registers but I have not found detailed infos in RM. Have I overlooked sth? Wenn anyone knows the solution please give a hint. Any idea appreciated.

Thanks:smileyhappy:

Qi

Labels (1)
0 Kudos
1 Solution
165 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Qi,

During all stop modes, clocks to the UART module are halted.

No UART module registers are affected in Stop mode.

The receive input active edge detect circuit remains active in Stop mode. An active edge on the receive input brings the CPU out of Stop mode if the interrupt is not masked (UART_BDH[RXEDGIE] = 1).

Because the clocks are halted, the UART module resumes operation upon exit from stop, only in Stop mode. Software must ensure stop mode is not entered while there is a character being transmitted out of or received into the UART module.

So, it need to set UART_BDH[RXEDGIE] = 1 before the core enter into the STOP mode.

Wish it helps.


Have a great day,
Ma Hui

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

View solution in original post

0 Kudos
4 Replies
166 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Qi,

During all stop modes, clocks to the UART module are halted.

No UART module registers are affected in Stop mode.

The receive input active edge detect circuit remains active in Stop mode. An active edge on the receive input brings the CPU out of Stop mode if the interrupt is not masked (UART_BDH[RXEDGIE] = 1).

Because the clocks are halted, the UART module resumes operation upon exit from stop, only in Stop mode. Software must ensure stop mode is not entered while there is a character being transmitted out of or received into the UART module.

So, it need to set UART_BDH[RXEDGIE] = 1 before the core enter into the STOP mode.

Wish it helps.


Have a great day,
Ma Hui

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

View solution in original post

0 Kudos
165 Views
qi249
Contributor I

Hi Hui,

i think I am a step further. I have inserted the following codes in the UART interrupt handler:

if(UART0_S2 & UART_S2_RXEDGIF_MASK)

     UART0_S2 |= UART_S2_RXEDGIF_MASK;

and it seems that it is now working fine.

So I assume that as long as the interrupt flag is not cleared, the program gets stuck in the UART IRQ Handler and enters nowhere else. But why did the systick timer work? Is it integrated in the core and somehow "independent" on the codes?

Thanks

Qi

0 Kudos
165 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Qi,

You are right. When the UART edge wake up the core from the stop low power mode, it also need to clear the interrupt flag; otherwise it will always enter into the UART IRQ handler routine.

In fact, the wake up source is the interrupt. The UART edge wake up  is same with a GPIO wake up source (using interrupt to wake up the core). It will detect the UART pin edge to generate the interrupt.

Thank you for the attention.


Have a great day,
Ma Hui

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

0 Kudos
165 Views
qi249
Contributor I

Hi Hui...辉?,

thank you for your reply.

I followed your tipps, setting UART_BDH[RXEDGIE] = 1 before entering STOP mode and clearing it again after waking up. Strangely it has worked "somehow". By "somehow" I mean I can confirm that after sending any character per UART the SYSTICK timer is waked up (by lightening a LED in SYSTICK interrupt) but the other parts seemed keeping sleep, for it was even not jet entering the main loop (LED in main loop doesn't lighten).

Besides, the power consumption of my system is 11mA under RUN mode and 7mA under Stop Mode. I assume it is really in Stop mode because the current reduction correnspond to the description in Datesheet. After "waking up" the current rised to 9mA. So I guess it is not the correct wake-up... Why was the timer awaked but not the whole part? Really confusingly. Do I need to reinitialize the system after waking-up?

Thank you 谢了

Qi

0 Kudos