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)

egoshin 2010-05-07 06:53

Re: N900 will not allow USB OTG!
 
OK, good news:

1. I was able to set hardware in HOST mode with VBUS on. I don't remember for a moment - was it via TWL4030 VBUS boost or via "i2cset" usage (it is night in CA). However, looking into log I think - VBUS setup was a result of boost in TWL4030.
ARM CPU USB started work as HOST, recognized the new device attachment (I used USB memory stick) and tried to communicate.

2. musb driver was able to work in HOST mode which was triggered by CONNECT interrupt and tried to assign HUB, enumerate device and so on.

Not very good news (yet :))

3. session init with USB stick failed and I don't know yet - is it because of I/O error, USB stick underpowered or some protocol violation.

EDIT: - protocol error, msg type doesn't correspond to expected.

Note: I didn't switch ARM CPU USB to FORCE_HOST mode - just played with VBUS supply and tried use 'host' and 'H' commands.

Note2: don't believe file /sys/devices/platform/musb_hdrc/vbus - it says 'Vbus=off" permanently (programming error).

Note3: VBUS on discharge battery - 45min and 1/4 battery gone. But screen was constantly ON and intensive work in X-Term too.

SpeedEvil 2010-05-07 08:31

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by egoshin (Post 647513)
OK, good news:

1. I was able to set hardware in HOST mode with VBUS on. I don't remember for a moment - was it via TWL4030 VBUS boost or via "i2cset" usage (it is night in CA). However, looking into log I think - VBUS setup was a result of boost in TWL4030.
ARM CPU USB started work as HOST, recognized the new device attachment (I used USB memory stick) and tried to communicate.

It was my understanding that the twl4030 capacitor for boost mode was not there (in the schematic at least).

If this is the case, then VBUS is going to be very low - under 3V?
This might cause some semblance of activity on the port - but will not actually work.

External supply would be an easy way to test it. Or of course a voltmeter to verify.

cb22 2010-05-07 10:22

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by SpeedEvil (Post 647624)
It was my understanding that the twl4030 capacitor for boost mode was not there (in the schematic at least).

Mine too, in fact, a post earlier by joerg seems to state exactly that:

Quote:

We are missing some capacitor to put TWL4030 GAIA boostmode to work, but N1140 bq24150 USB Bat Charger chip is perfectly suited for that. The i2cset cmd you're asking about does exactly that: enable boost mode (aka supply VBUS) in bq24150

egoshin 2010-05-07 16:01

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by SpeedEvil (Post 647624)
It was my understanding that the twl4030 capacitor for boost mode was not there (in the schematic at least).

If this is the case, then VBUS is going to be very low - under 3V?

I didn't attach multimeter - my has too thick probes.
But VBUS voltage is confirmed by reading both - TWL4030 and 1704 registers:

A. File /sys/class/i2c-adapter/i2c-1/1-0048/twl4030_usb/vbus shows 1. The same value is in this file during attachment of PC USB host port or charger. It is from STS_HW_CONDITIONS of TWL4030.

B. ARM CPU USB module, DevCtl shows 0xd5 which means "VBUS above AValid, below VBusValid" or in my mind: 0.8v-1.4v < VBUS < 4.4v-4.6v. So, it should be enough, at least from 1707 point of view.

Quote:

