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.

Can't get USB1 working as a device on custom design.

Other Parts Discussed in Thread: TMDSSK3358, AM3352

Hi all,

I have a custom design using the AM335x.  I'm porting over the Starterware examples to use USB1 as a device.  I've modified both usb_dev_msc and usb_dev_bulk projects with the same result.  The host system knows that a usb has been connected, but responds with "USB not recognized".  I have commented out the various ASSERT(ulIndex == 0) that I have found in the usbdenum.c file.  What else needs to be done?  Does USB0ModuleClkConfig() configure both clocks or is it for the USB0 as the name suggests.

Thanks.

Jeff

  • Hello Jeff,
    **************************Changes in Starterware USB library for USB1 As A Device*************************** 1) usbdenum.c file: USBDeviceEnumHandler() function : USBDReadAndDispatchRequest(0) --> USBDReadAndDispatchRequest(ulIndex); 2) usbdenum.c file: USBDeviceEnumHandler() function :USBDReadAndDispatchRequest(0) --> USBDReadAndDispatchRequest(ulIndex); 3) usbdenum.c file:: USBDSetConfiguration() function : USBDeviceConfig(0, psDevice->ppConfigDescriptors[pUSBRequest->wValue - 1], psDevice->psFIFOConfig); ---> USBDeviceConfig(ulIndex, psDevice->ppConfigDescriptors[pUSBRequest->wValue - 1], psDevice->psFIFOConfig); 4) usbdcdc.c file :HandleRequests() function : USBDCDRequestDataEP0(0, (unsigned char *)&psInst->sLineCoding, sizeof(tLineCoding)); ---> USBDCDRequestDataEP0(ulIndex, (unsigned char *)&psInst->sLineCoding, sizeof(tLineCoding)); 5) usbdcdc.c file :HandleRequests() function : USBDCDRequestDataEP0(0, (unsigned char *)&psInst->sLineCoding,sizeof(tLineCoding)); ---> USBDCDRequestDataEP0(ulIndex, (unsigned char *)&psInst->sLineCoding,sizeof(tLineCoding));
    6) Similarly Change in the HandleRequets( ) in usbdmsc.c amd usbdbulk.c

    Cheers
    Rama Krishna






  • Rama,

    Thanks for your help.  However, USB1 is still coming up unrecognized.  I did find a few other places that need similar changes and I made them with no change in the result.  I went back to USB0 and that still works so I'm sure I did not wreck the files.  

    Any other thoughts on what I'm missing?

    Jeff

  • Hello Jeff,

                    We change the similar changes as mentioned above, its working fine. Will u please mention what changes u did for USB1 & what is your platform?

    I think u Correctly initialize the interrupts and handler? Please elaborate the problem r u facing ?

    Regards

    Rama Krishna

  • Rama,

    The custom board is based on the EVM-SK design.  The usb of the AM3352 was stripped down to direct access to the external usb connectors following the the USB1 design on the TMDSSK3358 schematic.  USB0 is setup as a USB AB and USB1 is setup as a USB B (device).  USB1_ID is not connected, but I did leave the protection zener and the capacitor attached.  Do you think they need to be removed so that pin is truely floating?  

    Focusing on the usb_dev_bulk design, I went back and started with a fresh set of startware files (AM335X_StarterWare_02_00_01_01) and made the following changes:

    Usbdenum.c

    • Modified USBDReadAndDispatchRequest(0) -> 2 places
    • Modified USBDeviceConfig(0,
    • Removed ASSERT(ulIndex == 0);   ->10 places

    Usbdcdc.c

    • Removed ASSERT(ulIndex == 0);   ->2 places
    • Modified USBDCDRequestDataEP0(0 ->2 places

    Usbdmsc.c

    • Modified USBDCDSendDataEP0(0, (unsigned char *)&ucMaxLun, 1);
    • Removed ASSERT(ulIndex == 0);   ->2 places

    Usbdbulk.c

    • Does not have HandleRequests()
    • Removed ASSERT(ulIndex == 0);  ->2 places

    The main function I call:

    USBDBulkInit(0, (tUSBDBulkDevice *)&g_sBulkDevice);
    USBDBulkInit(1, (tUSBDBulkDevice *)&g_sBulkDevice);

    just to make sure the changes are right and USB0 still works.  I also did  

    USBDBulkInit(1, (tUSBDBulkDevice *)&g_sBulkDevice);

    by itself.

    Both cases stall at "Waiting for host ...." on the LCD and windows eventually responds with "Device unrecognized".  USB0 always connects.

    I can't say that the clk and interrupt are configured correctly.  One things that's been bugging me is USB0ModuleClkConfig().  I can't find a USB1ModuleClkConfig(), and from what I've read, the function is for both USB0 and USB1.  Is that accurate? 

    I've copy the USB0AINTCConfigure function of USB0 for the interrupt of USB1:

    static void USB1AINTCConfigure(void)
    {

    /* Registering the Interrupt Service Routine(ISR). */
    IntRegister(SYS_INT_USB1, USB1DeviceIntHandler);

    /* Setting the priority for the system interrupt in AINTC. */
    IntPrioritySet(SYS_INT_USB1, 0, AINTC_HOSTINT_ROUTE_IRQ);

    /* Enabling the system interrupt in AINTC. */
    IntSystemEnable(SYS_INT_USB1);

    }

    Thanks for your time and let me know if anything else will help narrow this down.

    Jeff

  • Update:

    The last problem was a hardware issue. I removed the zener and capacitor to make the USB1_ID floating and its now working.

    Rama thanks for everything. Your changes were good.

    Jeff