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)

MohammadAG 2010-05-20 17:01

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by qole (Post 668016)
My experience with USB WiFi sticks and the N800 is that they need an external power supply to run.

That's most probably the case then, I'll get an AC adapter for my hub soon.

Slightly off topic, and a bit dangerous (cause of NOLO), but does anyone have 2 N900s to try flashing the other using the on board flasher?
(or if flasher-3.5 works for the N8x0 then someone with an N8x0 could try connecting the device to the N900 and running flasher (flasher, not flasher-3.5))

efekt 2010-05-20 17:08

Re: N900 will not allow USB OTG!
 
Odd and a bit off-topic, but why when I tried scrolling back a few pages in this thread I ended up being in http://forum.internettablettalk.com, and not http://talk.maemo.org? odd stuff... Did they change the domain? because if I replace the internettablettalk address with the talk.maemo address, I still get the exact same thread.

MohammadAG 2010-05-20 17:12

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by efekt (Post 668029)
Odd and a bit off-topic, but why when I tried scrolling back a few pages in this thread I ended up being in http://forum.internettablettalk.com, and not http://talk.maemo.org? odd stuff... Did they change the domain? because if I replace the internettablettalk address with the talk.maemo address, I still get the exact same thread.

tmo was itt before N900 times afaik (they were merged - so it's completely normal)
Back on topic...

lifenexus 2010-05-20 17:14

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by efekt (Post 668029)
Odd and a bit off-topic, but why when I tried scrolling back a few pages in this thread I ended up being in http://forum.internettablettalk.com, and not http://talk.maemo.org? odd stuff... Did they change the domain? because if I replace the internettablettalk address with the talk.maemo address, I still get the exact same thread.

the original forum was forum.internettablettalk.com now maemo.org uses it

joerg_rw 2010-05-20 18:40

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by blue_led (Post 667838)
for what reason bme read an idle/unused asic ( bq24xxx ) ?
as i understand from specs in charge or boost mode for sustaining those functions, some activity on i2c bus is needed.
if NO CHARGE mode why i2c read / writes activity ?. this useless activity drain the precious battery.
i will look closer on specs for a decent reason.

if vbus sensing for mode selection pop-up is needed instead of pulling status of BQ24k vbus sensing from 4030 via interrupt is preferred.

popup usb mode selection is not in bme or mce . what code is doing this selection ?



i wish a new one with:

pc suite mode ( never used )
mass storage
host ( docking station )
printer for photos ( pict bridge )
.....

VBUS sensing is to sense attachment of N900 to a host, while 1707 PHY pullup of D(+/-, depending FS, LS) is for sensing attachment of a device to N900.
Quite obviously attachment of a device to N900 can not be detected unless N900 is in hostmode.
So any popup requester offering a hostmode option ("host ( docking station )") is rather nonsense.

The whole hassle about VBUS-supply from N900 is just because we are not in a clean plain hostmode, and tricking the OTG statemachine from B-state into A-state includes a rather complex negotiation scheme about which of both OTG devices supposed to form the session is responsible now for providing VBUS power (if any of both) - so the OTG statemachine has quite a number of useless and partially nonfunctional tests like OTG_STATE-A_VBUS_RISE etc pp (exact names may differ), and we need to do a lot of messing around with VBUS supply to make these useless tests succeed.
For a plain vanilla correctly implemented hostmode, all those tests are moot and should be disabled.

and again what I believe will become my mantra and signature for the next few dozen posts:
We need to put "echo host >mode" to work, we need to switch PHY chip to host config which is 2* pulldown R.

titan 2010-05-20 19:03

Re: N900 will not allow USB OTG!
 
I can now successfully mount my USB stick and here is how I did it:
Warning: only for experts!! It may damage your USB device.
This not the real hostmode. It is an unstable hack to get some debug information.
1. install the kernel from (removed. insiders know where to find it)
(contains MohammadAG patch and hcm's i2c debug patch)
2. boot and connect N900 via USB cable to PC, select PC suite mode
3. execute the script
http://maemory.com/N900/kernel/usb/usb
4. connect your stick via USB F/F adapter to N900, wait a moment

The resulting syslog excerpt is here
http://maemory.com/N900/kernel/usb/syslog.gz
for this I enabled USB debugging 5 before connecting to PC,
so that we know what the driver does when switching to peripheral mode.

hcm 2010-05-20 19:16

Re: N900 will not allow USB OTG!
 
1 Attachment(s)
now, I have logged the I2C communication to BQ24150 for a whole charge-discharge-cycle.
I deleted lots of unnecessary lines from the logfile, but kept some stuff which is not directly related to i2c.
All i2c entries are just to device 0x6b (ensured by if-statement in the kernel sourcefile, logging all i2c-messages would be way too much to analyze)

I found out the following times which might be interesting:
- 00:29:07 started charging
- 02:16:23 battery is full (after that: sometimes charging, sometimes not => patented battery management :) )
- 09:07:11 unplugged charger
- 19:28:19 shutdown because of empty battery

the whole day, nothing was plugged into the usb port (I only played lots of videos to discharge the battery quickly ;) )

