AnsweredAssumed Answered

Is this bug in MQX USB driver?

Question asked by Kari Sipinen on Oct 20, 2012
Latest reply on May 23, 2013 by JOHN ADAMSON

Hello,

We have been wondering why we cannot send one certain packet out with our USB CDC driver. Took us while to figure out that problem was the packet's length which happened to be 2*EP size. In our case 128bytes. I didn't have time to search if this bug has been found previously so here is what I did to fix this particular problem. In khci_dev_main.c function _usb_device_usbfs_service_tk_dne_intr (around line 876) has following code. I did comment out &&(ep_num==USB_CONTROL_ENDPOINT). This seemed to solve the particular problem. Which happens to be not sending 0 size packet for the transmission that is 2*EP (or any even number there after)

 

    /* to send zero bytes data on CONTROL ENDPOINT TO MARK END OF TRANSFER*/
    /* this is needed only when last send transaction was equal to
       max_buffer_size and there is no more data to send*/
    if((len==state_ptr->EP_INFO[ep_num].max_packet_size)&&
        (buf_num_bytes == 0)/*&&(ep_num==USB_CONTROL_ENDPOINT)*/ )
    {

 

I'm thinking this fix should not break anything?!?! Could someone else who is more familiar with this code confirm.

So if you happen to have problems where USB packets are not going out check the packet length if it is 2 * EP size you most likely will have this problem.

 

Thanks,

Kari


Outcomes