Kinetis EHCI USB-Host 160ms Interrupt

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

Kinetis EHCI USB-Host 160ms Interrupt

862 次查看
johannesschock
Contributor II

I'm using USB-Host Mass Storage Device class of MQX 4.0.1. with K70 EHCI and I face the following problem:

When a memory stick is inserted, the function _usb_ehci_reset_and_enable_port is called by the ISR. Inside that function there are two loops which run for approximately 160ms (debounce for 100ms, wait for reset for 60ms). During that time the whole system is unresponsive because it stays inside an ISR.

I don't think it's a good idea to do 100ms debounce loops in RTOS interrupt routines.

Has someone already written a patch for that problem?

Perhaps we can use the uframe-interrupt...

Regards, Johannes

标签 (1)
标记 (5)
0 项奖励
2 回复数

272 次查看
alejandrolozan1
NXP Employee
NXP Employee

Hi,

I have checked and so far there is no patch for this.

I can send this feedback to the developers but if you are able to improve this, it would be nice and very appreciated to get this feedback.

Thanks  a lot for the feedback.

Best Regards,

Alejandro

0 项奖励

272 次查看
johannesschock
Contributor II

Hello Alejandro,

sorry for answering late, but I lost focus on that topic (I didn't expect an answer anymore :smileyhappy:).

I've written a patch which propagates all ehci-Interrupts to a high priority task using a lwmessage. The high priority task handles the interrupt then, allowing doing debounce with _time_delay().

I use the follwing scheme:

in _usb_ehci_init: initialize message queue, start additional isr task

in _usb_ehci_isr: disable ehci interrupt, send usb handle via message queue

in interrupt task: while(1) {wait for message, call _usb_ehci_isrfunc (which loops until all pending interrupts are serviced), enable ehci interrupt}

in _usb_ehci_reset_and_enable_port I changed the debounce loops to loops using _time_delay()

I don't want to publish my patch here in the forum, because it is a quick and dirty solution and not tested concerning stability and side effects.

0 项奖励