MQX 4.0 USB HID Interrupt Polling Interval

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

MQX 4.0 USB HID Interrupt Polling Interval

1,099 Views
huishao2
Contributor IV

Hi-

Our K20D72M based USB HID host has been working fine until recently we noticed that the HID host adds ~100ms delay (100 SOFs as shown in attached) if host sees a NAK for an IN transfer.

Is it requested to use the 1ms(or 10ms) polling interval (got from ENDPOINT descriptor) for interrupt transfer to keep polling USB HID device instead of waiting for 100ms so that the delay will be minimized.

Digging a bit into host driver, inside _usb_khci_task() of khci.c, there is a 100ms delay if the message queue is empty

 // look for interrupt transaction
            if ((_usb_khci_get_hot_int_tr(usb_host_ptr, &msg) != 0) || (!seq_ints--)) {
                seq_ints = 10;
                if (_lwmsgq_receive(usb_host_ptr->tr_que, (uint_32 *) &msg, LWMSGQ_RECEIVE_BLOCK_ON_EMPTY, USBCFG_KHCI_WAIT_TICK, 0) == MQX_OK)
                    if (msg.pipe_desc->G.PIPETYPE == USB_INTERRUPT_PIPE)
                        _usb_khci_add_int_tr(usb_host_ptr, &msg, msg.pipe_desc->G.INTERVAL);
            }

Questions are:

1. If the interrupt polling interval is respected in MQX 4.0 USB host driver?

2. Why the 100ms wait above is added if there is no pending message? Is it the reason we see 100ms delay?

3. If the polling interval is not respected, how to fix it?

thanks and regards

Hui

Labels (1)
0 Kudos
1 Reply

779 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Hui:

If there is no pending messages, khci task will be blocked for USBCFG_KHCI_WAIT_TICK time (100ms by default). then CPU will be released from KHCI usb task to serve other tasks.  This is an multi-task environment .  Of course, you can modify this value. The minimum is 1, but that will result in too much overhead.

Regards

Daniel

0 Kudos