attached you find an image from batterygraph showing the charge/discharge. the log is too large, therefor its here (2,5MB)

javispedro 2010-05-20 19:20

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by joerg_rw (Post 668182)
We need to put "echo host >mode" to work, we need to switch PHY chip to host config which is 2* pulldown R.

Fully agreed. What is needed:
  1. Set up a special global variable that is asserted after otg_set_host
  2. When this global variable is asserted, disable all power saving stuff on the PHY
  3. Also make otg_set_host configure 1707 appropiately via Nokia's MUSB ULPI helper functions. Also ensure you power it before configuring.
  4. Ensure the 1707 remains configured (to check if item 2 was done properly)
What is missing:
  • List the places where the 1707 PHY is being reset, powered down, reconfigured..
  • Understand why the way the 1707 is currently configured doesn't match what we'd expect for normal peripheral operation.
  • And of course, what would be the correct 1707 configuration for host mode (might not be what the datasheet says, as per the above).

Note that I'm not sure what I'm talking about when I say "powered down." It might be low power ulpi protocol, it might be really powered down (but 1707 is connected to vbat?), ...

blue_led 2010-05-20 19:54

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by joerg_rw (Post 668182)
VBUS sensing is to sense attachment of N900 to a host, while 1707 PHY pullup of D(+/-, depending FS, LS) is for sensing attachment of a device to N900.
Quite obviously attachment of a device to N900 can not be detected unless N900 is in hostmode.
So any popup requester offering a hostmode option ("host ( docking station )") is rather nonsense.[/COLOR]

joerg you are partially wrong. from your point of view is nonsense because you want only host vanilla , cherry or any host flavor you want
BUT
i want a docking station with 7 usb A receptacle capable to power N900 while is in host mode . I want charge battery because the charging hardware is independent from usb controller

i can write a module doing what i want as appendices to a n900 in plain host mode with all vbus code removed
i don't give up on this
as a proof of concept i post a picture with a ACA with mini A receptacles for data and charger . this device can power and charge a device while this device is in plain host . in fact i don't know if this board can handle otg voltages & states and i don't care

2 month ago i tried on n900 this adapter but F..bme was in place

http://talk.maemo.org/showpost.php?p...5&postcount=17

egoshin 2010-05-20 20:17

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by joerg_rw (Post 668182)
We need to put "echo host >mode" to work, we need to switch PHY chip to host config which is 2* pulldown R.

I double checked that - both pulldowns are ON.

ID PULLUP may be missed sometime but DM and DP are pulldowned.

blue_led 2010-05-20 20:28

Re: N900 will not allow USB OTG!
 
afik if both data lines are low level this mean SE0 and ANY device peripheral or host ( even host ) can't use data channel.
if a peripheral is inserted into a host receptacle this is signaled by pulling d+ up so this differential "1" mean session can be started.
from peripheral POV those :R keep d- low for charger detection and d+ low for not initiate SRP because phy is MASTER on ulpi ( DIR signal is output on phy )
so all make sense

