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.

USB host issue with WINCE7 AM335X BSP

Hi all,

We meet one issue based on the AM335x WinCE7.0 BSP:

AM335X USB host have 16 endpoint(this is special, in general, only USB client have endpoint).  Only 0-7 endpoint can work. If the number of endpoint is more than 7(8-15), the endpoint  will not work.

 Can anyone know why? Thanks.


Best regards,

Rose

  • This issue can be duplicated in EVM with the following method.

    Method 1. Change the EP1-7 IN/OUT as "interrupt" instead of "any", then build OS;

         Plug in USB hard disk, system will  allocate EP8 bulk in/out to USB hard disk. At that time system will crash.

    Method 2: Change the following code in chw.cpp.

    Plug in more than 8 USB  hard disk, some of them will be allocated EP8 in/out.  At that time system will crash.

    // in CHW::AllocateHostEndPoint()
     if (TransferType == TYPE_BULK)
            {
                // Search for shared BULK EP
                for (i = 0; !fStop && (i < (MGC_MAX_USB_ENDS - 1)); i ++)
                {
                    if ((pConfig[ i ].refCount > 0) &&
                        (pConfig[ i ].epTypeCurrent == TYPE_BULK) &&
                        pConfig[ i ].fSharedMode &&
                        (pConfig[ i ].refCount < 1) &&              ----Add this sentence.
                        (pConfig[ i ].fifoSize >= MaxPktSize))
                    {
                        pConfig[ i ].refCount ++;
                        EpNum = i + 1;
                        fStop = TRUE;
                    }
                }
            }

  • Rose,

    I'm not an expert on the host driver, but the modification to the source code doesn't look right to me.

    In the modified source the test is for, among other things, refCount > 0 && refCount < 1, which can never be true for an integer type.

    I know that was not your original question but just wanted to point it out.

    Carsten

  • Hi Carsten,


    Yes. You are right. From logic, it is not suitable.

    The objective is  that each endpoint can be used independently instead of "share mode". So that  EP8-15 can be used with 8 USB hard disk.  The endpoint is allocated first,  refCount  will equal = 1. The logic avoid that endpoint is shared.  The modification is for duplicating issue simply.

    Anyway, thanks to check this issue.

    Rose

  • // in CHW::AllocateHostEndPoint()
     if (TransferType == TYPE_BULK)
            {    

             //Disable the shared bulk EP funciton.       So that EP8-15 can be used quickly

           /*

              // Search for shared BULK EP
                for (i = 0; !fStop && (i < (MGC_MAX_USB_ENDS - 1)); i ++)
                {
                    if ((pConfig[ i ].refCount > 0) &&
                        (pConfig[ i ].epTypeCurrent == TYPE_BULK) &&
                        pConfig[ i ].fSharedMode &&
                      //  (pConfig[ i ].refCount < 1) &&              ----Add this sentence.
                        (pConfig[ i ].fifoSize >= MaxPktSize))
                    {
                        pConfig[ i ].refCount ++;
                        EpNum = i + 1;
                        fStop = TRUE;
                    }
                }*/


            }

  • Hi, Rose
    can you solve the issue? I have the same issue .

    if I remove the below codes ,  the system will crash when  Inserting multiple ubs equipment.

    /*

              // Search for shared BULK EP
                for (i = 0; !fStop && (i < (MGC_MAX_USB_ENDS - 1)); i ++)
                {
                    if ((pConfig[ i ].refCount > 0) &&
                        (pConfig[ i ].epTypeCurrent == TYPE_BULK) &&
                        pConfig[ i ].fSharedMode &&
                      //  (pConfig[ i ].refCount < 1) &&              ----Add this sentence.
                        (pConfig[ i ].fifoSize >= MaxPktSize))
                    {
                        pConfig[ i ].refCount ++;
                        EpNum = i + 1;
                        fStop = TRUE;
                    }
                }*/