Active Topics

 


Closed Thread
Thread Tools
joerg_rw's Avatar
Posts: 2,222 | Thanked: 12,651 times | Joined on Mar 2010 @ SOL 3
#861
first draft for putting bq24150 into fastcharge mode at a reasonable charge end voltage, and keep it in charge mode until battery is full:

Code:
i2cset -y -m 0x77 2 0x6b 0x04 0xc9;
# next register 0x03 is device ID, always 4b and r/o; so we skip to 0x04
i2cset -y -m 0xff 2 0x6b 0x02 0x8c; 
# 0x8c = 3v5 + .640 + .040 + .020 = 4V200, BE CAREFUL and DON'T CHANGE 
# unless you know what you're doing. 4V2 is ABS MAX!
i2cset -y -m 0xff 2 0x6b 0x01 0xc8; 
i2cset -y -m 0xc0 2 0x6b 0x00 0x00; 

# tickle watchdog, while status indicates 'charging from wallcharger'
while [ $(i2cget -y 2 0x6b 0x00) = 0x90 ] ; do 
   sleep 28; 
   # reset watchdog timer:
   i2cset -y -m 0x80 2 0x6b 0x00 0x80; 
done
echo "charging finished, status(reg0)=$(i2cget -y 2 0x6b 0x00)"
above code not yet tested, but should result in

Code:
Nokia-N900-02-8:~# ~user/i2c/i2cdump -y -r 0-4 2 0x6b
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 90 c8 8c 4b c9                                     ???K?
which is what bme sets bq24150 to, during normal charge process

Usual disclaimer: this is addressed to developers only, who exactly understand the above code. ENDUSERS STAY AWAY


cheers
jOERG

Last edited by joerg_rw; 2010-05-14 at 13:13.
 

