2009-12-08 10:44:47     Problems reading from OTG FLASH stick

Document created by Aaronwu Employee on Sep 24, 2013
Version 1Show Document
  • View in full screen mode

2009-12-08 10:44:47     Problems reading from OTG FLASH stick

Kevin Dimmer (UNITED KINGDOM)

Message: 83247   

 

Hi Asked a while ago if it was possible to boot the kernel from USB OTG on a BF527

 

http://blackfin.uclinux.org/gf/forumthread/32963

 

As the answer was yes, I have just downloaded the latest u-boot release 2009R1-RC3 and seem to be having some problems reading data from the stick.

 

I have configured up the USB port with the following in my config file

#define CONFIG_USB

#define CONFIG_MUSB_HCD

#define CONFIG_USB_BLACKFIN

#define CONFIG_USB_STORAGE

#define CONFIG_MUSB_TIMEOUT 100000

 

I have made 2 small changes to the driver in blackfin_usb.c

1.  To remove the ezkit PG13 setting not used on our board.

2.  To change the clock divisor as we use a 12MHz xtal not a 25MHz as per ezkit.

/* We use a 12MHz crystal on board so need to change the divider frequency

  bfin_write_USB_PLLOSC_CTRL(0x30a8);  */

bfin_write_USB_PLLOSC_CTRL(0x30D0);

 

I have had a look at

 

https://docs.blackfin.uclinux.org/doku.php?id=bootloaders:u-boot:usb

and

http://blackfin.uclinux.org/gf/tracker/4795

 

But my results are a bit different, see below.

I have tested with 3 different FLASH sticks all formatted on a windows PC in FAT format.

 

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

dpl_u-boot> usb start

(Re)start USB...

USB:   scanning bus for devices... 2 USB Device(s) found

       scanning bus for storage devices... 1 Storage Device(s) found

 

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

dpl_u-boot> usb info

1: Hub,  USB Revision 2.0

-  MUSB Root Hub

- Class: Hub

- PacketSize: 8  Configurations: 1

- Vendor: 0x0000  Product 0x0000 Version 0.0

   Configuration: 1

   - Interfaces: 1 Self Powered 0mA

     Interface: 0

     - Alternate Setting 0, Endpoints: 1

     - Class Hub

     - Endpoint 1 In Interrupt MaxPacket 512 Interval 255ms

 

2: Mass Storage,  USB Revision 2.0

- BUFFALO  ClipDrive        1B5816D940C59BA4

- Class: (from Interface) Mass Storage

- PacketSize: 64  Configurations: 1

- Vendor: 0x0ea0  Product 0x2168 Version 2.0

   Configuration: 1

   - Interfaces: 1 Bus Powered 100mA

     Interface: 0

     - Alternate Setting 0, Endpoints: 3

     - Class Mass Storage, Transp. SCSI, Bulk only

     - Endpoint 1 In Bulk MaxPacket 512

     - Endpoint 2 Out Bulk MaxPacket 512

     - Endpoint 3 In Interrupt MaxPacket 2 Interval 1ms

 

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

dpl_u-boot> usb storage

  Device 0: Vendor: BUFFALO  Rev: 2.00 Prod: ClipDrive

            Type: Removable Hard Disk

            Capacity: 250.0 MB = 0.2 GB (512000 x 512)

 

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

dpl_u-boot> usb tree

 

Device Tree:

  1  Hub (12MBit/s, 0mA)

  |   MUSB Root Hub

  |

  +-2  Mass Storage (480MBit/s, 100mA)

       BUFFALO  ClipDrive        1B5816D940C59BA4

 

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

dpl_u-boot> usb part

print_part of 0

## Unknown partition table

 

print_part of 1

## Unknown partition table

 

print_part of 2

## Unknown partition table

 

print_part of 3

## Unknown partition table

 

print_part of 4

## Unknown partition table

 

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

dpl_u-boot> fatinfo usb 0:1

 

** Unable to use usb 0:1 for fatinfo **

 

So it seems that I can read the device information OK, that I have a FLASH stick fitted and the size and manufacturer all look good, but when it comes to reading data from the FLASH it goes wrong. I'm wondering if this is a speed related issue.

 

I've also tried doing a sector read and the data read appears different to the data I see if I read the same stick on a PC.

 

So my questions are, does the release i've downloaded fully support OTG master.

 

Any suggestions of how to debug the problem.

 

Thanks

 

Kevin Dimmer

QuoteReplyEditDelete

 

 

2009-12-08 12:04:50     Re: Problems reading from OTG FLASH stick

Robin Getz (UNITED STATES)

Message: 83248   

 

Kevin:

 

I think we discovered and fixed some issues (which were checked into the branch) that could manifest itself as this.

 

Can you check things out of the branch and try again?

 

-Robin

QuoteReplyEditDelete

 

 

2009-12-08 13:30:38     Re: Problems reading from OTG FLASH stick

Kevin Dimmer (UNITED KINGDOM)

Message: 83251   

 

Hi Robin

 

If by branch you mean /branches/2009R1/u-boot-2008.10/...

 

