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.

SK-AM62: Trying to get U-Boot ums command to work

Part Number: SK-AM62

Hi,

I'm struggling to get U-Boot ums command to work.

Setup:

  • Board: SK-AM62 EVM E2
  • Boot setup: boot from microSD
  • microSD image: tisdk-default-image-am62xx-evm.wic.xz (08.06.00.42) with boot partition modified to allow GP boot
  • Host OS: Ubuntu 20.04.5 LTS, kernel: 5.14.0-1057-oem

To get an understanding of how to use ums command, I'm simply trying to expose the on-board eMMC, so all the ums invocations below refer to the internal eMMC.

Example scenario:

  1. Starting state: J15 connected to host (/dev/ttyUSB0 available), microSD with default image in microSD slot
  2. Plug in power adapter to J11 to power up the board
  3. Interrupt the U-Boot automatic boot
  4. Run ums 0 mmc 0 on the target, results in following output on the target:
     
    UMS: LUN 0, dev 0, hwpart 0, sector 0x0, count 0x1da4000
    dwc3-generic-peripheral usb@31000000: failed to enable ep0out
    failed to start <NULL>: -110
    g_dnl_register: failed!, error: -110
    g_dnl_register failed
  5. Plug in USB-C <-> USB-A cable to J13 on the board and USB-A socket on the host
  6. Host kernel immediately starts printing:
    [966457.403977] usb 3-1: new high-speed USB device number 125 using xhci_hcd
    [966462.724022] usb 3-1: device descriptor read/64, error -110
    [966473.224084] usb 3-1: device descriptor read/64, error -71
    [966473.464022] usb 3-1: new high-speed USB device number 126 using xhci_hcd
    [966473.595986] usb 3-1: device descriptor read/64, error -71
    [966473.832079] usb 3-1: device descriptor read/64, error -71
    [966473.940266] usb usb3-port1: attempt power cycle
    [966474.595964] usb 3-1: new high-speed USB device number 127 using xhci_hcd
    [966474.596149] usb 3-1: Device not responding to setup address.
    [966474.804129] usb 3-1: Device not responding to setup address.
    [966475.012076] usb 3-1: device not accepting address 127, error -71
    [966475.139941] usb 3-1: new high-speed USB device number 6 using xhci_hcd
    [966475.140051] usb 3-1: Device not responding to setup address.
    [966475.352053] usb 3-1: Device not responding to setup address.
    [966475.559961] usb 3-1: device not accepting address 6, error -71
    [966475.560089] usb usb3-port1: unable to enumerate USB device
  7. Run ums 0 mmc 0 on the target, results in ums command running (spinning bar output), and following on the host:
    [966572.115677] usb 3-1: new high-speed USB device number 10 using xhci_hcd                  
    [966572.268706] usb 3-1: New USB device found, idVendor=0451, idProduct=6165, bcdDevice= 2.23
    [966572.268716] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3            
    [966572.268719] usb 3-1: Product: USB download gadget                                        
    [966572.268721] usb 3-1: Manufacturer: Texas Instruments                                     
    [966572.268723] usb 3-1: SerialNumber: 0000000000000109                                      
    [966572.271027] usb-storage 3-1:1.0: USB Mass Storage device detected                        
    [966572.271343] scsi host0: usb-storage 3-1:1.0                                              
    [966594.064070] usb 3-1: reset high-speed USB device number 10 using xhci_hcd                
    [966599.427728] usb 3-1: device descriptor read/64, error -110                               
    [966615.043739] usb 3-1: device descriptor read/64, error -110                               
    [966615.279629] usb 3-1: reset high-speed USB device number 10 using xhci_hcd
    [966615.411697] usb 3-1: device descriptor read/64, error -71
    [966615.655630] usb 3-1: device descriptor read/64, error -71
    [966615.895792] usb 3-1: reset high-speed USB device number 10 using xhci_hcd
    [966615.895988] usb 3-1: Device not responding to setup address.
    [966616.107727] usb 3-1: Device not responding to setup address.                             
    [966616.315580] usb 3-1: device not accepting address 10, error -71
    [966616.443578] usb 3-1: reset high-speed USB device number 10 using xhci_hcd
    [966616.443798] usb 3-1: Device not responding to setup address.                             
    [966616.651825] usb 3-1: Device not responding to setup address.
    [966616.859555] usb 3-1: device not accepting address 10, error -71
    [966616.859669] usb 3-1: USB disconnect, device number 10                                    
    [966617.019584] usb 3-1: new high-speed USB device number 11 using xhci_hcd
    [966617.151676] usb 3-1: device descriptor read/64, error -71   
    [966617.391658] usb 3-1: device descriptor read/64, error -71                                
    [966617.627644] usb 3-1: new high-speed USB device number 12 using xhci_hcd  
    [966617.755697] usb 3-1: device descriptor read/64, error -71   
    [966617.991726] usb 3-1: device descriptor read/64, error -71   
    [966618.103773] usb usb3-port1: attempt power cycle                                          
    [966618.763568] usb 3-1: new high-speed USB device number 13 using xhci_hcd
    [966618.763726] usb 3-1: Device not responding to setup address.                             
    [966618.971739] usb 3-1: Device not responding to setup address.
    [966619.179652] usb 3-1: device not accepting address 13, error -71
    [966619.307590] usb 3-1: new high-speed USB device number 14 using xhci_hcd
    [966619.307752] usb 3-1: Device not responding to setup address.
    [966619.515917] usb 3-1: Device not responding to setup address.
    [966619.723668] usb 3-1: device not accepting address 14, error -71
    [966619.723876] usb usb3-port1: unable to enumerate USB device

    note: After 'reset high-speed USB device number 10 using xhci_hcd' (line 9 in the log) the target console changes - spinning bar stops, so ums command terminates.