egoshin 2010-05-20 20:46

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by blue_led (Post 668370)
afik if both data lines are low level this mean SE0 and ANY device peripheral or host ( even host ) can't use data channel.

It uses 15K Ohm resistors.

EDIT: at least it looks like.

javispedro 2010-05-20 21:38

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by blue_led (Post 668313)
joerg you are partially wrong

Well, I think he's right. You cannot detect if a peripheral has been attached to the N900; you need to be in a "special" mode which forces the PHY to be powered, adequate pull up/downs, ....

It is theoretically feasible to be _always_ on this especial state, but I wonder about battery life...

Of course since you plan to use a self powered "docking station" you could use vbus sense for the task.

blue_led 2010-05-20 21:57

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by javispedro (Post 668463)
Of course since you plan to use a self powered "docking station" you could use vbus sense for the task.

yes, this is my goal.
i want to differentiate attachment to pc or attacment to self powered charging capable docking station

even in manually activated host mode vbus sense can trigger without manual selection charging mode

some misunderstandings because my english knowledge is limited

Benson 2010-05-21 00:53

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by eryx (Post 667130)
Can we use WiMax usb modem with this host mode? madwifi drivers theoretically can be easy compiled for N900.

Once host mode is working properly, yes, USB data modems of all varieties should work fine. But madwifi would have nothing to do with this -- USB data modems show up as a tty which is talked to with a modified Hayes command set.

The use of madwifi (or other wifi drivers) would be with a USB wifi stick; among benefits over the N900's wifi are 802.11a/n 5GHz band, and packet injection for aircrack-in-a-pocket. This (aircrack stuff) was done by some people on the N8x0 after OTG arrived, search about for exact details...

egoshin 2010-05-21 01:37

Re: N900 will not allow USB OTG!
 
Ha!

I found why N900 on USB-to-PC has a constant frequency 500MHz while USB cable from PC (not fast charger) is connected -

../../../arch/arm/mach-omap2/board-rx51.c:156: omap_pm_set_min_mpu_freq(dev, set ? 500000000 : 0);

... and it is called while resuming power for USB to communicate with gadget.

BLIZZARD 2010-05-21 04:37

Re: N900 will not allow USB OTG!
 
maybe try using easy debian? its a hole different os and also when i go to folder media it has mmc1, mmc2, and usb folders in it (i donts know if that helps)

eryx 2010-05-21 07:10

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by Benson (Post 668638)
Once host mode is working properly, yes, USB data modems of all varieties should work fine. But madwifi would have nothing to do with this -- USB data modems show up as a tty which is talked to with a modified Hayes command set.

The use of madwifi (or other wifi drivers) would be with a USB wifi stick; among benefits over the N900's wifi are 802.11a/n 5GHz band, and packet injection for aircrack-in-a-pocket. This (aircrack stuff) was done by some people on the N8x0 after OTG arrived, search about for exact details...

Sorry! I mean "madwimax" driver. I try this soon.

MohammadAG 2010-05-21 07:53

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by BLIZZARD (Post 668726)
maybe try using easy debian? its a hole different os and also when i go to folder media it has mmc1, mmc2, and usb folders in it (i donts know if that helps)

Host mode should be OS independant.

joerg_rw 2010-05-23 17:56

Re: N900 will not allow USB OTG!
 
http://mxr.maemo.org/fremantle/sourc...b_procfs.c#661

Code:

656        case 'H':
657                if (mbase) {
658                        reg = musb_readb(mbase, MUSB_DEVCTL);
659                        reg |= MUSB_DEVCTL_HR;
660                        musb_writeb(mbase, MUSB_DEVCTL, reg);
661                        /* MUSB_HST_MODE( ((struct musb*)data) ); */
662                        /* WARNING("Host Mode\n"); */
663                }
664                break;


