Using asynchronous data(D+/D-) interrupt in K21 USB device mode

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

Using asynchronous data(D+/D-) interrupt in K21 USB device mode

1,980 次查看
rahulhirve
Contributor II

Hi All,

I am trying to use K21 USB in device mode, my need is to wakeup device(K21) on asynchronous data interrupt from host(PC).
I am using following settings:

   /* Suspend USB */
   USB0_USBCTRL |= USB_USBCTRL_SUSP_MASK;
   /* Delay 5 sec */

   delay(5000);

   /*  Asynchronous Resume Interrupt Enable */
   USB0_USBTRC0 |= USB_USBTRC0_USBRESMEN_MASK;    

I observed that after enabling  "Asynchronous Resume Interrupt" the device is not allowing MCU to go in VLPS mode.

Are these correct settings? How can we use asynchronous data interrupt to wakeup k21 in device mode?

Thanks,
Rahul

标记 (1)
2 回复数

1,523 次查看
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi

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.


Wish it helps
Have a great day,
Ma Hui

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

1,523 次查看
rahulhirve
Contributor II

Hi Ma Hui,

Thanks for your reply, I am trying to do this using MQX 4.1 based USB device library on K21. I am using K21 based product as a device connected to USB OTG of a android phone.

But when I put K21 USB in suspend mode and enable Asynchronous interrupt I get immediate interrupt from USB bus, when I probed USB bus I see continues packets coming from Phone even in sleep(phone display off) mode I guess those are SOF/keep alive frames?

As per my understanding I need to put USB host(Phone) in suspend mode for stopping these SOF/keep alive frame? If yes how to do this from K21 device using MQX?

Thanks,

Rahul

0 项奖励
回复