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.

AM3517 and LAN9514 Driver Problems

Other Parts Discussed in Thread: AM3517

Hello,

I'm using the AM3517 and the latest CE BSP (ARM_A8_01_01_00_patch_01) with an extra USB LAN chip from SMSC (LAN9514) on the OTG port.

My problem is, that the initialization failed in the omap_usbh driver module (chw.cpp:145 / ReadFifo) - it pop-up with a datatype misalignment:

BOOL ReadFIFO(DWORD* pFifoBase, void *pData, DWORD size)
{
    DWORD total  = size / 4;
    DWORD remain = size % 4;
    DWORD i         = 0;

    DWORD* pDword = (DWORD*)pData;

    volatile ULONG *pReg = (volatile ULONG*)pFifoBase;

    // this is 32-bit align
    for (i = 0; i < total; i++)
    {
        *pDword++ = INREG32(pReg);
    }

The LAN9514 chip has also an USB hub inside, and an USB stick on one of its port did its job without problems.

I would appreciate every hint you can give me.

Many thanks ahead!

  • What confused me with this function is, that the comment says "this is 32-bit align", so I thought that the address from pData make absolutely no sense when its not aligned.

    But I changed the code to a memcpy version and then I get the LAN part of the 9514 up and running and it did its work:

        for (i = 0; i < total; i++)
        {
             dwTemp = INREG32(pReg);
             memcpy((DWORD*)pData + i, &dwTemp, sizeof(dwTemp));
        }
        if (remain)
        {
            dwTemp = INREG32(pReg);
            memcpy((DWORD*)pData + total, &dwTemp, remain);
        }

    But could a problem show up because the address is not 32-bit aligned? It would be great if someone had an answer so I must not look at all the USB stuff in detail :-)

  • It seems that memcpy is also not unalignment "safe" in the release version: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka3934.html

    Defining the pointer as a possible unaligned address did work for all circumstances: http://msdn.microsoft.com/en-us/library/ms177389.aspx

    DWORD __unaligned * pDword = (DWORD*)pData;