titan 2010-05-23 21:10

Re: N900 will not allow USB OTG!
 
unfortunately it doesn't work. I already uncommented it during our last IRC session
and verified that one cannot force the chip to hostmode. It ignores the flag even if you properly also change the flag in the context register that is normally restored as suspend or during connect.
some other conditions need to fulfilled (device connected as peripheral?) for this flag to be effective.

Quote:

Originally Posted by joerg_rw (Post 671948)
http://mxr.maemo.org/fremantle/sourc...b_procfs.c#661

Code:

656        case 'H':
657                if (mbase) {
658                        reg = musb_readb(mbase, MUSB_DEVCTL);
659                        reg |= MUSB_DEVCTL_HR;
660                        musb_writeb(mbase, MUSB_DEVCTL, reg);
661                        /* MUSB_HST_MODE( ((struct musb*)data) ); */
662                        /* WARNING("Host Mode\n"); */
663                }
664                break;



joerg_rw 2010-05-24 03:47

Re: N900 will not allow USB OTG!
 
just to keep you up to date (quite some kernel patches were used, including FORCE_HOSTMODE for SoC musb. NO kickstart host PC involved).


for reference:
[2010-05-24 03:59:09] <javispedro> plug b-device into
[2010-05-24 03:59:39] <javispedro> n8x0:
[2010-05-24 03:59:40] <javispedro> [25277.234375] musb_stage0_irq 645: CONNECT (a_host) devctl 5d
[2010-05-24 03:59:40] <javispedro> [25277.234375] hub 1-0:1.0: state 8 ports 1 chg 0000 evt 0000
[2010-05-24 03:59:40] <javispedro> [25277.234375] usb usb1: usb auto-resume
[2010-05-24 03:59:40] <javispedro> [25277.234375] usb usb1: finish resume
[2010-05-24 03:59:40] <javispedro> [25277.234375] hub 1-0:1.0: hub_resume
[2010-05-24 03:59:43] <javispedro> ...
[2010-05-24 03:59:56] <javispedro> Status: MHDRC, Mode=Host (Power=f0, DevCtl=5d)
[2010-05-24 03:59:57] <javispedro> OTG state: a_host; active



N900:
[2010-05-24 04:35:46] <javispedro> Status: MHDRC, Mode=Host (Power=60, DevCtl=5f)
[2010-05-24 04:35:47] <javispedro> OTG state: a_host; active
[2010-05-24 04:35:50] <javispedro> that
[2010-05-24 04:35:55] <javispedro> devctl changed after pumping power
[2010-05-24 04:35:58] <DocScrutinizer> STRIKE!
[2010-05-24 04:36:14] <javispedro> [20987.088165] generic_interrupt
[2010-05-24 04:36:14] <javispedro> [20987.088256] musb_interrupt
[2010-05-24 04:36:14] <javispedro> [20987.088287] musb_interrupt 1818: ** IRQ host usb000d tx0000 rx0000
[2010-05-24 04:36:14] <javispedro> [20987.088317] musb_stage0_irq
[2010-05-24 04:36:14] <javispedro> [20987.088348] musb_stage0_irq 580: <== Power=60, DevCtl=c4, int_usb=0x5
[2010-05-24 04:36:15] <javispedro> [20987.088378] musb_stage0_irq 764: SUSPEND (b_idle) devctl c4 power 60
[2010-05-24 04:36:17] <javispedro> [20987.088439] musb_stage0_irq 960: BABBLE devctl: c4
[2010-05-24 04:36:21] <javispedro> interrupts!!!
[2010-05-24 04:36:24] <javispedro> my beloved interrupts.
[2010-05-24 04:39:02] <javispedro> 5f is "session started"
[2010-05-24 04:39:07] <javispedro> 5d isn't
[2010-05-24 04:41:04] <javispedro> I am stable in devctl=5f as long as I keep running i2cset

Icsoft 2010-05-24 13:04

Re: N900 will not allow USB OTG!
 
