maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   N900 will not allow USB OTG! (https://talk.maemo.org/showthread.php?t=31921)

blue_led 2010-05-19 11:30

Re: N900 will not allow USB OTG!
 
because some functions of kernel seems to be in place the single problem i see is vbus power management in host mode as i see host mode depend on this
on N900 vbus power management is broken because it use another asic OUTSIDE tusb6010 for which driver is not written.
on N810 this driver work so somebody must check with a patched driver ( with removed sections of vbus power ) if any device can work without vbus.
after that we can hope n900 will do the same
vbus will and can be a future option in driver / selection mode software
few weeks ago ( beginning of march ) i tried to inject vbus & session_valid on phy asic http://talk.maemo.org/showpost.php?p...&postcount=619 ( i will post a picture with test board )
i never believe the driver and HNP can be so grossly as manual removal of device from pc
i try the same thing as egoshin ( conect / disconect from a hub ) . http://talk.maemo.org/showpost.php?p...&postcount=624 .
tight usb timings blinded me .i have no success because i did not stop ( nasty word here ) bme

MohammadAG 2010-05-19 18:01

Re: N900 will not allow USB OTG!
 
Applied the patches (they only seem to add a kernel message when echoing host), kernel built and flashed.
Raised power output to 5V using joerg_rw's command.
However I still can't get it to work, the flash drive gets rejected.
Code:

[ 3129.551940] kb_lock (GPIO 113) is now closed
[ 3129.716766] kb_lock (GPIO 113) is now open
[ 3163.176361] twl4030_set_host() 4030 OTG_CTRL=0x26
[ 3163.176635] twl4030_set_host() after 4030 OTG_CTRL=0x26
[ 3180.815826] usb 1-1: USB disconnect, address 5
[ 3181.091003] usb 1-1: new high speed USB device using musb_hdrc and address 6
[ 3181.240814] usb 1-1: rejected 1 configuration due to insufficient available bus power
[ 3181.240844] usb 1-1: no configuration chosen from 1 choice


joerg_rw 2010-05-19 18:07

Re: N900 will not allow USB OTG!
 
please have a close look to
http://mxr.maemo.org/fremantle/sourc...sb/musb_core.c
145 static inline int musb_verify_charger(void __iomem *addr)
ff
207

for seemingly working handling of the pullup/pulldown Rs (the MAIN most IMPORTANT config in PHY for hostmode)

joerg_rw 2010-05-19 18:15

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by MohammadAG (Post 666416)
Applied the patches (they only seem to add a kernel message when echoing host), kernel built and flashed.
Raised power output to 5V using joerg_rw's command.
However I still can't get it to work, the flash drive gets rejected.
[code][ 3129.551940] kb_lock (GPIO 113) is now closed
[ 3129.716766] kb_lock (GPIO 113) is now open
[ 3163.176361] twl4030_set_host() 4030 OTG_CTRL=0x26
[ 3163.176635] twl4030_set_host() after 4030 OTG_CTRL=0x26
[ 3180.815826] usb 1-1: USB disconnect, address 5
[ 3181.091003] usb 1-1: new high speed USB device using musb_hdrc and address 6
[ 3181.240814] usb 1-1: rejected 1 configuration due to insufficient available bus power
[ 3181.240844] usb 1-1: no configuration chosen from 1 choice

please see
61 * HP's USB bus-powered keyboard has only one configuration
ff
in http://mxr.maemo.org/fremantle/sourc...core/generic.c
Code:

61                  * HP's USB bus-powered keyboard has only one configuration
62                  * and it claims to be self-powered; other devices may have
63                  * similar errors in their descriptors.  If the next test

Code:

135        if (insufficient_power > 0)
136                dev_info(&udev->dev, "rejected %d configuration%s "
137                        "due to insufficient available bus power\n",
138                        insufficient_power, plural(insufficient_power));



[edit]
ok, seems we killed that issue by patching out a few rather useless checks in kernel. Probably MohammadAG will come up with a small and dirty patch eventually. No big thing though. Still the fake hostmode by tricking OTG statemachine, I.E needs laptop to simulate the yet missing switch of PHY to host config (2 pulldowns)

hcm 2010-05-19 22:09

Re: N900 will not allow USB OTG!
 
1 Attachment(s)
guys, I have some news about bme's i2c communication with bq24150.
Be aware that this is ALL communication to bq24150 through the kernel. Not necessarily only by BME.

initialisation (contains some nonsense IMHO):
Code:

i2c-2 (W): 0x3b, (R) 1 bytes,        // read register 0x3b (wraps to 0x03, datasheet states otherwise!)
i2c_read:  0x4b                        // result: Vendor/Part/Revision
i2c-2 (W): 0x3b, (R) 1 bytes,        // same
i2c_read:  0x4b
i2c-2 (W): 0x00, (R) 1 bytes,        // read status/control register
i2c_read:  0x00                        // reset state should be x1xx 0xxx (datasheet)
i2c-2 (W): 0x00 0x80,                // reset safety timer
i2c-2 (W): 0x02, (R) 1 bytes,        // read control/battery register
i2c_read:  0x8c                        // 3.5V + 700mV
i2c-2 (W): 0x02 0x8c,                // set control/battery to same value
i2c-2 (W): 0x00, (R) 1 bytes,        // read status
i2c_read:  0x00
i2c-2 (W): 0x00 0x00,                // write status
i2c-2 (W): 0x01, (R) 1 bytes,        // read control register
i2c_read:  0x06                        // charger disabled, high impedance
i2c-2 (W): 0x01 0x06,                // set to same value
i2c-2 (W): 0x00, (R) 1 bytes,        // read status
i2c_read:  0x00
i2c-2 (W): 0x01, (R) 1 bytes,        // read control register
i2c_read:  0x06                        // same as above
i2c-2 (W): 0x01 0x06,                // set to same value again
i2c-2 (W): 0x01, (R) 1 bytes,        // read again
i2c_read:  0x06
i2c-2 (W): 0x01 0x06,                // write again

every 15s:
Code:

i2c-2 (W): 0x00 0x80,                // reset safety timer
i2c-2 (W): 0x00, (R) 1 bytes,        // read status
i2c_read:  0x00
i2c-2 (W): 0x02, (R) 1 bytes,        // read control/battery register
i2c_read:  0x8c
i2c-2 (W): 0x04, (R) 1 bytes,        // read battery termination/fast charge current register
i2c_read:  0xca                        // charge current sense voltage = 27.2mV
                                // termination current sense voltage = 6.8mV

nothing too special, yet. But the printk's can be usefull when trying to find out how BME destroys VBUS, etc…

The diff for my printk's are attached.

blue_led 2010-05-19 22:24

Re: N900 will not allow USB OTG!
 
those messages are obtained with high power charger attached , right ?
so nothing special , bme reset 32 s timer 4 times per minute . too often i think but in charge mode any battery savings is nonsense.
bme don't destroy vbus , simply bme have no idea ( and code ) about vbus and host mode status.
code is written only for charging mode not charge or boost vbus

blue_led 2010-05-19 22:28

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by MohammadAG (Post 666416)
Applied the patches (they only seem to add a kernel message when echoing host), kernel built and flashed.
Raised power output to 5V using joerg_rw's command.
However I still can't get it to work, the flash drive gets rejected.
Code:

[ 3129.551940] kb_lock (GPIO 113) is now closed
[ 3129.716766] kb_lock (GPIO 113) is now open
[ 3163.176361] twl4030_set_host() 4030 OTG_CTRL=0x26
[ 3163.176635] twl4030_set_host() after 4030 OTG_CTRL=0x26
[ 3180.815826] usb 1-1: USB disconnect, address 5
[ 3181.091003] usb 1-1: new high speed USB device using musb_hdrc and address 6
[ 3181.240814] usb 1-1: rejected 1 configuration due to insufficient available bus power
[ 3181.240844] usb 1-1: no configuration chosen from 1 choice


try with a minimum 100 uF capacitor on vbus to avoid vbus drop ( early host specs don't throw with tomato )
681 if (int_usb & MUSB_INTR_VBUSERROR) {
682 int ignore = 0;
683
684 /* During connection as an A-Device, we may see a short
685 * current spikes causing voltage drop, because of cable
686 * and peripheral capacitance combined with vbus draw.
687 * (So: less common with truly self-powered devices, where
688 * vbus doesn't act like a power supply.)
689 *
690 * Such spikes are short; usually less than ~500 usec, max
691 * of ~2 msec. That is, they're not sustained overcurrent
692 * errors, though they're reported using VBUSERROR irqs.
693 *
694 * Workarounds: (a) hardware: use self powered devices.
695 * (b) software: ignore non-repeated VBUS errors.
696 *
697 * REVISIT: do delays from lots of DEBUG_KERNEL checks
698 * make trouble here, keeping VBUS < 4.4V ?
699 */
700 switch (musb->xceiv->state) {
701 case OTG_STATE_A_HOST:
702 /* recovery is dicey once we've gotten past the
703 * initial stages of enumeration, but if VBUS
704 * stayed ok at the other end of the link, and
705 * another reset is due (at least for high speed,
706 * to redo the chirp etc), it might work OK...
707 */

Dollyknot 2010-05-19 22:51

Re: N900 will not allow USB OTG!
 
We might want to operate hostmode without burning battery for VBUS boost, by using an externally powered hub.

Yeah we want to give our baby more energy, not take energy from it.


04-26-10 , 01:47 PM
Posts: 82 | Thanked: 9 times | Joined on Nov 2009 @ leicester UK

Report This | #1
Someone on one of the forums mentioned that the 'Memorex Travellink' could be used to transfer files from the n900 to a USB memory stick so I bought one.

Needless to say it did not work first time, but I thought it was still worth it because I could read and copy the SD card with it, so it would still be usable when I start travelling later on in the year.

Somebody posted an app to mount an exterior partition, so I downloaded it, plugged a USB stick into the Travellink and the n900 USB link 'coz I thought I could mount the stick with the downloaded app.

Much to my pleasant surprise, the Travellink was able to see files on my n900 and transfer them to my USB memory stick without the use of a PC or laptop, also it not did not need the mounter wizard.

What might have happened the first time is, I tried to do it without a fully charged battery, this time I tried with a fully charged battery, the perfect accessory for the traveller who wants to shoot lots of videos and store them on the road without carrying lots of kit.

The Travellink runs on three AA batteries, which I would imagine can be bought all over the planet.

MohammadAG 2010-05-19 23:25

Re: N900 will not allow USB OTG!
 
Compiled a kernel that works (finally! - thanks to joerg_rw for pointing out how to stop any power limits - my flash apparently needs more power).
I'll post a patch shortly.

I also got an HDD working, using the laptop as a power source, and without any "real" hub in between (using a Y cable though).

The echo host > ... part is redundant and doesn't do anything, so it can be left out.
Not sure about the patches, but it seems they only add messages to the kernel messages. Also I had to edit the .config file directly not the one in arch/arm/configs, since that didn't change anything (thanks to javispedro for that one)

Code:

[ 1617.796691] g_nokia gadget: high speed config #1: nokia1
[ 1617.796783] musb_hdrc periph: enabled ep5in for int IN, maxpacket 10
[ 1617.796783] musb_hdrc periph: enabled ep4in for bulk IN, maxpacket 512
[ 1617.796813] musb_hdrc periph: enabled ep4out for bulk OUT, maxpacket 512
[ 1617.796905] musb_hdrc periph: enabled ep7in for int IN, maxpacket 16
[ 1617.824737] musb_hdrc periph: enabled ep6in for bulk IN, maxpacket 512
[ 1617.824768] musb_hdrc periph: enabled ep5out for bulk OUT, maxpacket 512
[ 1619.233032] hub 1-0:1.0: Cannot enable port 1.  Maybe the USB cable is bad?
[ 1619.233093] hub 1-0:1.0: unable to enumerate USB device on port 1
# Was experimenting with something, ignore the 2 errors above ^
[ 1645.303344] usb 1-1: new high speed USB device using musb_hdrc and address 12
[ 1645.453826] usb 1-1: configuration #1 chosen from 1 choice
[ 1645.551605] scsi2 : SCSI emulation for USB Mass Storage devices
[ 1645.590362] usb-storage: device found at 12
[ 1645.590393] usb-storage: waiting for device to settle before scanning
[ 1645.838378] input: Western Digital  External HDD    as /class/input/input4
# No idea what this ^ is for, SpeedEvil suggested it could be for the LEDs on the drive.
[ 1645.892456] generic-usb 0003:1058:0705.0001: input: USB HID v1.10 Device [Western Digital  External HDD    ] on usb-musb_hdrc-1/input1
[ 1645.893554] usbcore: registered new interface driver usbhid
[ 1645.893615] usbhid: v2.6:USB HID core driver
[ 1650.585540] usb-storage: device scan complete
[ 1650.586639] scsi 2:0:0:0: Direct-Access    WD      3200BEV External 1.75 PQ: 0 ANSI: 0
[ 1650.619903] sd 2:0:0:0: [sda] 625142448 512-byte hardware sectors: (320 GB/298 GiB)
[ 1650.620391] sd 2:0:0:0: [sda] Write Protect is off
[ 1650.620422] sd 2:0:0:0: [sda] Mode Sense: 23 00 00 00
[ 1650.620422] sd 2:0:0:0: [sda] Assuming drive cache: write through
[ 1650.621154] sd 2:0:0:0: [sda] 625142448 512-byte hardware sectors: (320 GB/298 GiB)
[ 1650.621551] sd 2:0:0:0: [sda] Write Protect is off
[ 1650.621582] sd 2:0:0:0: [sda] Mode Sense: 23 00 00 00
[ 1650.621582] sd 2:0:0:0: [sda] Assuming drive cache: write through
[ 1650.621612]  sda: sda1
[ 1650.672180] sd 2:0:0:0: [sda] Attached SCSI disk
[ 2936.905181] usb 1-1: USB disconnect, address 12
[ 2937.256347] usb 1-1: new high speed USB device using musb_hdrc and address 13
[ 2937.405853] usb 1-1: configuration #1 chosen from 1 choice
[ 2937.405883] usb 1-1: new config #1 exceeds power limit by 100mA
[ 2937.435028] scsi3 : SCSI emulation for USB Mass Storage devices
[ 2937.473449] usb 1-1: 200mA is over 100mA budget for port 1!
[ 2937.473480] hub 1-0:1.0: 100mA over power budget!
[ 2937.476623] usb-storage: device found at 13
[ 2937.476623] usb-storage: waiting for device to settle before scanning
[ 2942.476196] usb-storage: device scan complete
[ 2942.477081] scsi 3:0:0:0: Direct-Access    SanDisk  U3 Contour      4.04 PQ: 0 ANSI: 2
[ 2942.477539] scsi 3:0:0:1: CD-ROM            SanDisk  U3 Contour      4.04 PQ: 0 ANSI: 2
# U3 enabled flash drive, the CD-ROM is emulated by the flash drive, it's not an actual CD-ROM, mind you a CD drive might be used with a self powered hub.
[ 2942.510925] sd 3:0:0:0: [sda] 16041617 512-byte hardware sectors: (8.21 GB/7.64 GiB)
[ 2942.511383] sd 3:0:0:0: [sda] Write Protect is off
[ 2942.511413] sd 3:0:0:0: [sda] Mode Sense: 03 00 00 00
[ 2942.511413] sd 3:0:0:0: [sda] Assuming drive cache: write through
[ 2942.516235] sd 3:0:0:0: [sda] 16041617 512-byte hardware sectors: (8.21 GB/7.64 GiB)
[ 2942.516540] sd 3:0:0:0: [sda] Write Protect is off
[ 2942.516540] sd 3:0:0:0: [sda] Mode Sense: 03 00 00 00
[ 2942.516571] sd 3:0:0:0: [sda] Assuming drive cache: write through
[ 2942.516601]  sda: sda1
[ 2942.530303] sd 3:0:0:0: [sda] Attached SCSI removable disk

Making the drive appear in file manager is **** easy, just create a directory in /media and mount the drive/flash to it.

http://i47.tinypic.com/wmkll4.jpg

http://i46.tinypic.com/m82rmq.jpg

http://i48.tinypic.com/1zxbq6g.jpg

egoshin 2010-05-20 00:48

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by MohammadAG (Post 666802)
[ 1645.838378] input: Western Digital External HDD as /class/input/input4
# No idea what this is ^ is for, SpeedEvil suggested it could be for the LEDs on the drive.

It is a CPU frequency boost on any event from your WD HD.


All times are GMT. The time now is 22:57.

vBulletin® Version 3.8.8