At no point in the above scenario does a block device appear on the host. During step 7 above, before the reset, the device does get enumerated:

$ lsusb
<...>
Bus 003 Device 010: ID 0451:6165 Texas Instruments, Inc. USB download gadget
<...>

What am I doing wrong? Is it a host problem? Or are there additional steps to be done in U-Boot before using ums?

Regards,
Karolis

  • Hi Karolis,

    I am unable to point out what is missing in enabling UMS, since this function is not enabled/supported in the Processor SDK, so I cannot tell what the exact steps are needed to enable it.

  • Hi Bin,

    What do you mean it's not enabled? I did not modify the U-Boot (it's the default one that comes with image I indicated above - tisdk-default-image-am62xx-evm.wic.xz (08.06.00.42)), so it's certainly enabled.

    I think if it's not meant to supported, it would probably be good to compile it out of U-Boot, to avoid confusion. Or even better - actually support the feature! ;)

    Regards,
    Karolis

  • Hi Karolis,

    Sorry, I misspoke. I didn't realize ums command is enabled by default in the SDK prebuilt.

    I actually figured out how to get it working. You need to run "usb start" command before running "ums 0 mmc 0" command.

    Could you please let me know how you will use the ums command?

  • Could you please provide full procedure? At what point do you connect J13 <-> Host cable? If I just inject your proposed command before step 7 in my original post, it makes no difference - ums command still terminates due to host doing the reset high-speed USB device...

    Could you please let me know how you will use the ums command?

    the dream is to use ums and swap out operating system in SK-AM62 without having to resort to any type of network booting or manually swapping microSD card in and out, which comes with its own issues.

  • Hi Karolis,

    here is the procedure I did:

    - boot the board to u-boot prompt;
    - connect SK J13 usb port to the host;
    - run "usb start" (or usb reset);
    - run "ums 0 mmc 1" (on SK-AM62, mmc 0 is the eMMC, mmc 1 is the SD card);

    The only sequence which matters is "ums 0 mmc x" command should be run after J13 usb port is connected to the host. Because the USB0 port mode (host vs device mode) is determined based on the type-C negotiation.

  • Thanks for your patience Bin.

    Your sequence appears to be the cleanest yet - I simply get:

    [336806.124103] usb 3-6: new high-speed USB device number 25 using xhci_hcd
    [336806.280853] usb 3-6: New USB device found, idVendor=0451, idProduct=6165, bcdDevice= 2.23
    [336806.280861] usb 3-6: New USB device strings: Mfr=1, Product=2, SerialNumber=3                                                    
    [336806.280864] usb 3-6: Product: USB download gadget                                                                                
    [336806.280867] usb 3-6: Manufacturer: Texas Instruments                                                                             
    [336806.280869] usb 3-6: SerialNumber: 0000000000000109                                                                              
    [336806.339074] usb-storage 3-6:1.0: USB Mass Storage device detected                                                                
    [336806.340648] scsi host0: usb-storage 3-6:1.0                 
    [336806.340775] usbcore: registered new interface driver usb-storage
    [336806.342139] usbcore: registered new interface driver uas                                                                         
    [336828.188362] usb 3-6: reset high-speed USB device number 25 using xhci_hcd

    And yet the host still insists on resetting the USB device which causes ums to terminate on the SK-AM62.

    Could you please confirm if you're running Linux on host, and if so - which kernel?

    Regards,
    Karolis

  • Hi Karolis,

    I tried this on two different Ubuntu host: 22.04 (HP laptop) and 18.04 (Dell PC), both work fine.

    You PC log showing the host resets the USB device, it basically means the USB communication (for usb-storage) fails, likely due to corrupted USB packets. Here are a few things you can try:

    - use a different USB type-C cable between SK J13 and host USB port;

    - add a USB hub between the SK and PC;

    - ensure your SK type-C power supply is sufficient. Mine is 5V/3A.

    - try with a different Linux PC.

  • The kernel of my 22.04 is 5.19.0-35-generic #36~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 17 15:17:25 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

    The kernel of my 18.04 is 4.15.0-206-generic #217-Ubuntu SMP Fri Feb 3 19:10:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

  • use a different USB type-C cable between SK J13 and host USB port;

    Used 3 different cables:

    1. Anker USB 3.0 USB-A <-> USB-C (both by directly connecting to USB-A on host and via adapter and to USB-C on host)
    2. Apple USB-C <-> USB-C
    3. Unbranded USB-C <-> USB-A

    No luck Disappointed

    add a USB hub between the SK and PC;

    Tried two different hubs, no luck

    ensure your SK type-C power supply is sufficient

    I'm currently using 65W Lenovo brick that comes with my laptop, should be more than adequate

    try with a different Linux PC.

    This is the only thing that I haven't tried yet as I have no access to a different Linux PC at the moment.

    In the meantime while I setup a different system to test on, could you please confirm which revision of SK-AM62 you are using? I'm using E2, could that be a problem?

    Regards,
    Karolis

  • Hi Karolis,

    I am no longer own an E2 SK, but when I had my E2, I often used it for USB DFU work and never had any issue. The USB device reset issue you see could be caused by mainly 2 reasons - 1) USB signal integrity, and 2) sw bug. Since both USB DFU and UMS use USB controller in device mode and DFU worked on my E2, so I don't think the E2 has USB signal integrity problem.

    Until you have another Linux PC to test with, I think you can try to connect the SK to a Windows PC too. Since UMS emulates the SK SD card as an USB mass storage device to USB host, the Windows PC should be able to detect/enumerate the 2 partitions of the SK SD card too, you just cannot browse the content of the SD card 2nd partition since it is in ext4 format. But at least you can check if the reset issue happens with Windows PC or not, if the first partition (VFAT format) is stable in Windows.

  • FYI tried with Windows. Symptoms - at first, happy USB sound, a new Mass Storage device appears in the Device Manager. However, nothing's accessible via Explorer. Then, after some time (I think around 45s or so), USB disconnection sound followed by USB error.

    Seems quite similar to Linux.

    I think my next step will be to try an experiment with a different board.

  • However, nothing's accessible via Explorer.

    This sounds like the VFAT partition is not enumerated either.

    I think my next step will be to try an experiment with a different board.

    Agreed.

  • Hi Bin, I still have not had a chance to play with a different board. Could you please not close this yet? I think I should get an opportunity to do so this Friday.

    Regards,
    Karolis

  • Hi Karolis,

    No worries, take you time.

    The e2e threads won't be automatically closed unless there were no updates for at least 30 days.

  • In an unexpected turn of events, the actual problem was PLL configuration switches. I had them set up to 26MHz configuration, but the USB UMS only works at 25MHz. It doesn't work at 24MHz either.

    Was this documented anywhere and I missed it?

    I discovered it by accident and out of frustration when the other boards I tested actually worked as expected. They did have the PLL switches set to 25MHz. Replicating that on my board made it work.

  • Hi Karolis,

    I am glad the issue is resolved. Thanks for the update.

    Well, the root cause is not that USB UMS only works at 25MHz, rather -

    The PLL switches told software the OSC is 26MHz (or 24MHz in the other setting), but the real OSC is 25MHz, all the SoC modules/peripherals PLL would be about 4% off. Such that the USB interface won't be running at 480MHz, but 480/26*25=461.5MHz, then the USB host won't be able communicate with the UMS device (the SK EVM).