The Following 18 Users Say Thank You to joerg_rw For This Useful Post:
Posts: 82 | Thanked: 214 times | Joined on Jan 2010 @ Cape town
#862
According to the wiki, the reason given for BME being closed source is:
bme - Battery Management Entity: Security. A misuse of the could lead to serious battery damages that could result in liabilities for Nokia. hald-addon-bme is a related package, also closed.
Maybe a well written comment on the existing open source request for it (https://bugs.maemo.org/show_bug.cgi?id=9314) with info about what's been happening in this thread could help.

Failing that, maybe they would be so kind as to let a few people (egoshin / joerg / etc) have access to the code under an NDA...
 

The Following 2 Users Say Thank You to cb22 For This Useful Post:
joerg_rw's Avatar
Posts: 2,222 | Thanked: 12,651 times | Joined on Mar 2010 @ SOL 3
#863
sorry for the edits in post 2 above (charging), but while testing I found the registers need another sequence to be set correctly.
anyway now it is at least tested and working for what can be told by watching your shell

/j
 
javispedro's Avatar
Posts: 2,355 | Thanked: 5,249 times | Joined on Jan 2009 @ Barcelona
#864
Originally Posted by egoshin View Post
...
So basically there's NO changes other than enabling the charge pump? Dang it, so my supposed self-powered hub is a not as selfpowered as I though...
 

The Following User Says Thank You to javispedro For This Useful Post:
Posts: 992 | Thanked: 995 times | Joined on Dec 2009 @ California
#865
Originally Posted by javispedro View Post
So basically there's NO changes other than enabling the charge pump? Dang it, so my supposed self-powered hub is a not as selfpowered as I though...
Yet another changes to avoid whitelist and blacklist problems.

EDIT: I do not enable charge pump, it is impossible (read joerg). But to work as HOST some VBUS voltage is needed (read blue_led) and TWL4030 is an obvious candidate. I don't know - is it possible to use VBUS from 1707 chip (a real USB PHY) because checking it requires too much change in code - driver actively works with 1707 registers and intermixing both is difficult to predict.

And of course - the procedure... it is not suitable for normal use because it requires PC initially. I am working on that stuff right now, and first - try to use FORCE_HOST. However, it is not simple as a success experiment, it doesn't see anything at all, so I am looking into code and acquiring logic.

BTW, if joerg is successfull in setting VBUS charge voltage and workaround BME intervention it could be a solution for non-selfpowered hubs/HDs. I did an experiment with his command (first version) and it seems it works, at least until DSME shutdowns N900. I stopped do it for now because fast shutdown does too much confusion in results and I can't go far enough until mounting USB stick.

Last edited by egoshin; 2010-05-14 at 16:49. Reason: syntax
 

The Following User Says Thank You to egoshin For This Useful Post:
Posts: 992 | Thanked: 995 times | Joined on Dec 2009 @ California
#866
Originally Posted by joerg_rw View Post
first draft for putting bq24150 into fastcharge mode at a reasonable charge end voltage, and keep it in charge mode until battery is full:
Joerg, double check - is this code a replacement of BME which is supposed to be stopped by earlier published script?
 

The Following User Says Thank You to egoshin For This Useful Post:
javispedro's Avatar
Posts: 2,355 | Thanked: 5,249 times | Joined on Jan 2009 @ Barcelona
#867
Originally Posted by egoshin View Post
EDIT: I do not enable charge pump, it is impossible (read joerg). But to work as HOST some VBUS voltage is needed (read blue_led)
That's my issue here, I though you don't need vbus at all for certain devices. In fact I'm not still sure about this. I know that the driver as is disables the PHY when gaia's vbus sense is not asserted -- you must have seen this.
And of course without the (even if it's broken) pump and without a host connection it's surely not asserted. Pumping even a measly 3,0 V might mean that the useless-for-charger-detection vbus sense in gaia gets asserted, and the PHY turns on.

(Of course the less changes to the driver the better)

Originally Posted by egoshin View Post
And of course - the procedure... it is not suitable for normal use because it requires PC initially. I am working on that stuff right now, and first - try to use FORCE_HOST. However, it is not simple as a success experiment, it doesn't see anything at all, so I am looking into code and acquiring logic.
You mention that you need to select PC Suite mode. Does it work with USB STorage Mode? If it works only with PC Suite mode, I think it might have to do with g_mass_storage (weird suspicion). rmmod it and modprobe g_zero before switching to host.

Originally Posted by egoshin View Post
BTW, if joerg is successfull in setting VBUS charge voltage and workaround BME intervention it could be a solution for non-selfpowered hubs/HDs. I did an experiment with his command (first version) and it seems it works, at least until DSME shutdowns N900.
DSME reboots can be entirely disabled via a /etc file. The issue iirc is the rest of watchdogs, and even those can be disabled by a r&d flag.
 

The Following 2 Users Say Thank You to javispedro For This Useful Post:
Posts: 946 | Thanked: 1,650 times | Joined on Oct 2009 @ Germany
#868
An updated version of the kernel with egoshin's patches and
CONFIG_USB_GPIO_VBUS=m
CONFIG_USB_GADGET_DEBUG=y
is now available.

Originally Posted by titan View Post
I have build a special version of the power-user kernel with USB debugging and verbose enumeration enabled, and the USB blacklist+whitelist disabled.
Modules for all common USB device classes are already included (for USB/IP).
I hope it can help you to get USB hostmode working on the N900.

download and install in this order
http://maemory.com/N900/kernel/testi...mo28_armel.deb
http://maemory.com/N900/kernel/testi...mo28_armel.deb
http://maemory.com/N900/kernel/testi...mo28_armel.deb
the kernel configuration is http://maemory.com/N900/kernel/testi...ower_defconfig

good luck!
 

The Following 7 Users Say Thank You to titan For This Useful Post:
Posts: 75 | Thanked: 78 times | Joined on Jan 2010 @ Germany
#869
hi guys!

I've been following you on this thread for quite some time, and recently also in the chatroom. I'm really impressed by your work so far! Keep it going

I would like to join you in testing, I have a rather good knowledge of linux and also some hardware-level-experience of USB. But I'd still like some advice:
  • What would you recommend for checking the device health during testing, i.e. battery voltage/current(in/out)/temperature, VBUS level, etc. What are some interesting procfs/sysfs files to monitor?
  • Are there any important I2C registers to monitor? From the bq24150 (0x6b) or other I2C devices?
  • To which degree is debugfs and usbmon working in titans new kernel? Any (special) setup needed? (except mounting debugfs and modprobing usbmon)
  • Are there datasheets for the TWL4030 and the 1707 (could only find one for TPS65950 which is apparently similar (?) to the TWL)
  • And finally: do you know a (working) way to save/restore the whole filesystem in case anything goes wrong?

I think that's it for now… Would be great if you could give me some hints
Btw, it's not important if charging doesn't work, I have a desktop charger.
 
Posts: 946 | Thanked: 1,650 times | Joined on Oct 2009 @ Germany
#870
1) modprobe bq27x00_battery and check /sys/class/power_supply/bq27200-0
3) both are compiled in
ls /sys/kernel/debug/usbmon/
0s 0u 1s 1t 1u
5) always backup and be prepared to reflash

Originally Posted by hcm View Post
  • What would you recommend for checking the device health during testing, i.e. battery voltage/current(in/out)/temperature, VBUS level, etc. What are some interesting procfs/sysfs files to monitor?
  • Are there any important I2C registers to monitor? From the bq24150 (0x6b) or other I2C devices?
  • To which degree is debugfs and usbmon working in titans new kernel? Any (special) setup needed? (except mounting debugfs and modprobing usbmon)
  • Are there datasheets for the TWL4030 and the 1707 (could only find one for TPS65950 which is apparently similar (?) to the TWL)
  • And finally: do you know a (working) way to save/restore the whole filesystem in case anything goes wrong?
 

The Following 3 Users Say Thank You to titan For This Useful Post:
Closed Thread

Tags
awesomeness in the works, boulevard of broken deals, host, i am the dealbreaker, inspector gadget lies, mobidapter is a scam, nokia fanbois, otg, over 9000, usb, usbcontrol


 
Forum Jump


All times are GMT. The time now is 19:10.