2008-03-06 09:44:17     BF548 USB Session Initiation and Soft Disconnect

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

2008-03-06 09:44:17     BF548 USB Session Initiation and Soft Disconnect

John Doe (SIERRA LEONE)

Message: 52159    Sorry, this might be slightly off topic but I havn't found a better place to post this and there seem to be capable people here:

From the BF548 Peripheral Handbook I do not understand the relation of Soft Disconnect and Session initiation.

 

On page 13-36 it says the SESSION bit in USB_OTG_DEV_CTL must be set in order to enable ID sensing. Then the board enters either host or peripheral mode. It goes on on page 13-37 that if the board decides to be a peripheral it will request a session using SRP. Clearing the SESSION bit prematurely will be a software disconnect. This is all very clear by itself.

 

But how does it relate to the SOFT_CONN bit in USB_POWER, which also disables the D-lines ? It says on page 13-72 this is only valid in peripheral mode. What mode is the board in before ID sensing ? Won't this interfere with SRP ? Must this be "softconnected" before ID sensing ?

 

My objective is to configure everything for peripheral mode, then make a software connect and then have the board ready to be enumerated by a USB host. Which is the correct order of bitflipping for this ?

 

Btw. I am using a BF548-EZKIT here.

 

Thanks a lot guys,

 

J.C.

QuoteReplyEditDelete

 

 

2008-03-06 10:41:14     Re: BF548 USB Session Initiation and Soft Disconnect

Mike Frysinger (UNITED STATES)

Message: 52163    there is already a USB driver in the kernel for the BF54x/BF52x ... why do you need to poke the peripheral MMRs ?

QuoteReplyEditDelete

 

 

2008-03-06 11:41:57     Re: BF548 USB Session Initiation and Soft Disconnect

John Doe (SIERRA LEONE)

Message: 52165    Right you are. But I am trying to do some low-level stuff here without any kernel just running u-boot.

QuoteReplyEditDelete

 

 

2008-03-06 12:58:03     Re: BF548 USB Session Initiation and Soft Disconnect

Bryan Wu (CHINA)

Message: 52170    SESSION bit is for USB session control which is used by both host mode and peripheral mode. But They use this bit in different way. As USB spec said, only host can start session by setting this bit. As OTG spec said peripherals can also try to ask the HOST to start a session which is SRP by using this bit.

 

For SOFTCONN bit is provided a method for software to control the USB bus signal D+/D- directly and is only validate in peripheral mode.

 

Please look up the Blackfin Linux kernel svn code drivers/usb/musb/.

 

-Bryan

QuoteReplyEditDelete

 

 

2008-04-11 08:59:49     Re: BF548 USB Session Initiation and Soft Disconnect

Felix Lazarev (UNITED STATES)

Message: 54090    Did you manage to implement usb driver for U-boot?

QuoteReplyEditDelete

 

 

2008-04-15 12:58:23     Re: BF548 USB Session Initiation and Soft Disconnect

John Doe (SIERRA LEONE)

Message: 54287    No, right now I am not getting any connect interrupt. And I can't figure out why. My problem is that I still didn't find any real description of how exactly to set the board into host mode and have it wait for connections. The docs are somewhat contradicting each other. I tried to reproduce the "Linux" way because mass storage is working on that. All I know about the init sequence is basically what is done in Linux driver. If you wanna have a look, here are the locations, and what I found out so far:

 

musb_start() in musb_core.c:

 

- activates interrupts

- sets a 1 sec timout

- sets the SESSION bit in USB_OTG_DEV_CTL

 

conn_timer_handler (fires when the timer expires) in blackfin.c:

 

- sets the SESSION bit (again)

- checks if the board is the A device (Does it at some point just decide it or is it ID sensing ?)

    - if yes set GPIO_USB_VRSEL to 1 (No idea, how to do that in U-Boot ... but I am getting the feeling it's important

    - change state to waiting for connection

    - if not  set GPIO_USB_VRSEL to 0

 

 

From the kernel log, before I plug in the USB stick, I get the following:

 

...

conn_timer_handler 298: state is a_idle

eth0: link up, 100Mbps, half-duplex, lpa 0x40A1

conn_timer_handler 298: state is a_idle

conn_timer_handler 298: state is a_wait_bcon

conn_timer_handler 298: state is a_wait_bcon

conn_timer_handler 298: state is a_wait_bcon

conn_timer_handler 298: state is a_wait_bcon

conn_timer_handler 298: state is a_wait_bcon

 

and after plugging in the USB stick:

 

musb_stage0_irq 403: <== Power=60, DevCtl=5d, int_usb=0x90

musb_stage0_irq 570: VBUS_ERROR in a_wait_bcon (5d, VALID), retry #1, port1 0000

musb_stage0_irq 641: CONNECT (a_host) devctl 5d

...

 

Since the musb_start() is a lot above that, the timer expires quite a lot of times before the board finally becomes an A device. But then there are no more messages. The timer just keeps setting SESSION and waits. I really wonder if this is the correct way of doing this.

My code is essentially doing the same (w/o the GPIO setting) only that the connect interrupt never comes (other interrupts arrive, for instance a whole bunch of VBUSERRORS).

QuoteReplyEditDelete

Attachments

    Outcomes