AnsweredAssumed Answered

MQX 4.0 USB HID Interrupt Polling Interval

Question asked by Hui Shao on Oct 3, 2017
Latest reply on Nov 30, 2017 by Daniel Chen



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