Does the new commit for meego help at all?
http://meego.gitorious.org/+meego-ar...7f2aca16d605e3

joerg_rw 2010-05-24 14:24

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by Icsoft (Post 673210)
Does the new commit for meego help at all?
http://meego.gitorious.org/+meego-ar...7f2aca16d605e3

Alas not really.
This are patches to expose a few values (of questionable relevance) from low level hardware stuff to sysfs-nodes, and similar. The whole purpose is to make bme blob work (or test if it does), under meego.
Nevertheless many thanks for sharing the pointer :-)

cheers
jOERG

javispedro 2010-05-24 18:29

Re: N900 will not allow USB OTG!
 
At least it's a bit cleaned up.

Tiptronic 2010-05-24 18:57

Re: N900 will not allow USB OTG!
 
So.. Impossible?

egoshin 2010-05-24 19:24

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by joerg_rw (Post 672582)
just to keep you up to date (quite some kernel patches were used, including FORCE_HOSTMODE for SoC musb. NO kickstart host PC involved).


for reference:
[2010-05-24 03:59:09] <javispedro> plug b-device into
[2010-05-24 03:59:39] <javispedro> n8x0:
[2010-05-24 03:59:40] <javispedro> [25277.234375] musb_stage0_irq 645: CONNECT (a_host) devctl 5d
[2010-05-24 03:59:40] <javispedro> [25277.234375] hub 1-0:1.0: state 8 ports 1 chg 0000 evt 0000
[2010-05-24 03:59:40] <javispedro> [25277.234375] usb usb1: usb auto-resume
[2010-05-24 03:59:40] <javispedro> [25277.234375] usb usb1: finish resume
[2010-05-24 03:59:40] <javispedro> [25277.234375] hub 1-0:1.0: hub_resume
[2010-05-24 03:59:43] <javispedro> ...
[2010-05-24 03:59:56] <javispedro> Status: MHDRC, Mode=Host (Power=f0, DevCtl=5d)
[2010-05-24 03:59:57] <javispedro> OTG state: a_host; active



N900:
[2010-05-24 04:35:46] <javispedro> Status: MHDRC, Mode=Host (Power=60, DevCtl=5f)
[2010-05-24 04:35:47] <javispedro> OTG state: a_host; active
[2010-05-24 04:35:50] <javispedro> that
[2010-05-24 04:35:55] <javispedro> devctl changed after pumping power
[2010-05-24 04:35:58] <DocScrutinizer> STRIKE!
[2010-05-24 04:36:14] <javispedro> [20987.088165] generic_interrupt
[2010-05-24 04:36:14] <javispedro> [20987.088256] musb_interrupt
[2010-05-24 04:36:14] <javispedro> [20987.088287] musb_interrupt 1818: ** IRQ host usb000d tx0000 rx0000
[2010-05-24 04:36:14] <javispedro> [20987.088317] musb_stage0_irq
[2010-05-24 04:36:14] <javispedro> [20987.088348] musb_stage0_irq 580: <== Power=60, DevCtl=c4, int_usb=0x5
[2010-05-24 04:36:15] <javispedro> [20987.088378] musb_stage0_irq 764: SUSPEND (b_idle) devctl c4 power 60
[2010-05-24 04:36:17] <javispedro> [20987.088439] musb_stage0_irq 960: BABBLE devctl: c4
[2010-05-24 04:36:21] <javispedro> interrupts!!!
[2010-05-24 04:36:24] <javispedro> my beloved interrupts.
[2010-05-24 04:39:02] <javispedro> 5f is "session started"
[2010-05-24 04:39:07] <javispedro> 5d isn't
[2010-05-24 04:41:04] <javispedro> I am stable in devctl=5f as long as I keep running i2cset

I got the same result with FORCE_HOSTMODE last week with 3.5V from TWL4030. For a moment it is a clear response from other side - "protocol violation" (BABBLE). I am reading USB docs now to understand why is it. Your log shows that the problem is not in 3.5V vs 5V - is it right, that you use 5V VBUS?

