• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[Nook HD/HD+ CM10.1] Charger control development

Search This thread

starbright_

Senior Member
Apr 11, 2010
1,340
223
Very useful to charge it with higher rate when connected to PC.
However - can this kernel change you mentioned be part of "standard" kernel? With this it is just the app you need and no problem with automatic nightly updates ...

To speak frankly, I didn't test it until now, but would it be good to provide the app with a few buttons with different charge rates (500mA, 1 A, 1.25 .. 1.5) so that user has the choice to select that best matching rate for the charger? (I hope I didn't misunderstand the feature of setting the rate by register values).
 

verygreen

Senior Member
Feb 13, 2011
1,305
2,637
TN
linuxhacker.ru
Very useful to charge it with higher rate when connected to PC.
However - can this kernel change you mentioned be part of "standard" kernel? With this it is just the app you need and no problem with automatic nightly updates ...
It is part of standard kernel now, so if you use CM nightlies or any of my recent binary drops, it's already in and you just need to install the app.

To speak frankly, I didn't test it until now, but would it be good to provide the app with a few buttons with different charge rates (500mA, 1 A, 1.25 .. 1.5) so that user has the choice to select that best matching rate for the charger? (I hope I didn't misunderstand the feature of setting the rate by register values).
Sadly there's no real choice available here from the controller
If we do manual control, we can do 100mA or ~1.2A only (and even then some chargers like those targeting iDevices are somehow rejected from any high rate charging access in hardware).
Then if there's autodetecting, then it's again 500mA or ~1.5A (also iDevices targeting charges are discriminated against and they certainly are not utilized even for 500mA for some reason).
 
  • Like
Reactions: starbright_

starbright_

Senior Member
Apr 11, 2010
1,340
223
OK, but I also don't want to charge my battery from my laptop if I am running on battery.

From my experience the charge current (without any app, so just per default), is so small, that even Android isn't change to charge mode.
What I found is, that I need (Nook in standby, so almost no consumption) a night to charge - so it can't be much.

Sure, if even this is to much, than you would need this feature (if this is possible).
 

kmika

Member
Jun 26, 2009
14
1
cm10.2 fstrim kernel

This is sounds good but I would need an fstrim enabled / charger tweaked kernel for CM10.2 nighlies. Is such a thing exists ?
 

Tom2112

Senior Member
Apr 14, 2011
181
39
Western PA
The registers 00 and 08. When register 00 is 0x34 - that's indication of 1.2A, 0x32 = 0.5A, 0x30 = 0.1A, 0x37 should be 3A (When connected to power).

Also a battery-reported current is shown, this is your main clue about how much power does the battery really gets, negative values = discharging.

Is there any chance you could update the app to include the above information on the screen? I can never remember what the register values equate to amperages.

Also, could you identify some kind of unit for the battery-reported current? Is that miliamperes/hour or what?
 

verygreen

Senior Member
Feb 13, 2011
1,305
2,637
TN
linuxhacker.ru
Is there any chance you could update the app to include the above information on the screen? I can never remember what the register values equate to amperages.

Also, could you identify some kind of unit for the battery-reported current? Is that miliamperes/hour or what?
I guess it could be trivially added, though in reality there's this battery-reported current that is the important part and is accurate.
What good is a 1.5A value in the charger register if you can only draw 300mA anyway? ;)

Which is not to say I am not going to add it if I remember about it next time I look at these apps.
 
  • Like
Reactions: Tom2112

qingz

Senior Member
Jan 2, 2010
70
13
I am on CM10.2RC2. Do I need to flash your Kernel to support it? I ask it because my 2A car charger does not charge my Nook HD+ no matter how I set the switch.
 

JDMpire

Senior Member
Nov 21, 2008
363
23
Philly & Bangkok
I am on CM10.2RC2. Do I need to flash your Kernel to support it? I ask it because my 2A car charger does not charge my Nook HD+ no matter how I set the switch.

I believe so. At least with mine, before I flashed the kernel I could not get it to charge. Flashing the kernel and rebooting / wiping the caches, that made it work.

