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.

AM3352 USB support in uboot

Other Parts Discussed in Thread: AM3352

Hello Guys,

I'm using an AM3352 ZCE package and would like some help to understand how to enable USB options for reading files from a USB stick. I only have USB0 in my design and it is forced to be in Host mode by grounding the ID pin. I've also added relevant USB defines for USB0 to be host based on the options present in the am335x_evm.h file. 

I have..

#define CONFIG_USB_MUSB_DSPS 
#define CONFIG_MUSB_PIO_ONLY
#define CONFIG_MUSB_HOST
#define CONFIG_AM335X_USB0
#define CONFIG_AM335X_USB0_MODE MUSB_HOST

#define CONFIG_DOS_PARTITION
#define CONFIG_FAT_WRITE

#define CONFIG_CMD_FAT
#define CONFIG_CMD_USB
#define CONGIG_CMD_STORAGE

When I start uboot I get the following messages:

musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn)
musb-hdrc: MHDRC RTL version 2.0
musb-hdrc: setup fifo_mode 4
musb-hdrc: 28/31 max ep, 16384/16384 memory
USB Host mode controller at 47401000 using PIO, IRQ 0

And when I perform help usb - it shows me the following options. And performing those steps also yields positive results

U-Boot# help usb
usb - USB sub-system

Usage:
usb start - start (scan) USB controller
usb reset - reset (rescan) USB controller
usb tree - show USB device tree
usb info [dev] - show available USB devices


U-Boot# usb start
(Re)start USB...
USB0: scanning bus 0 for devices... 1 USB Device(s) found


U-Boot# usb tree
USB device tree:
1 Mass Storage (480 Mb/s, 100mA)
Generic Mass Storage 5BB85D75

U-Boot# usb info
1: Mass Storage, USB Revision 2.0
- Generic Mass Storage 5BB85D75
- Class: (from Interface) Mass Storage
- PacketSize: 64 Configurations: 1
- Vendor: 0x058f Product 0x6387 Version 1.4
Configuration: 1
- Interfaces: 1 Bus Powered 100mA
Interface: 0
- Alternate Setting 0, Endpoints: 2
- Class Mass Storage, Transp. SCSI, Bulk only
- Endpoint 1 Out Bulk MaxPacket 512
- Endpoint 2 In Bulk MaxPacket 512

But if I try 'fatls usb 1' or 'fatls usb 0' it replies back indicating Bad device. Can someone please let me know if I need to enable additional options.

Thank you for your replies and help.

Regards

Santhosh

  • Santosh,

    Santhosh Ramani said:
    #define CONFIG_AM335X_USB0
    #define CONFIG_AM335X_USB0_MODE MUSB_HOST

    Have you changed CONFIG_AM335X_USB1_MODE to MUSB_PERIPHERAL?

    To isolate if this is hw or sw issue, have you verified if the USB0 port works under Linux?

  • Santosh,

    What version of u-boot are you basing this on? Also, does the mass storage device work on a PC? Finally, the command would be 'fatls usb 0'

    Steve K.

  • Hello Bin,

    Thank you for your reply - I'm using the ZCE package so I don't have USB1 at all. So I have removed the USB1 macro definitions from uboot. Also the usb commands actually work - as shown in my previous post where I recognizes the USB stick plugged in and also reads the PID, VID etc. so it's not a hardware issue.

    But the options like fatls usb 1 do not seem to work. Thats where the problem is in this case. The options I have listed are the only options in my file for USB.

    Please do let me know if you have more questions for me.

    Thank you

    Regards

    Santhosh

  • Hello Steve,


    Yes I have verified that the usb stick is working fine by plugging it into a PC. I've tried both usb 1 and usb 0, but they both seem to fail. The only reason I used fatls usb 1 is because usb info returns 1:.... (please see first post)

    U-Boot# fatls usb 0
    ** Bad device usb 0 **

    Please let me know if you need additional information from my side.

    Thanks once again for your replies.

    Regards

    Santhosh

  • Ohh sorry I forgot to add the revision...

    I'm currently using SDK 06.00.00.00.

    Regards

    Santhosh

  • In your config do you also

    #define CONFIG_ARCH_MISC_INIT

    Steve K.

  • Hello Steve,


    Yes, I do define CONFIG_ARCH_MISC_INIT.


    - Santhosh

  • Santhosh,

    What is the OS on PC which tested the thumb drive? Linux or Windows? u-boot only supports FAT or EXT formats, please make sure the thumb drive is not in NTFS format.

    If the format is correct, is it possible to validate the USB0 port in Linux kernel, so we can determine if it is hw or uboot porting issue?

    Or if you have a USB protocol analyzer, you can capture a log to see why fatls failed.

  • Santhosh,

    After done some experiments, I don't think the issue is related to the thumb drive format.

    Santhosh Ramani said:
    U-Boot# usb start
    (Re)start USB...
    USB0: scanning bus 0 for devices... 1 USB Device(s) found

    That is ALL the output of the 'usb start' command? You did not get "scanning usb for storage devices... 1 Storage Device(s) found" at the end?

    If so, It looks like you did not have CONFIG_USB_STORAGE defined. Please look at the uboot source code common/cmd_usb.c, do_usb(). If usb_stor_scan(1) at Line 387 is not called, you will not have that line of printf.

  • Hello Bin, Steve,


    The USB stick was fine. As Bin, suggested in the last post - it was the CONFIG_USB_STORAGE.  Once I added this define, now fatls works correctly.


    Thank you so much for your help guys.

    Regards

    Santhosh