BTW, can you publish your actual commands to configure chip - it may help?

blue_led 2010-05-24 20:08

Re: N900 will not allow USB OTG!
 
i prepare for receiving tomatoes on my face ....
preface, facts
as i understand on n900 there is 4 usb channels the first one is otg capable and the last 3 are pure hosts. isp1707 chip is connected to first channel ( otg )
until now nothing new so concentrate to this otg controller
i read a mentor datasheet saying this controller is made with ~50.000 logical gates . this assembly may work stand alone or with help of core microprocessor like cheap soft "controllers", i don't care. some logic is inside this and kernel drivers must fit this.
if designers of this controller follow the otg specifications saying otg session ( & state machine ) start from peripheral i wonder how can force this state machine with almost generic kernel routines trying to trick this blackbox
if phy would be connected to host only port i don't have any problem, host kernel routines may fit well.
so if any hacker who attempt doing host work don't have full access to full datasheet of this controller to have a clear idea how it work, which command force host and which prerequisites are necessary we grope in the dark
my english prevent me to develop this ideas
i watched this thread and tried to help but i don't "see" anybody wonder about what is real otg controller
until now any success of host mode don't trick the specifications saying : start from peripheral mode & vbus valid ( over 4.4 V)

is host working on meego ?

javispedro 2010-05-24 20:20

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by egoshin (Post 673798)
BTW, can you publish your actual commands to configure chip - it may help?

At that point,1707 was not configured in any special way other than soft reset -- so yes, it is same as your old setup.

Some snippets...
Read / Set 1707 registers:
Code:

    case 'm':
        if (mbase) {
            u8 r;
            u32 l;
            r = gpio_get_value(RX51_USB_TRANSCEIVER_RST_GPIO);
            printk("RX51_USB_TRANSCEIVER_RST_GPIO = %hu\n", r);
            l = omap_readl(OTG_SYSCONFIG);
            printk("OTG_SYSCONFIG = %x\n", l);
            r = musb_ulpi_readb(mbase, ISP1704_OTG_CTRL);
            printk("ulpi read result isp1704_otg_ctrl=%hx\n", r);
            r = musb_ulpi_readb(mbase, ISP1704_FUNC_CTRL);
            printk("                isp1704_func_ctrl=%hx\n", r);
            r = musb_ulpi_readb(mbase, ISP1704_USB_INTRISE);
            printk("                isp1704_usb_intr_en_r=%hx\n", r);
            r = musb_ulpi_readb(mbase, ISP1704_USB_INTFALL);
            printk("                isp1704_usb_intr_en_f=%hx\n", r);
            r = musb_ulpi_readb(mbase, ISP1704_USB_INTSTAT);
            printk("                isp1704_usb_intr_stat=%hx\n", r);
            r = musb_ulpi_readb(mbase, ISP1704_PWR_CTRL);
            printk("                isp1704_pwr_ctrl=%hx\n", r);
        }
        break;

    case 'M':
        if (mbase) {
                u8 r;
                        r = ISP1704_OTG_CTRL_DP_PULLDOWN | ISP1704_OTG_CTRL_DM_PULLDOWN;
                        musb_ulpi_writeb(mbase, ISP1704_OTG_CTRL, r);
                        printk("writing otg_ctrl=%hx\n", r);
        }
        break;

Power up the 1707 (usually powered on/off by twl4030 vbus sense interrupts, so if you commented/removed them down it should not be needed).
Code:

    case '2':
        musb->xceiv->set_suspend(musb->xceiv, 0);
        break;

Then wait two or three seconds.

And configuring the bq vbus pump was done via user space as per DocScrutinizer instructions.

Note: after seeing all this myself I don't feel this is the right way. It's hard for me to explain a feeling, but basically, it's getting interrupts that would case the state machine to move on the n8x0, but it's not moving on the n900 -- for example one that wasn't quoted was a SESSION REQUEST while in a_wait_bcon.
Nothing happened, while on the N8x0 it would mean the state machine moves on to a_host state. After a while, when I killed the 5V pump, I got the BABBLE as the device died but the musb state machine didn't move either.

