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.

TMS320C6748 usb hangs when turning on Phy clock.

Other Parts Discussed in Thread: TMS320C6748, OMAPL138, OMAP-L138

I have a custom build TMS320C6748 board. When using the bulk usb device example, it hangs on the line

while (!(HWREG(g_USBInstance[ulIndex].uiPHYConfigRegAddr) & CFGCHIP2_PHYCLKGD));

in usbphyGS60.c. The CFGCHIP2_PHYCLKGD  value always is 131072  and uiPHYConfigRegAddr  value always is 29442436 ,(The uartecho program works great).


What should I do?

Setting in AISgen:

Boot mode = UART0

Clock source = Oscillator @ 24 MHz

PLL0:

Pre-divisor = 1

Multiplier = 24

Post-Divisor = 2

DIV1 = 1

DIV3 = 3

DIV7 = 6

PLL1:

Multiplier = 20

Post-Divisor = 2

DIV1 = 1

DIV2 = 2

DIV3 = 3

USB connection:

https://www.dropbox.com/s/279qpnp9hpuu803/Capture.PNG?dl=0

  • Hmm.. is the bulk usb device example using the USB_REFCLKIN? I want to use the AUXCLK for my usb. How do I do this?
  • Correction: the HWREG(g_USBInstance[ulIndex].uiPHYConfigRegAddr) value is 92480 which is 10110100101000000 in binary.
    If I am reading the datasheet correctly if bits 13-14 are 11 (3h) that forces USB host operation with VBUS low. I believe I want that to be 10 (2f) to override phy values to force USB device operation.
  • Thanks to this: e2e.ti.com/.../1252111;pi239031349=1
    I traced it down to a bad PSCModuleControl setting. The program runs, but it doesn't show up as a device on my PC.
  • Hello Samuel,

    Glad to know that you fixed the PSC settings and you are able to run the program.

    Are you properly configured the USB for device mode ?

    Can you share the value of CFGCHIP2 register ?


    Regards,
    Senthil
  • I am using the USB_dev_bulk sample from starter ware.

    the CFGCHIP2 = 110110100101000010 (0x36942)

    I set the USB0OTGMODE to 10 but it always gets set back to 11. The USB0_ID pin is unconnected and the USB0_VBUS is pulled high (5v) with a 1k resistor.

    How can I force it to go to USB device mode?

  • Hello Samuel,

    We have already tested this USB_dev_bulk starterware example code in our LCDK/EVM boards and we did not face any issue in device mode of operation.

    Could you please check and confirm your hardware connections are correct ? If possible, please share the schematics of USB section.

    Regards,

    Senthil

  • Hi Samuel,

    I have tested once again today, the USB_dev_bulk  example on OMAPL138 LCDK board. It works as expected. I have connected to a PC and able to recognize it as a BULK device. Captured the CFGCHIP2 when the processor act as a device. Please refer to the details below and compare it with the values of each field of the CFGCHIP2.

    Regards,

    Shankari

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.
    --------------------------------------------------------------------------------------------------------

  • No bulk device show up in the device manager,  I added some code in usbdenum.c before calling the USBReset function to make my CFGCHIP2 match yours.

    unsigned int  reg = 0;
    reg = HWREG(g_USBInstance[ulIndex].uiPHYConfigRegAddr); 
    reg |= CFGCHIP2_USB1SUSPENDM;
    reg |= CFGCHIP2_SESENDEN;
    reg |= CFGCHIP2_VBDTCTEN;  
    reg |= CFGCHIP2_NO_OVERRIDE;
    HWREG(g_USBInstance[ulIndex].uiPHYConfigRegAddr) = reg;

    After that my CFGCHIP2 = 100110100111110010 (0x269F2)

    your CFGCHIP2 =               100000100111110010 (0x209F2)

                                                           ^^

    my CFGCHIP2[13-14] always get set to 11 (0x3), yours is 00 (0x0)

    It makes no difference if I use CFGCHIP2_NO_OVERRIDE , CFGCHIP2_FORCE_HOST or CFGCHIP2_FORCE_DEVICE. it always gets set back to 11 (0x3).

    Here is my USB connection schematic: Note the VBUS resistor (R100) is easily  removable/changeable


    Thanks for your help.

  • Hello Samuel,

    Can you try isolating VBUS and USB0_VBUS by removing R100 and connect +5V directly to USB0_VBUS ? Hope you have +5V power rail in your custom board.

    Also try probing the USB0_VBUS pin for correct voltage level.

    Regards,

    Senthil

  • My board is USB powered. Here is a shot of the top layer of my board to show how the USB0_VBUS is connected to the incoming +5V power.

    If I connect R100 the CFGCHIP2[16] (USB0VBUSSENSE) bit comes on and goes of if I disconnect R100.

  • I replaced the TMS320C6748 with the OMAP-L138.

    If I manually set the USB registers my device shows up as an unrecognized device

    HWREG(0x01C14184) &= 0xFFFFDFFF; // Force USB device
    HWREG(0x01C14184) |= 0x00000002; // 0010b => 24MHz Input Source

    I am not receiving any interrupts.

  • I put in some debugging code to see what gets called in the USB driver.

    Configuring USB...
    Received a reset from the host.
    Handle end point 0 interrupts.
     In the IDLE state.
      Is there a packet waiting for us? Yes - process it.
      Assure that the jump table is not out of bounds.
       Jump table to the appropriate handler.
        USBDGetDescriptor.
         This request was for a device descriptor.
    Handle end point 0 interrupts.
     Handle the status state.
    Received a reset from the host.
    Handle end point 0 interrupts.
     In the IDLE state.
      Is there a packet waiting for us? Yes - process it.
      Assure that the jump table is not out of bounds.
       Jump table to the appropriate handler.
        USBDSetAddress.
    Handle end point 0 interrupts.
     Handle the status state.
      Clear the pending address change and set the address.
    Handle end point 0 interrupts.
     In the IDLE state.
      Is there a packet waiting for us? Yes - process it.
      Assure that the jump table is not out of bounds.
       Jump table to the appropriate handler.
        USBDGetDescriptor.
         This request was for a device descriptor.
    Handle end point 0 interrupts.
     Handle the status state.
      Process the newly arrived packet.
      Assure that the jump table is not out of bounds.
       Jump table to the appropriate handler.
        USBDGetDescriptor.
         This request was for a configuration descriptor.
    Handle end point 0 interrupts.
     Handle the status state.

    It looks like like it hits

    case USB_STATE_STATUS:

    without doing anything then we received a reset from the host. Is this normal?

  • This obviously isn't enumerating correctly.

    This is the output of TDD

    Information for device USB\Vendor_1CBE_Product_0003: 
    
    Connection Information:
    ------------------------------
    Connection status: Device connected
    Device actual bus speed: High
    Device is hub: No
    Device adress: 0x0002
    Current configuration value: 0x00
    Number of open pipes: 0
    
    Device Descriptor:
    ------------------------------
    0x12	bLength
    0x01	bDescriptorType
    0x0110	bcdUSB
    0xFF	bDeviceClass   (Vendor specific)
    0x00	bDeviceSubClass   
    0x00	bDeviceProtocol   
    0x40	bMaxPacketSize0   (64 Bytes)
    0x1CBE	idVendor
    0x0003	idProduct
    0x0100	bcdDevice
    0x01	iManufacturer
    0x02	iProduct
    0x03	iSerialNumber
    0x01	bNumConfigurations
    
    Device Qualifier Descriptor is not available. Error code: 0x0000001F
    
    Configuration descriptor and all subsequent descriptors are not available. Error code: 0x0000001F
    
    String Descriptor Table
    --------------------------------
    Index  LANGID  String
    0x00   0x0000  
    0xEE   0x0000  Request failed with 0x0000001F
    
    ------------------------------
    
    Connection path for device: 
    Standard Enhanced PCI to USB Host Controller
    Root Hub
    USB\Vendor_1CBE_Product_0003
    
    Brought to you by TDD v1.83.0, Mar  7 2014, 14:22:05

    Just for your info, I am using the internal shared ram. here is my usb_dev_build.lds

    OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
    OUTPUT_ARCH(arm)
    
    SECTIONS
    {
    
    	. = 0x80000000;
    	. = ALIGN(4);
            .startcode     :
            {
                   *init.o      (.text)
            }
    
    	. = ALIGN(4);
    	.text      :
    	{
    		
    		*(.text)
    	}
    
    	. = ALIGN(4);
    
    	.data : 
    	{ 
    		*(.data) 
    	}
    	
    	. = ALIGN(4);
    
    	_bss_start = .;
    	.bss : 
    	{ 
    		
    		*(.bss) 
    	}
            . = ALIGN(4);
    
    	_bss_end = .;	
    	
    	_stack = 0x8001FFFF;
    }

    Any help would be greatly appreciated.

  • Samuel

    Do you have a USB protocol analyzer that you can place between the PC and C6748 to capture the entire enumeration sequence?

    Since your application is a bus powered application, what is your total power consumption?

    When 5V is present on the VBUS, do you see DP of C6748 goes high, and then host and C6748 goes through the high speed handshake first?

    Thanks

    David