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.

starterware / pdk_am437x_1_0_0 & usb_host example

Hi,

I have AM437x starter kit hardware and have been trying to run the usb_host example from: pdk_am437x_1_0_0\packages\ti\drv\usb\example\usb_host\

After much frustration I've finally got the example to work by adding the extra conditional "retStat == S_PASS" in the do ... while loop in  FSShellAppUtilsProcess as

int32_t FSShellAppUtilsProcess(void)
{
    uint32_t spinProcess = TRUE;
    int32_t retStat = E_FAIL;

    do
    {
      .
      .
      .
    } while(TRUE == spinProcess && retStat == S_PASS);

    return retStat;
}

Without the extra conditional, the code was stuck in the loop inside FSShellAppUtilsProcess which meant that USBHCDMain wasn't being called, which referring to - http://processors.wiki.ti.com/index.php/StarterWare_USB 

>> In order to complete the enumeration process, the host controller driver also requires that the application periodically call the USBHCDMain() function

So is this a bug in the pdk usb_host sample code or have I misunderstood?

Thanks

Nick

  • Nick,

    We tested the USB host example using a 437X GP EVM in the past without any problem. It can enumerate a USB thumb drive and run some simple command. We use the code as it is without changing it. Can you let us know how do you see the problem so I can try to reproduce?

    The wiki information is at http://processors.wiki.ti.com/index.php/Processor_SDK_RTOS_USB the USBHCDMain() is called in a while() loop.

    Regarding to "Without the extra conditional, the code was stuck in the loop inside FSShellAppUtilsProcess". There is no real loop inside this function, it is a do .... while(0), how do you get stuck inside this loop?

    Regards, Eric

  • Hi Eric,

    Thanks for replying.

    Perhaps the confusion is that I'm building the "bare metal" USB host example - whereas you mention to the TI RTOS version. In the "bare metal" example the while loop inside FSShellAppUtilsProcess is:

    int32_t FSShellAppUtilsProcess(void)
    {
        uint32_t spinProcess = TRUE;
        int32_t retStat = E_FAIL;
    
        do
        {
          .
          .
          .
        } while(TRUE == spinProcess);
    
        return retStat;
    }

    I found I needed to add the extra conditional "retStat == S_PASS" to the while loop in FSShellAppUtilsProcess as:

    int32_t FSShellAppUtilsProcess(void)
    {
        uint32_t spinProcess = TRUE;
        int32_t retStat = E_FAIL;
    
        do
        {
          .
          .
          .
        } while(TRUE == spinProcess && retStat == S_PASS);
    
        return retStat;
    }

    otherwise USBHCDMain wasn't being called

    Nick

  • Hi Eric,

    Apologies I realised my problem. I was linking against FSShellAppUtilsProcess in:

       pdk_am437x_1_0_0\packages\ti\starterware\examples\example_utils\fs_shell_app_utils.c

    rather than:

      pdk_am437x_1_0_0\packages\ti\drv\usb\example\shell\fs_shell_app_utils.c

    which as you said does indeed have a do ... while(0) loop.

    There is yet another implementation of  FSShellAppUtilsProcess in:

      pdk_am437x_1_0_0\packages\ti\mmcsd\example\fatfs_console\src\fs_shell_app_utils.c

    ... which again is different.

    <suggestion>

    It would have saved me a lot of time if differing methods could be given different names e.g. FSShellAppUtilsProcessMMCSD, FSShellAppUtilsProcessUSB etc.

    </suggestion>

    Nick