bhavinfirst 2010-05-25 10:58

Re: N900 will not allow USB OTG!
 
im sorry if it has been posted before but this seems to be a good alternative till some one gets the usb host working on n900.
http://www.airstash.com//support/index.html
At 99$ i think its worth it considering it features.

sarahn 2010-05-25 17:37

Re: N900 will not allow USB OTG!
 
Unfortunately I was not getting email notifications for this thread so I didn't realize there was work going on. This is awesome!

I am trying to quickly digest what all has happened since I looked last, there has been more than 20 pages of posts, so please excuse me for repeats. To summarize, it looks like
1. It is possible to force VBUS on by controlling bq24150 (I need to do some more reading here.)
2. host mode works by connecting to PC, use HNP, and then connecting to another device within 5 seconds (moving the state machine to b_host)
3. It is not yet possible to enter host mode without connecting to a PC first as described above.

Is this correct? Is there a wrapup of kernel patches somewhere?

Where I left off was getting a connection by forcing host mode w/ a power injecting cable, but the state machine entered the suspend state. Found some obvious places where that could cause problems but I haven't sat down to play with it again yet.

Thanks in advance.

joerg_rw 2010-05-25 20:16

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by sarahn (Post 676521)
Unfortunately I was not getting email notifications for this thread so I didn't realize there was work going on. This is awesome!

I am trying to quickly digest what all has happened since I looked last, there has been more than 20 pages of posts, so please excuse me for repeats. To summarize, it looks like
1. It is possible to force VBUS on by controlling bq24150 (I need to do some more reading here.)
2. host mode works by connecting to PC, use HNP, and then connecting to another device within 5 seconds (moving the state machine to b_host)
3. It is not yet possible to enter host mode without connecting to a PC first as described above.

Is this correct? Is there a wrapup of kernel patches somewhere?

Where I left off was getting a connection by forcing host mode w/ a power injecting cable, but the state machine entered the suspend state. Found some obvious places where that could cause problems but I haven't sat down to play with it again yet.

Thanks in advance.

Quite precise sum up, fine to have you on board again :-)
There are no kernel patches yet that would really help in entering hostmode directly. All patching so far was more like testing how the whole thing reacts, nothing of that will result in a kernel patch needed to put hostmode to work - probably even nothing of that is needed for the HNP fake hostmode stuff in the end.

sarahn 2010-05-25 22:49

Re: N900 will not allow USB OTG!
 
OK. As I said, I was pursuing forced host mode which AFAIK does require kernel patches. I have those posted back a ways though I do not know if it's the right strategy or not. Have you had a chance to look at those?

joerg_rw 2010-05-26 07:11

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by sarahn (Post 677333)
OK. As I said, I was pursuing forced host mode which AFAIK does require kernel patches. I have those posted back a ways though I do not know if it's the right strategy or not. Have you had a chance to look at those?

Javispedro (and me, talking nonsense ;-P) did tests with FORCE_HOSTMODE patches in kernel some days ago. See last post of mine with the IRC quotes. Javispedro missed the state transitions in the musb core state machine (if there is any?).
If you got full real hostmode working with a Y-cable for feeding VBUS, then we're already done, as we got the VBUS thing working by now (more or less, bme needs a kick in the a...)

:-)

cheers
jOERG

sarahn 2010-05-26 17:37

Re: N900 will not allow USB OTG!
 
HNP isn't workng for me; musb core goes into host mode but I don't get any urb or anything. Is a custom kernel actually required?

MohammadAG 2010-05-26 17:42

Re: N900 will not allow USB OTG!
 
Yes, the whitelist and blacklist options should be set to n, I'll PM you a precompiled zImage

blue_led 2010-05-26 20:02

Re: N900 will not allow USB OTG!
 
