This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5728: USB function stops when it receives Clear Feature(ENDPOINT_HALT)

Part Number: AM5728

Tool/software:

Hi team,

My customer is developing his product using AM5728 + YoctoLinux(dunfell) + Processor SDK. He uses USB peripheral function with dwc3 driver. 

However, whenever AM5728 receives Clear Feature(ENDPOINT_HALT), USB stops working.

Do you have any idea to solve this issue?

Best regards,

Shota Mago

  • Hello Shota,

    Can you add more details, for example:

    • Is customers board Custom or TI HW?
    • What software are they using? SDK version, Kernel
    • USB3/2?
    • Logs of error and procedure

    Best,

    Josue

  • Thank you, Josue

    I asked Shota.

    We are trying to use this USB device as a USBTMC class device.

    But, Our development team struggling about this issue.

    >Is customers board Custom or TI HW?

    We confirmed by our custom board.

    >What software are they using? SDK version, Kernel

    SDK: ti-processor-sdk-linux-am57xx-evm-08_02_01_00
    Kernel: Linux am57xx-evm 5.10.100-g7a7a3af903

    >USB3/2?

    USB2

    >Logs of error and procedure

    The device appears to have stopped working after a CLEAR_FEATURE request.

    usbtmc.xlsx

    Besg regards,

  • Kataoka-san,

    Is this issue relevant to the following article?

    Depends on the USB port that you are using.. Are you using USB1? If you are using USB2, then it should not be a factor.

    Also, who is the host? is it a PC?

    Are all the HW connections the same as the reference TI boards? Is there anything different?

    -Josue

  • Thank you, Josue

    >Depends on the USB port that you are using.. Are you using USB1? If you are using USB2, then it should not be a factor.

    We are using USB1.

    >Also, who is the host? is it a PC?

    Yes, Windows10/11 PC is the host.

    >Are all the HW connections the same as the reference TI boards? Is there anything different?

    We are in the process of checking with the HW team to see how they differ from EVA boards.

    Please wait a moment.

    If this Errata is the cause, is there any way to avoid it?

    --

    Koichi Kataoka

  • Hello Kataoka-san, 

    Still not sure that this errata is the cause on my side but it seems possible. 

    If it is the errata then there is no workaround:

    other then using the port as USB 3.0 SS permanently, or if available, use USB2.

    Best,

    Josue

  • Kataoka-san,

    I had an internal conversation with our USB dwc3 maintainer and here are the 2 main points:

    • Unlikely that the errata is at play here since it would fail at the speed negotiation stage from the very beginning.
    • 2, TI nor Linux has a gadget driver for USBTMC class Device.

    So the question is, where did they find the code to enable the AM57x as a USBTMC device? 

    As far as TI goes this feature is not supported within our SDK. From the log shared, it seems like whichever driver they are using needs to debugged in order to fix the issue.

    Best,

    Josue

  • Hello, Josue

    >Unlikely that the errata is at play here since it would fail at the speed negotiation stage from the very beginning.

    Let me confirm.

    If Errata is the cause, does this mean that the speed negotiation stage will result in an error?

    >2, TI nor Linux has a gadget driver for USBTMC class Device.

    >So the question is, where did they find the code to enable the AM57x as a USBTMC device? 

    We have developped USBTMC class driver.

    Our USBTMC device have 4 endpoints.Those are Control,Bulk-OUT,Bulk-IN,and Interrupt.

    And, when BULK OUT endpoint receive CLEAR FEATURE Request, then endpoint stops working.

    These processes are handled by the dwc3 driver and HW.(It's not depend on USBTMC class driver)

    Best regards,

  • Kataoka-san,

    Unlikely that the errata is at play here since it would fail at the speed negotiation stage from the very beginning.

    Let me confirm.

    If Errata is the cause, does this mean that the speed negotiation stage will result in an error?

    Yes. The speed negotiation is done by the time you reach the error.

    We have developped USBTMC class driver.

    Our USBTMC device have 4 endpoints.Those are Control,Bulk-OUT,Bulk-IN,and Interrupt.

    And, when BULK OUT endpoint receive CLEAR FEATURE Request, then endpoint stops working.

    These processes are handled by the dwc3 driver and HW.(It's not depend on USBTMC class driver)

    Since this is customer developed code, it is their responsibility to debug it. The dwc3 driver works well with any of the other gadget drivers without showing this kind of failure. 

    TI does not support custom customer applications.

    TI nor Linux has a gadget driver for USBTMC class Device

    There is no existing code that offers this functionality that could have been tested or validated, therefore it is not a feature that is offered as part of our standard SW support.

    Can you share the customers code or where they are sourcing it from?

    -Josue

  • Thanks, Josue

    I think it dosen't work when send CLEAR FEATURE request to Bulk-out endpoint with original source code.

    The following modifications must be made to the DWC3 driver in order for the USBTMC driver to work.

    drivers/usb/dwc3/ep0.c

    static int dwc3_ep0_handle_endpoint(struct dwc3 *dwc,
            struct usb_ctrlrequest *ctrl, int set)
    {
        struct dwc3_ep      *dep;
        u32         wValue;
        u32         wIndex;      // add
        int         ret;
    
        wValue = le16_to_cpu(ctrl->wValue);
        wIndex = le16_to_cpu(ctrl->wIndex);   // add
    
        switch (wValue) {
        case USB_ENDPOINT_HALT:
            dep = dwc3_wIndex_to_dep(dwc, ctrl->wIndex);
            if (!dep)
                return -EINVAL;
    
            if (set == 0 && (dep->flags & DWC3_EP_WEDGE))
                break;
    
            if (set == 0 && (wIndex & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT)     // add
                break;                                                           // add
    
            ret = __dwc3_gadget_ep_set_halt(dep, set, true);
            if (ret)
                return -EINVAL;
    
            /* ClearFeature(Halt) may need delayed status */
            if (!set && (dep->flags & DWC3_EP_END_TRANSFER_PENDING))
                return USB_GADGET_DELAYED_STATUS;
    
            break;
        default:
            return -EINVAL;
        }
    
        return 0;
    }
    
    

  • Hello 

    The I will be out of office today, please expect some delay in response.

    -Josue

  • Hello Kataoka-san,

    Please clarify my understanding if I am wrong. The customer has resolved the issue by modifying the DWC3 driver themselves?

    Best,

    Josue

  • Hello

    Yes, this issue has been resolved.
    However, it has not passed the conformance test.

    I am concerned about the impact on drivers other than USBTMC.

    Best regards,

    --

    Koichi Kataoka

  • Kataoka-san,

    I'm happy to hear that this has been resolved and thank you for posting the solution. For any other different inquiries please post another thread and we can close this one.

    -Josue