This might cause some semblance of activity on the port - but will not actually work.
USB stick tried to establisjh attention via pullup/pulldown play with D+/D- in my understanding (but I don't know USB line protocol details). ARM CPU USB triggered interrupts about session start and under "full speed" protocol and indicated my "host session valid". And that happened only after a physical attachment of USB stick.

However, morning analysis shows that ARM CPU USB controller stayed as B-device (high order bit in DevCtl=0xd5). That probably means that N900 tries to swap roles with other side (became 'host') via HNP but USB stick doesn't understand it. (I used 'echo H >/proc/drivers/musb_hdrc')

Or it may be a physical error - morning analysis shows that N900 can't read anything from USB stick. It transmits but read stops due to timeout. (BTW, do we need to swap D-/D+ if N900 is a host?)

Equally, it is possible that some 1704 configuration must be changed. I found the same pullup/pulldown resistor table in TWL4030 description and driver setup it's properly for TWL4030 but in incorrect way for 1704 during regular USB run as a B-device disk.

And finally, you may be right - VBUS voltage is not enough to power USB stick. I will try with external hard disk next day.

javispedro 2010-05-07 16:13

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by egoshin (Post 647428)
The cable/hw patchwork is not enough, some additonal activity in driver is needed. I am working on it.

Yes, I was borking the driver.

Quote:

Originally Posted by egoshin (Post 647428)
configuration of 1707 DM/DP pulldown registers is done in reverse with document. What is it - document error or software bug which does still not produce a problem? I don't know but try to find, it actually changes the resitor values only.

Where are you seeing that? All I can see is that after Power on Reset http://mxr.maemo.org/fremantle/sourc...omap2430.c#420 id pin sampling and both dp & dp pulldowns are enabled (seemingly to enter OTG mode?).

When vbus is detected by twl3040 twl3040-usb fires a sysfs-node changed event (linkstat) which I believe bme is listening to, which then proceeds to read the charger sysfs node thus causing musb_verify_charger to run thus causing DP & DM pull downs to be disabled and strong pull up on DP to be enabled (thus entering gadget/peripheral mode).

Note that configuring twl3040 via i2c as the twl3040-usb driver does is for all practical purposes as I understand a NOP (save for reading/writing registers related to pins it has connected, like vbus or id). Only valid configuration of isp1707 is via ULPI.

Quote:

Originally Posted by egoshin (Post 647428)
Is VBUS voltage needed for 1707 to support ARM CPU USB in HOST mode? I am not familiar with USB protocol details yet to answer it fast.

No; for example self powered hubs should work without VBUS on host. Since there are quite a few cons to having the vbus pump enabled (bme will have to be lied at, possibly high battery consumption, ...) I suggest we center on enabling host mode _without_ vbus. It should be possible.

egoshin 2010-05-07 16:50

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by javispedro (Post 648244)
Where are you seeing that? All I can see is that after Power on Reset http://mxr.maemo.org/fremantle/sourc...omap2430.c#420 id pin sampling and both dp & dp pulldowns are enabled (seemingly to enter OTG mode?).

Table 14.
Operating states and their corresponding resistor settings
(only DP_PULLDOWN and DM_PULLDOWN are shown here):
...
Host high-speed ... 1b 1b
...
Peripheral high-speed ... 0b 0b
...
OTG device peripheral high-speed ... 0b 1b

You say you see both are enabled. Me too. But device is not in Host mode, right? At least TWL4030 has both zeroes until switch to host mode.


Quote:

When vbus is detected by twl3040 twl3040-usb fires a sysfs-node changed event (linkstat) which I believe bme is listening to, which then proceeds to read the charger sysfs node thus causing musb_verify_charger to run thus causing DP & DM pull downs to be disabled and strong pull up on DP to be enabled (thus entering gadget/peripheral mode).
I put a couple of debug prints in musb_verify_charger(). Never seen once. Will try to see it with a regular charger.

Quote:

Note that configuring twl3040 via i2c as the twl3040-usb driver does is for all practical purposes as I understand a NOP (save for reading/writing registers related to pins it has connected, like vbus or id).
To make TWL4030 configuration working I did some tricks - power registers are protected and you can't change some TWL4030 USB registers while it is sleeping.


Quote:

No; for example self powered hubs should work without VBUS on host. Since there are quite a few cons to having the vbus pump enabled (bme will have to be lied at, possibly high battery consumption, ...) I suggest we center on enabling host mode _without_ vbus. It should be possible.
Good!
I will think and continue Saturday.

blue_led 2010-05-07 16:52

Re: N900 will not allow USB OTG!
 
3 Attachment(s)
from datasheet of 1704
"8.7.2.1 VBUS valid comparator
This comparator is used by hosts and A-devices to determine whether the voltage on
VBUS is at a valid level for operation. The ISP1704A minimum threshold for the VBUS valid
comparator is 4.4 V. Any voltage on VBUS below this threshold is considered invalid.
During power-up, it is expected that the comparator output will be ignored.'"


if otg controller expect a valid vbus on isp1704 vbus probe pin maybe this is the reason for timeouts

do a voltage check with a voltmeter . if vbus is below 3.3V this voltage come from isp1707 internals.
............
OTG controller ALWAYS start a FS session even if a HS device is attached .
................
check also usb documentation especially appendix C you will find some C code at de end of document

@javispedro
Quote:

Or it may be a physical error - morning analysis shows that N900 can't read anything from USB stick. It transmits but read stops due to timeout. (BTW, do we need to swap D-/D+ if N900 is a host?)
NO . this setting is for swapping receptacle on the other side of the printed board to avoid datalines cross over and traces be routed on one single board layer.


this post will be edited later with additional informations

daperl 2010-05-07 17:03

Re: N900 will not allow USB OTG!
 
You guys should see some interesting output when plugged into that DC <-> uB adapter dongle. My n900 "sounds" likes it trying to talk to that thing constantly. Maybe it's time to get an extra one of those and crack it open.

egoshin 2010-05-07 17:04

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by blue_led (Post 648296)
from datasheet of 1704
"8.7.2.1 VBUS valid comparator
This comparator is used by hosts and A-devices to determine whether the voltage on
VBUS is at a valid level for operation. The ISP1704A minimum threshold for the VBUS valid
comparator is 4.4 V. Any voltage on VBUS below this threshold is considered invalid.
During power-up, it is expected that the comparator output will be ignored.'"


if otg controller expect a valid vbus on isp1704 vbus probe pin maybe this is the reason for timeouts

Hm-m... But it definitely transmits... Or it may be a comparator for validity check to supply a valid VBUS from 1707?

Quote:

do a voltage check with a voltmeter . if vbus is below 3.3V this voltage come from isp1707 internals.
I don't think so - until I programmed TWL4030 I didn't see any VBUS voltage above VSESSVALID (0.8v - 1.4v) or in ARM CPU USB description - "Above session end, below AValid".

EDIT: "Above AValid, below VBusValid" - sorry for confusion, still sleepy.

blue_led 2010-05-07 17:52

Re: N900 will not allow USB OTG!
 
i think all tests must be done respecting this minimals :
--without bme running
--charger detection disabled inside 1707
-- 5V applied from external source to 1707
this make valid vbus for A state machine

a hacked cable is needed :)


All times are GMT. The time now is 04:18.

vBulletin® Version 3.8.8