@egoshin & joerg
please try attempt to enter host mode following bellow sequence !
1 apply vbus from bq
2 set r15k
3 force session
4 clear R D+
5 force session end ( clear SESSION )

at this point bus must be SE0

6 force host
7 check / set r15k
8 clear fifo buffers( FLUSHFIFO )
9 apply vbus 5v bq
10 set R D+ ( fake peripheral )
11 set session bit
12 clear session bit ( no device on bus )

blue_led 2010-05-27 23:41

Re: N900 will not allow USB OTG!
 
from http://www.usb.org/developers/docs/usb_20_052510.zip i analize again ( n times) USB OTG and EH 2-0.pdf

for start FORGET a-device or embedded host state diagram because it is initialized by ID = 0 even twl4030 have an functional & valid id signal
look closer to otg B_device ( fig 7.3 - otg b device state diagram )
from start state machine will enter to b_idle state ( reason : id =1 )
the only one path to b_host state is through 2 intermediate stages
b_peripheral & b_wait_acon
to reach b_peripheral the only one condition is b_sess_vld and this is TRUE when the B-device above VOTG_SESS_VLD ( 0.8 - 4 V )
so attach to a pc and 3.5 v from any source is sufficient to reach this stage
let go further
b_wait_acon
the conditions to advance to this stage are:
b_bus_req TRUE during the time that the Application running on the B-device wants to use the bus
&
b_hnp_en TRUE when the B-device has accepted the SetFeature(b_hnp_enable)
&
a_bus_suspend ( real life : disconnect from pc and leave usb bus to settle down )

to enter b_host the condition is detection of a peripheral performing srp ( a_conn )

it is f.. simple . we can't see forest behind trees.
egoshin follow this path with success

so limitaton on real n900 device with not id pin hardwired : any a-state machine can not start, and bme with charger check procedure prevent bus to enter suspend state and my final conclusions are
as nokia deliver n900 ( with glorious bme ) can't perform otg as everybody know that
the only host hope for us is b_host and i am confident it can be reached without a pc

flailingmonkey 2010-05-28 06:32

Re: N900 will not allow USB OTG!
 
I have started to wonder if Nokia is actually not allowed to assist in these efforts to determine how to manually turn the USB controller to hostmode, due to USB Consortium crap, or if its just due to the bme system being closed-source. Does the partial OTG software implementation in the drivers provide any actual benefits beyond pure peripheral mode? Or is it there because they started work on OTG and realized they couldn't finish it, and reworked that code instead of removing all the OTG-ness.

I have been wondering about literally hacking the bme. basically, the program would not change, and maybe with the magic of LD_PRELOAD and some tracing, we'd fake out the syscalls/library calls it would make (akin to how rootkits hide themselves).

titan 2010-05-28 08:08

Re: N900 will not allow USB OTG!
 
FYI: I had a_host working (after connecting to PC) but it was difficult to reproduce

EDIT: oops. just noticed javispredo also mentioned in his post...

IRC log from last week:
Code:

musb_stage0_irq      580: <== Power=e9, DevCtl=dd, int_usb=0x10
[23:51] t-tan: [  637.942199] musb_stage0_irq      875: CONNECT (a_host) devctl dd
[23:51] t-tan: interesting. havent seen this before (a_host)
..
[23:53] t-tan: before: musb_stage0_irq      859: CONNECT as b_peripheral???                                         
[23:53] t-tan: May 20 20:47:24 T900 kernel: [  99.135070] musb_stage0_irq      875: CONNECT (b_peripheral) devctl dd
[23:53] t-tan: with my new patch

Quote:

Originally Posted by blue_led (Post 684310)
so limitaton on real n900 device with not id pin hardwired : any a-state machine can not start, and bme with charger check procedure prevent bus to enter suspend state and my final conclusions are
as nokia deliver n900 ( with glorious bme ) can't perform otg as everybody know that
the only host hope for us is b_host and i am confident it can be reached without a pc



All times are GMT. The time now is 15:09.

vBulletin® Version 3.8.8