How to configure K61 MCU for CDC USB connection wakeup from STOP mode?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to configure K61 MCU for CDC USB connection wakeup from STOP mode?

693 Views
evgenik
Contributor IV

Hello.

I am working with MK61FN1M0 MCU. I can configure it for go to STOP mode and wakeup on RTC alarm. I want to connect with USB cable and wakeup MCU to RUN mode. I work with external oscillator (connected to coin battery). 

All time my system stay in STOP mode. On RTC alarm it wakeup, perform any operation and goes to STOP mode. Addidtional case for wakeup is connection to PC through USB cable. But this wakeup is not performed correct from STOP mode. I received the message that device not recognised. If my system all time in RUN mode - connection performed succes and I can communicate with my device as "CDC USB device".

Thanks

Labels (2)
0 Kudos
2 Replies

481 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Evgeni Kosakovski,

My colleague had done a test on FRDM-KL25Z board about "Asynchronous Resume Interrupt" to wake up the chip from VLPS low power mode.

More detailed info, please check attached code and pdf file.

 

The USB module has two different interrupts for a USB resume event. One asynchronous to be able to wake up from a low power mode, which is triggered by change in the state of the USB lines. The other is synchronous and is triggered only after 2.5us of detecting a K state (D+ = 0, D- = 1, for Full Speed). The application is responsible to transition to the low power mode whenever it required, and for this purpose it must check the device state as reported by the USB stack. When a suspend condition is detected in the bus, the SLEEP interrupt triggers and the stack changes its state to suspend; then the application will transition to the low power mode. When this SLEEP interrupt occurs, the asynchronous wake interrupt is enabled, and is disabled when it is triggered (this is required by the module to clear the interrupt). In normal conditions, the synchronous resume interrupt or the reset interrupt will be triggered afterwards, causing the stack to transition its state to other than suspend. The application can then know that communication is active again and will avoid entering the low power mode again.


Have a great day,
Kerry

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

0 Kudos

481 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Evgeni Kosakovski,

    From the user manual:

pastedImage_2.png

When you configure the USB, please enable the USB asynchronous resume interrupt in USBTRC0 register:
 USB0_USBTRC0 |= USB_USBTRC0_USBRESMEN_MASK;
Then enter the stop on your side.
After the stop code, please also take care of the clock mode, if you enter the STOP mode in PEE, after wake up, the clock mode will be in PBE mode, you need to switch mode back to PEE mode.
Please try the configuration on your side, whether it works on your side.


Have a great day,
Kerry

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

0 Kudos