As far as I can see the ../drivers/usb/*.* files are the same as the 2009R1-RC3 release files

as are the files in the disk folder.

 

I tried grabbing a copy of the trunk drivers/usb/... files and built them in but still get the same problem, unless I needed to take a bit more.

 

Any other ideas ?

 

Thanks

 

Kevin

QuoteReplyEditDelete

 

 

2009-12-09 02:30:30     Re: Problems reading from OTG FLASH stick

Cliff Cai (CHINA)

Message: 83264   

 

Hi Kevin:

 

it works for me on my BF527-EZKIT.

 

I format a flash disk as FAT32 on my PC with window XP,and copied a mp3 file to the disk.

 

the u-boot on board is 2009r1 head,now called 2009R1.1-rc1.

 

See following messages

 

 

 

Cliff

 

 

 

 

 

U-Boot 2008.10-svn2144 (ADI-2009R1.1-rc1) (Dec  9 2009 - 23:05:20)

 

 

 

CPU:   ADSP bf527-0.0 (Detected Rev: 0.0) (parallel flash boot)

 

Board: ADI BF527 EZ-Kit board

 

       Support: http://blackfin.uclinux.org/

 

Clock: VCO: 525 MHz, Core: 525 MHz, System: 131.250 MHz

 

RAM:   64 MB

 

Flash:  4 MB

 

In:    serial

 

Out:   serial

 

Err:   serial

 

Net:   Blackfin EMAC

 

MAC:   00:E0:22:FE:B8:11

 

Hit any key to stop autoboot:  0

 

bfin>

 

bfin> usb start

 

(Re)start USB...

 

USB:   scanning bus for devices... 2 USB Device(s) found

 

       scanning bus for storage devices... 1 Storage Device(s) found

 

bfin>  usb part

 

print_part of 0

 

 

 

Partition Map for USB device 0  --   Partition Type: DOS

 

 

 

Partition     Start Sector     Num Sectors     Type

 

    1                  129         1957407       b

 

 

 

print_part of 1

 

## Unknown partition table

 

 

 

print_part of 2

 

## Unknown partition table

 

 

 

print_part of 3

 

## Unknown partition table

 

 

 

print_part of 4

 

## Unknown partition table

 

 

bfin> fatinfo usb 0

 

Interface:  USB

 

  Device 0: Vendor: SanDisk  Rev: 7.01 Prod: Cruzer         

 

            Type: Removable Hard Disk

 

            Capacity: 955.9 MB = 0.9 GB (1957887 x 512)

 

Partition 1: Filesystem: FAT32 "NO NAME    "

 

bfin> fatls usb 0

 

  4329579   oneman.mp3

 

 

 

1 file(s), 0 dir(s)

 

 

 

bfin>

 

QuoteReplyEditDelete

 

 

2009-12-11 06:40:18     Re: Problems reading from OTG FLASH stick

Kevin Dimmer (UNITED KINGDOM)

Message: 83399   

 

Still can't get this to work, although the port works ok and I can read/write FLASH stick ok when it is being driven by the kernel, so I am convinced I have a simple u-boot config issue.

 

Is there a configuration to control the 5v USB enable line which is on a different GPIO on our board to the BF527 EZ-KIT.

 

We use PG11 it seems to use PG13 as far as I can tell.

I can see this gets set once but I can't see any active control.

 

Thanks

QuoteReplyEditDelete

 

 

2009-12-11 11:27:16     Re: Problems reading from OTG FLASH stick

Mike Frysinger (UNITED STATES)

Message: 83404   

 

there is no config.  if you're using the 2009R1 branch, modify musb_platform_init() directly.  if you're using trunk, put the stuff into your board-specific board_musb_init()

QuoteReplyEditDelete

 

 

2009-12-14 12:54:03     Re: Problems reading from OTG FLASH stick

Kevin Dimmer (UNITED KINGDOM)

Message: 83487   

 

Hi Thanks for all the help, today I haven't changed any code but I have tried a different FLASH Stick (Made by SanDisk) and suddenly it works fine, I can boot the kernel from it ok. :-)

 

But out of 4 sticks I have tried only 1 works on u-boot, while all 4 mount and work ok when the kernel is running.

 

The other sticks are:-

Buffalo 256MB

Buffalo 2GB

OTi 128MB

and the 1 that works in both u-boot and the kernel is a SanDisk 16GB (in 2 x 8GB partitions)

 

So this raises a different question why do some sticks not work in u-boot, when they work fine in the kernel?

I thought the code base was very similar.

 

Is this normal for the BF527 OTG port, that it only works with selected sticks, or are we maybe marginal in some hardware area?

I wondered if anyone else had tried a design that uses a 12MHz clock instead of the 24MHz clock used in the ez-kit board.

 

Thanks

 

Kevin

QuoteReplyEditDelete

 

 

2009-12-14 13:23:00     Re: Problems reading from OTG FLASH stick

Mike Frysinger (UNITED STATES)

Message: 83488   

 

they are similar, but we've focused our testing on the kernel since that is by and large where USB is going to be used.  there's probably some anomaly workarounds missing in u-boot.

QuoteReplyEditDelete

 

 

2009-12-14 23:29:30     Re: Problems reading from OTG FLASH stick

Cliff Cai (CHINA)

Message: 83491   

 

Hi Kevin,

 

I would say that the usb driver in u-boot is a simple one,and  not as robust as the one in kernel.If possible, would you mind mailing us one of your misbehaving flash disk? Then I can try to figure out the problem of the driver.

 

Cliff

Attachments

    Outcomes