Its still a little wonky from time to time, like I need to enable and disable the changing control app, plug - unplug- plug back in the cable..ect to get it to work. I don't find fault in the app or kernel, I belive were doing the best we can with the tools at our disposal. Were using this device in ways never meant from the factory. I am quite happy with how mine runs (Carbon Rom), you just need to be patient from time to time as its slow.
 

qingz

Senior Member
Jan 2, 2010
70
13
I believe so. At least with mine, before I flashed the kernel I could not get it to charge. Flashing the kernel and rebooting / wiping the caches, that made it work.

Its still a little wonky from time to time, like I need to enable and disable the changing control app, plug - unplug- plug back in the cable..ect to get it to work. I don't find fault in the app or kernel, I belive were doing the best we can with the tools at our disposal. Were using this device in ways never meant from the factory. I am quite happy with how mine runs (Carbon Rom), you just need to be patient from time to time as its slow.
I did the same. "Flashing the kernel and rebooting / wiping the caches". "enable and disable the changing control app, plug - unplug- plug back in the cable..ect". Still not work for me on CM10.1 RC2.

BTW, after I flashed the kernel, my wifi and bluetooth can not be turned on. Fortunately, I did a backup before flash. After restore, wifi and bluetooth work again.
 
Last edited:

jbbandos

Senior Member
May 26, 2010
1,350
319
Brussels
Any chance of incorporating the kernel changes in cm11? I have an external battery that provides a 1A and a 2.1A ports, but my Nook hd+ won't charge from any, and your app doesn't seem to make a difference in CM11.
I can always try to open the battery and modify / solder something, but I am not sure of the changes that need to be done.

Sent from my BN NookHD+ using Tapatalk
 

tebra

Senior Member
Dec 8, 2010
454
91
Any chance of incorporating the kernel changes in cm11? I have an external battery that provides a 1A and a 2.1A ports, but my Nook hd+ won't charge from any, and your app doesn't seem to make a difference in CM11.
I can always try to open the battery and modify / solder something, but I am not sure of the changes that need to be done.

Sent from my BN NookHD+ using Tapatalk
Already included in CM11 kernel.
I have CM11 on my HD+ and I can charge from computer USB port at 1.2A with the NookChargerControl.apk
 

Jon Lee

Senior Member
Jan 12, 2014
220
365
Looks to me like the code that determines "cable" type and charging current comes from
/drivers/usb/otg/twl6030-usb.c

Code:
		if ((charger_type == POWER_SUPPLY_TYPE_USB_CDP)
		    || (charger_type == POWER_SUPPLY_TYPE_USB)) {
			status = USB_EVENT_VBUS;
			twl6030_status = USB_EVENT_VBUS;
			twl->otg.default_a = false;
			twl->asleep = 1;
			twl->otg.state = OTG_STATE_B_IDLE;
			twl->linkstat = status;
			twl->otg.last_event = status;
		} else if (charger_type == POWER_SUPPLY_TYPE_USB_DCP) {
			regulator_disable(twl->usb3v3);
			status = USB_EVENT_CHARGER;
			twl6030_status = USB_EVENT_CHARGER;
			twl->usb_cinlimit_mA = 2000;
			twl->otg.state = OTG_STATE_B_IDLE;
			twl->otg.last_event = status;
			twl->linkstat = status;
			twl->asleep = 1;
		} else {
			regulator_disable(twl->usb3v3);
			status = USB_EVENT_NO_CONTACT;
			twl6030_status = USB_EVENT_NO_CONTACT;
			atomic_notifier_call_chain(&twl->otg.notifier,
					status, twl->otg.gadget);
			twl->asleep = 1;
			goto vbus_notify;
		}

