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.

Need help on testing PHY

Other Parts Discussed in Thread: OMAP3530

Hi All,

I want to do a test of reading from and writing to a scratch register on the USB3320 transceiver several thousand times and see if there will be any error between OMAP3530 and PHY.

The address of the scratch register on the USB3320 is 16-18h (Read), 16h (Write), 17h (Set), 18h (Clear).

I searched in "soc\common_ti_v1\common_ti\usb\ ehcipdd\system.c" and saw the function "UlpiWriteReg(

 

DWORD EhciRegBase, DWORD Port, DWORD Register, BYTE Data) and UlpiReadReg(DWORD EhciRegBase, DWORD Port, DWORD Register, BYTE * pData).

Are these the right functions to use for my test?

In the registry file "omap_usbhs.reg", MemBase is 0x48064000. I guess I can use this value for "EhciRegBase" parameter and 16h for "Register" parameter. What should I use for "Port" parameter?  If the USB3320 transceiver is connected to USB2, is the Port equal to 2?

How can I do this test from an application? I do not see these functions used anywhere for me to get an example.

I appreciate any tips/advice that you can give me.

Thanks,

Luan

  • The USB PHY ULPI registers are automatically mapped to the OMAP3530 memory space by the USB TLL controller (look up table 23.52 in the OMAP3530 reference manual for details). Therefore you can directly access the USB3320 ULPI registers by reading/writing registers located after 0x48062040.

  • Actually I had to do this too as it seems the USB controller seems to get stuck occasionally and does not power up correctly.

    I test by reading the device and manufacturer ID from the PHY.

    You can not use the routines suppled as there is no time out and will loop forever in the failure mode.

    I added an attempt counter as follows:

    BOOL UlpiReadReg(DWORD EhciRegBase, DWORD Port, DWORD Register, BYTE * pData)

    {

    volatile DWORD * pEhciUlpiAccess = (volatile DWORD *)(EhciRegBase + 0xa4);

    DWORD ReadData;

    DWORD attempts = 20;

     

    *pEhciUlpiAccess = START_READ_ULPI_DATA(Port, Register);

    // wait for register access done

    do

    {

    ReadData = *pEhciUlpiAccess;

    DEBUGMSG(ZONE_INFO, (TEXT("EHCI ULPI access port %d, register 0x%x = 0x%x\r\n"), Port, Register, ReadData));

    }

    while ((ReadData & 0x80000000) && --attempts>0);

    *pData = (BYTE)ReadData;

    return (attempts>0);

    }

     

    if (UlpiReadReg((DWORD)pPddObject->ioPortBase, 2, 0, &loData))

    RETAILMSG(1,(TEXT("PHY ULPI_VENDOR_ID_LO 0x%x\r\n"),loData));

    else

    RETAILMSG(1,(TEXT("ERROR: Reading PHY ULPI_VENDOR_ID_LO\r\n")));

    if (UlpiReadReg((DWORD)pPddObject->ioPortBase, 2, 1, &hiData))

    RETAILMSG(1,(TEXT("PHY ULPI_VENDOR_ID_HI 0x%x\r\n"),hiData));

    else

    RETAILMSG(1,(TEXT("ERROR: Reading PHY ULPI_VENDOR_ID_HI\r\n")));

    // check PHY manufacture ID to see if it is communicating

    if (loData != 0x24 || hiData != 4)

    goto InitializeEHCI_Error;

     

     

  • Hi David,

    Thanks for your help.  I have some more questions for you.

    1- Would you please explain what is the purpose of

         volatile DWORD * pEhciUlpiAccess = (volatile DWORD *)(EhciRegBase + 0xa4);

    2- What value did you use for EhciRegBase in your test?

    3- In your test code, Port = 2 because your PHY is connected to USB2?

    4- Is Register value the offset from EhciRegBase?

    5- Can you use void EhciReadReg(DWORD EhciRegBase, DWORD Offset, BYTE *pData) to achieve the same thing?

    In appreciation,

    Luan

  • Hi David,

    I am following your advice but so far, I have not been successul in reading the Vendor ID of the PHY.  I modified UlpiReadReg() to include attemps as you suggested and add the following code to HcdPdd_Init()  (close to the end after all of the inintialization) in source file system.c:

     

     

     

     

     

     

     

    if

     

     

    (UlpiReadReg((DWORD)pPddObject->ioPortBase, Port, 0, &ReadData))

        RETAILMSG(1,(TEXT(

     

    "Ulpi PHY Vendor ID Lo: %x\r\n"), ReadData));

     

     

     

    else

        RETAILMSG(1,(TEXT(

     

    "Read Ulpi PHY Vendor ID Lo Failed\r\n")));

     

     

     

    if(UlpiReadReg((DWORD)pPddObject->ioPortBase, Port, 1, &ReadData))

        RETAILMSG(1,(TEXT(

     

    "Ulpi PHY Vendor ID Lo: %x\r\n"), ReadData));

     

     

     

    else

        RETAILMSG(1,(TEXT("Read Ulpi PHY Vendor ID Hi Failed\r\n")));

    UlpiReadReg() returns FALSE for both Vendor ID low and high.  It fails on both EVM and my custom board.

    Were you successful in reading the Vendor ID on your board?  I saw you use 2 for port parameter.  That means your PHY is connected to HSUSB3?

    Appreciate your help very much,

    Luan

  • Yes, our PHY is on HSUSB2