You could probably make a few changes here to force charging on non-standard chargers.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 17
    There were some requests into forcing the charger controller in the Nooks to allow higher rate charging from non-B&N chargers, I also was constantly annoyed by how my Nooks are always discharging when plugged into my computer with screen on because of only drawing about 500mA, where as the ports would happily provide 1A (development led by Apple).

    The work here is experimental and if you decide to try anything, you bear the risk of stuff frying and catching on fire (granted, I did not burn anything here yet, but who knows, this is electricity we deal with here).

    The "TRM" is here for anybody interested, sadly it does not match with what the hardware actually does in some important areas (also reflected in the driver comments). It looks like there is no real way to control the charging rate much, as soon as you write into draw rate register, it's two lowest bits are reset to 0 until D+/D- detection is performed, but then the detection resets draw rate back to appropriate defaults, huh? So this leaves us with two settints: 100mA or 1.2A

    Plus there's something else going on, e.g. all of my iPhone chargers that I happen to have around only provide about 1.5 Watts of power and the controller refuses to draw more than 500mA from it anyway. All the Android stuff chargers I have on the other hand work out of the box and allow Nook to draw about 1.2A from them (even the native charger does not seem to draw more than this, about 7.5W according to my Kill-a-Watt display and also according to the battery current rate reported by the battery).

    Anyway, I am providing two kernels, kernel for Nook HD+ and kernel for Nook HD
    Flash the appropriate one for your device.

    Then there's the control app: NookChargerControl.apk

    Run the app, and it will present you with the main switch at the top (ignore the second switch, it's from the earlier experimentation and currently does not do anything).
    If you flip the switch on, the charging is forced at 1.2A rate, no matter where you are connected (but see my earlier note about my iPhone chargers).
    In addition to whatever physical measurements you are making, thee are two clues displayed about stuff:
    The registers 00 and 08. When register 00 is 0x34 - that's indication of 1.2A, 0x32 = 0.5A, 0x30 = 0.1A, 0x37 should be 3A (When connected to power).
    Also a battery-reported current is shown, this is your main clue about how much power does the battery really gets, negative values = discharging.

    Tap anywhere on the screen to refresh the values, the battery rate reported sometimes takes several seconds to update, so do not panic if the values appear to be stuck for some time.

    If you decide to try this, please report back in the thread with your findings.

    In my testing, enabling the switch (while plugged into a computer) results in as much battery charging current as I am getting from B&N charger.
    1
    0x32 is 500mAh, so it tries to draw this much, but if charge current in the battery is 0, that means there's not enough power left after what's used by tablet itself with screen on.
    I have this problem with my iPhone chargers, not sure how the charger controller differentiates.

    Big win for me is with a computer port, where with the app and a new kernel I can draw much more current and keep battery charging even with the screen on

    Ahh, I got you. It is nice having it charge from computer. Didn't know if your ultimate goal was to get it to work with as many chargers as possible so was trying to give you more info.

    Either way, thanks for all the work you are doing and sharing to make our Nooks more enjoyable.
    1
    Very useful to charge it with higher rate when connected to PC.
    However - can this kernel change you mentioned be part of "standard" kernel? With this it is just the app you need and no problem with automatic nightly updates ...
    It is part of standard kernel now, so if you use CM nightlies or any of my recent binary drops, it's already in and you just need to install the app.

    To speak frankly, I didn't test it until now, but would it be good to provide the app with a few buttons with different charge rates (500mA, 1 A, 1.25 .. 1.5) so that user has the choice to select that best matching rate for the charger? (I hope I didn't misunderstand the feature of setting the rate by register values).
    Sadly there's no real choice available here from the controller
    If we do manual control, we can do 100mA or ~1.2A only (and even then some chargers like those targeting iDevices are somehow rejected from any high rate charging access in hardware).
    Then if there's autodetecting, then it's again 500mA or ~1.5A (also iDevices targeting charges are discriminated against and they certainly are not utilized even for 500mA for some reason).
    1
    Is there any chance you could update the app to include the above information on the screen? I can never remember what the register values equate to amperages.

    Also, could you identify some kind of unit for the battery-reported current? Is that miliamperes/hour or what?
    I guess it could be trivially added, though in reality there's this battery-reported current that is the important part and is accurate.
    What good is a 1.5A value in the charger register if you can only draw 300mA anyway? ;)

    Which is not to say I am not going to add it if I remember about it next time I look at these apps.