yashsingh1/xdaforums huggingface dataset:
[Nook Color Android Development] verygreen:
The driver just queries the battery controller directly for everything, that means the "time to discharge", "remaining capacity", "voltage", "temperature", "discharge rate" and a few other parameters.

What is happening in the battery controller itself I don't know.
[Nook Color Android Development] Narfx:
Attached is a screenshot of what I described before. Note that the charging bar is empty during the positive slope periods marked in blue.
[Nook Color Android Development] TDO:
No PBD yet but a massive battery jump

4138mV 99%

4088mV 92%

3973mV 78%

3678mV 59%

turned the nook off

after turning it on again after about 12 hours

3716mV 26%

BOOT DEVICE: SD

MLO: BN 1.2 stock

U-BOOT: multiboot

KERNEL: Dalingrin's 2.6.32 (5/13) OC kernel

OVERCLOCKED?: to 1100

GOVERNOR: Conservative

SYSTEM: CM7 Nightly 85

PBD: Not yet

TEST COUNT: 1x

TRIED REVERTING TO OLDER HC/CM7: NO

TRIED WIPING CACHE/DATA?: NO

DID IT WORK? NO

PREVIOUSLY INSTALLED:

eMMC

Stock 1.1

Stock 1.2

SD

Phiremod 6.2
[Nook Color Android Development] Animec:
And now it turns out my nook no longer goes into deep sleep like it should. It's barely spent an hour out of ten in deep sleep tonight.

On another note, does anyone have a 1.1 uboot handy? Pretty please? :)
[Nook Color Android Development] derekr:
@jared-c

I believe that the A/D converter on that chip is only 10 bits (1024 discrete values), so I doubt that it is what is being used to monitor battery levels.
[Nook Color Android Development] paleh0rse:
That was after you did the "HC fix," correct? Have you experienced PBD since then?
[Nook Color Android Development] khaytsus:
No way that it was PBD if you were at 3913mV, are you sure you didn't just get a SOD? Could you hard power it off and back on, or would it only power back on if you charged?
[Nook Color Android Development] angomy:
It would only turn back on on the charger --- I spent several minutes trying to turn it on with holding the power button for several seconds at a time while waiting for the screen to turn on (blank vs true black), no go.

I suspect the battery stats were completely borked --- while it was charging back up again I was peeking at spare parts in intervals. It charged from 43%-87% in close to 30 mins, then spent 2 hours between 87%(4100 mV) to 98%(4197), then the cable light turned green at 98% (4198mv) and it didn't get to 100%(4200) for another half hour.

Edit: Going to revert back to 1.2 stock then flash without the OC kernel or cyanboot 1.2 and see if I get another PBD tonight.
[Nook Color Android Development] boxcar8028:
here you go
[Nook Color Android Development] heliosue:
I have been debating about posting this, since I am pretty much in over my head here, but perhaps my observations might be of some use.

A few days ago, I moved from Phiremod 6.2 to CM7 nightly 85. Wiped system, data and cache. I used fattire’s u-boot (not the untimely one) and the updated MLO. No O.C. For two days in a row I had PBD at 29%. Deep sleep seemed to be working. No wifi issues.

Yesterday, I flashed nightly 87, and again, wiped everything except boot, used CWR to clear battery stats, calibrated my battery and installed OC 5/23/2011. Playing Angry Birds to run it down, I got all the way to the 15 % warning. I didn’t let it go all the way to 0% but I will try that tonight. What may prevent this information from being useful, is that when I was using Phiremod 6.2, I never let my battery go lower than 40 or 50 % so I don’t know that the n85 or the prior u-boot caused the PBD problem.

The other thing that has happened the last two nights, is that when I turn off my NC and charge it (AC), it goes into deep sleep, according to CPUspy, but when I wake it up in the morning, the "n" on the charging cable is green but the battery indicator is still reading the % that I was seeing when I turned it off the night before (42% and 53%). When I disconnect the charging cable and hit the home button, the battery indicator immediately jumps up to 99%. (probably not important).:confused:
[Nook Color Android Development] chisleu:
I didn't see PBD on beta 3.1, and can't reproduce it on 3.1.

Try that.

I ran a full battery out after reverting to 3.1 beta (still using the 5/23 OC kernel.)

I had 2 instances of SODish lockups (had to long press power to reset.)

It didn't have any instances of PBD.
[Nook Color Android Development] khaytsus:
Hmm, but I'd think the voltage would be right always, just not necessarily the percentage.

BTW today I ran my NC down to 2% and I saw it dip to below 3V and it immediately shut off, left it on the charger to get to 100% and I'll just use it normally from here.

I still see strange drops/jumps in percent..
[Nook Color Android Development] leapinlar:
OK, I have some interesting news for ya'all.

I had the PBD problem running N87 and OC 5/23. It kept shutting itself off at around 35%. So I charged just a little, reflashed to stock 1.2 (keep CWM), booted and ran it for a bit, and battery was 11% instead of the 35%. Then flashed 7.0.3 (no overclock) and ran it for a day with no battery problems.

I had made a backup of my N87 setup so I flashed back to that today. Battery stayed at about 68% where it was before I flashed it. Ran it for a while including letting it deep sleep for a while and battery was fine. Then I decided to try my non-nook charger cable on it. I charged for about 5 minutes and the battery jumped to 100%. (From 68% to 100% and the voltage stayed at 3875 mv.)

To fix it I booted with my CWM SD (no system on it), and I did nothing but remove the SD and select reboot. It booted back up into N87 with the battery saying 65%.

I was able to re-create the situation a second time by a combination of sleeping and charging with the non-nook cable. Next I will see if it's repeatable using the nook cable.

Two interesting things, 1st, PBD seems to have something to do with deep sleep and/or charging. 2nd, it is easily fixed by rebooting from a CWM SD card.

I hope this helps someone figure out what's wrong.
[Nook Color Android Development] leapinlar:
OK, I was not able to re-create the situation using the nook cable, but was able again to make it do it with the non-nook cable. So I think the nook thinks it's hooked to a USB port and charges accordingly. Maybe this will give the gurus here some clues.
[Nook Color Android Development] skwalas:
I have observed similar behavior using a CWM bootable sd card (using 3.0.2.8).

In fact, it was when i was getting ready to do the full 1.2 revert the first time and wanted to check to make sure my brand new cwm card worked, that i first noticed this "drop" that occurred after booting with it. So now I wonder... was it the cwm bootable that actually fixed it that time, or the 1.2 revert???

Edit: I had a pbd on Thursday night (22%) and could make it happen repeatedly. then i went on vacation, so was in standby/deepsleep from friday 4pm till today 8pm. (52hrs). When i turned it on, it read 99%, then about 2 min later dropped to 77% (i assume it was "setting" itself after being in deep sleep, but that still translates to 0.4%/hour even in supposed deepsleep?) Anyway, based on the above about CWM, decided to grab my CWM bootable card, boot up into it, then hard shutoff to remove card and boot back to CM7. there was an instant 6% drop in battery percentage (not big, but, not expected either). I've been watching % and mV in spare parts closely all night, still above 3600mv and i'm now at 14%! got the 15% warning a little bit ago.

Conclusion: booting ONLY with the CWM bootable recovery card (3.0.2.8) appears to fix this pbd too, in similar fashion as the hc sd does. (or less likely, let it sit for 52 hours, but this would just be weird).
[Nook Color Android Development] mutant13:
Just died at 5%.... I used CWM SD to wipe Batt stats, then ran HC SD for about 15 min...I did all this after a full charge, I have changed nothing still stock 1.2 rooted MN27, using Dals OC 5/13 kernel 1.2g ondemand... it took me 2 days to kill the battery from 100%...I got a warning at 20% 15% and finally the critically low warning at 5% then turned off .... don't know if any of this helps...
[Nook Color Android Development] deadbot1:
So last night I was reading using the Nook app. I got down to 23%. Put it to sleep by power button press. Woke up to thunder around 4am(roughly 5 hours)... 45%. Woke up at 7:30...65%. Used it for long enough to write this....45%....very strange.
[Nook Color Android Development] Narfx:
Yep, that's what I reported in the first post of the previous page. Sometimes sleeping borks the calibration.
[Nook Color Android Development] quikt:
This may be a coincidence but i just started having PMD on n87 and latest oc kernel. This started after i set the screen size to 180 from 161. I had been running fine for about 2-3 days. After first PMD im also having an increase of sleep of death. Anyone else changing their screen size?
[Nook Color Android Development] heliosue:
In reference to my post yesterday (p.11, post 109#) I definitely got deep sleep for about 10 hours, I got the 15% warning, and went into PBD at 7%. Voltage was 3.089. I have attached a portion of my battery log to show the weird thing that happens as I charge my NC overnight and unplug and wake it up in the morning (last three days.)
[Nook Color Android Development] jared_c:
Alright, here's where I start looking foolish. :-) So, I cloned all the trees under github/CyanogenMod. Now, can someone please show the poor systems engineer where to find the driver code? I've poked around in the encore tree and the kernel-omap tree, but nothing is jumping out at me.

Thanks
[Nook Color Android Development] MedLine:
somebody else chime in, but ...

did you clone cm-kernel tree, then i think in general battery drivers at "/android/kernel/cm-kernel/drivers/power"

also, might want to look at "ti-omap-encore-kernel" tree at verygreen github, "nook_kernel" tree at dalingrin github, as well as B&N source
[Nook Color Android Development] fattire:
The .32 kernels that are included in the regular CM7 nightlies come from dalingrin's github repo- the encore-32 branch I believe, which builds off of BN's source. It includes a few additions from verygreen's .32 kernel, the bluetooth driver backport from .35 and a few other things. dalingrin's world-famous OC kernel is in the encore-32zOMG branch.

The verygreen .32 kernel you reference was the basis of development for a while in .32 and is based on TI's repo I believe. I don't think it includes the new pm additions found in BN's source, (he can clarify).. it may be interesting to try this kernel-- I dont' remember experiencing any PBD with it, but it wasn't something I tested.

And finally, github/verygreen/u-boot-encore has the 1.2 u-boot stuff, starting with BN's source and building from there. The master branch has verygreen's SD "Changes to allow booting off SD card and to relax recovery trigger from keyboard a bit" only. The "logo" branch has my additional fixes to the logo palette + new images from drakknar, and the "menu" branch includes a console (if you want to watch u-boot start for any reason-- see commits) as well as the various incarnations of the u-boot menu (up to the current "cyan edition").
[Nook Color Android Development] fattire:
If you are planning on building CM, or even exploring the code... take a look at the CM wiki for some perhaps-helpful instructions.
[Nook Color Android Development] phenol312:
TEST CONFIGURATION:

BOOT DEVICE: eMMC

MLO: BN 1.2

U-BOOT: BN 1.2

KERNEL: Dal's 2.6.32.9

OVERCLOCKED?: 800-1200mhz

GOVERNOR: Conervative

SYSTEM: CM7 Nightly 87

PBD: YES

TEST COUNT: on going lol.

TRIED REVERTING TO OLDER HC/CM7: NO

TRIED WIPING CACHE/DATA?: YES

DID IT WORK? NO

PREVIOUSLY INSTALLED:

☑ Stock 1.0

☑ Nookie Froyo (any)

☑ Honeycomb (any)

☑ CM7 2.29 (any)

☑ CM7 2.32 beta 3

☑ CM7 nightlies > 84 (or whenever .32 appeared)

Had PBD the past few days. Seemed to initially occur when the battery got around 50%...I think its getting worse. I left the house today for about 2 hours having a full charge on the nook and when I came back I couldn't get the screen to turn on. I did a hard reset and when I powered it back up the battery shows a charge of 85%. Very bizarre...just wanted to contribute my experience in the hopes it might be of any aid to someone investigating the issue.
[Nook Color Android Development] :
Unless you used a cable to power it back up, it's not PBD. It's SOD.
[Nook Color Android Development] phenol312:
Ah i see. In that case I've only had one case of PBD, the other two occasions have been SOD. Strange, that I've been with CM7 since its release and ive never had a SOD issue until nightly 87...
[Nook Color Android Development] keyodi:
One of the source files for the u-boot (max17042.c) reads data from a file called max17042.bin, which is located on the 2nd partition (mmcblk0p2). Does this file also record battery stats? It may explain why the battery percentages change when booting with different roms.

Additional info: It seems the file(max17042.bin) only gets updated when I boot with BN 1.2, but not when booting to CM(N86)...Maybe something in CM7 is preventing access to partition mmcblk0p2 in order to correctly update the file????
[Nook Color Android Development] leapinlar:
How many of you that have experienced PBD had used an ordinary USB micro B cable with their Nook and an a/c or d/c adapter or PC? (Even just once). My experience is that using such a cable while charging triggers a bad battery calibration which leaders to PBD.
[Nook Color Android Development] angomy:
TEST CONFIGURATION:

BOOT DEVICE: eMMC

MLO: BN 1.2

U-BOOT: BN 1.2

KERNEL: Dal's 2.6.32.9

OVERCLOCKED?: not OC kernel, OC'ed w/ native n85 @ 925Mhz

GOVERNOR: Conservative

SYSTEM: CM7 Nightly 85

PBD: No

TEST COUNT: 1 for this version, 3rd overall

TRIED REVERTING TO OLDER HC/CM7: no

TRIED WIPING CACHE/DATA?: yes

DID IT WORK? yes

PREVIOUSLY INSTALLED: Stock 1.2 B&N

Notes: I had had previous PBDs in two configurations (both EMMC): nightly 87 w/o OC kernel running at 925Mhz with 1.2 untimely fattire u-boot (flashed zip after installing 87), and nightly 87 WITH 05/23/11 OC kernel @ 1100Mhz with cynaboot fattire u-boot. My first EMMC install was on stock unrooted 1.2.

Restored Nook to unrooted, factory-default stock 1.2 using the zip + instructions here. Installed using CWM card nightly 85 (the last .32 nightly I could recall not having the newly modified u-boot) + gapps. Did not install OC kernel, but did OC native kernel to 925Mhz/conservative. Ran battery in intervals -- let it deep sleep for 2.5 hrs, then again for ~5.5 hrs (checked with CPU Spy). Late tonight it got down to 15% battery life (3568mV) and gave me a "low battery" warning. It shut down at 10%, though I could not confirm exact stats until I had to boot it up while plugged in (spent several mins making sure it was dead) and upon booting CM7 found the battery at 11% (3169mV).

If I wanted to test nightly 87 again without the modified 1.2 u-boot, what files should I transfer from my current install aside from u-boot.bin (MLO, ?)?

Edit: I have not used anything but the USB cable that came with the Nook because of the voltage difference between it and regular USB cables.
[Nook Color Android Development] skwalas:
New behavior: I'm sitting here with my nook, watching it "charging". But the charger is on the other side of the Room! The nook is not connected to anything.

The battery percentage is going down (currently at 35%) as is the voltage (3710 per spare parts)

Battery icon is doing the charging thing. Spare parts says "charging" for current status, and ...

I just took a look at battery use under settings: it thinks I've been charging for the last 24 hours! I took it off at 8 this morning...

W... T... F?
[Nook Color Android Development] Rottgrub:
Great work. Rather than a service, couldn't you just change the file into a symlink pointing at histdat? Then it would always contain the most recent data.

Cheers.

Sent from my Nexus S
[Nook Color Android Development] pryonix:
i'm going through the same thing ever since i shifted from phiremod 6.2 to CM7N87 two days ag. i've had SOD happen to me 3 times already since then.

SOD never happens when i'm actively using the nook though. the past 3 times it happened was when i left the nook by itself for around 30+ minutes unplugged.

i'd come back and see the nook already turned off and i needed to long press on the power button so that it would boot back up (but no, i never needed to connect it to the charger for it to turn on).

additionally, i've been observing my battery expenditure closely and i haven't noticed anything weird going on with the battery.

another observation: the times SOD happened to my nook were times that either a) i moved out of wifi range or, b) i left the nook in my room long enough that the wifi MAY have fluctuated. again, i'm not certain if the SOD is connected in any way to wifi. N87 seems to have a problem with wifi connectivity as i frequently lose internet connection over wifi (and more rarely the wifi connection itself) even though all of my other wifi enabled devices (both android and non-android) are functioning perfectly.

also, forgive me for being a bit of a noob but what does deep sleep entail exactly and how do you know if you device has gone into deep sleep? i see people posting screenshots of their battery vs time graphs and and i noticed that their wifi turned off whenever the screen is off - this never happens to me. my wifi is always on even if the screen is sleeping, although i've attributed to the fact that i set wifi to never turn off in the advanced wireless networks settings.
[Nook Color Android Development] Chahk:
Can't you just feed refined plutonium directly into the flux capacitor? :p

Seriously though, that would certainly explain the weird "jumps" I've been seeing in the battery stats. Like going from 30% to 90% in under a second while charging, or a sudden 50% drop while under normal use.

I've been having what looked like both PBDs (with battery level reporting as high as 40% upon turning on) and SODs (requiring a 8-second power cycle) for a while, so I decided to do a complete wipe and re-install of CM. After wiping all partitions in CWR (including /boot) and wiping battery stats, I re-flashed CWR, new u-boot, CM7 latest nightly, dalingrin's OC kernel and then let my NC go into a deep discharge, where it would start showing the "insufficient battery" warning and turning itself off. I then left it on a charger overnight. At some point it successfully booted up and continued charging to 100%.

After that both PBDs and SODs stopped completely! I can now safely leave the NC off the charger for over 16 hour periods and it comes on without a hitch with barely noticeable battery loss (3-4%). I have tried letting its battery drop as low as 25% and it still woke up without issues 4-5 hours later. But I have a feeling the PBD/SOD issues will return once the battery stats go out of alignment again. For example, after 5-6 hours of deep sleep (and off the charger of course) the Battery Use screen was reporting more than it was before that period. Yep, the line on the graph was going up! :confused:

[Edit]

I should add that I left the WiFi sleep policy at the default "When screen turns off" setting.
[Nook Color Android Development] jared_c:
Nice work!
[Nook Color Android Development] frankusb:
I'd like to experiment with this but I don't see where the driver ever reads the file, only i2c transactions. Would anyone care to point that out?

thanks,

Frank
[Nook Color Android Development] :
I know it was mentioned before, but can we just set the limit manually at 3100 mv and have it shutdown there? Seems like the easiest solution.
[Nook Color Android Development] jekagan:
Although it's not related to PBD, is it conceivable that this odd little uptick you saw might be at least partially attributed to fluctuations in battery temperature, since that CAN affect voltage and discharge characteristics?
[Nook Color Android Development] boxcar8028:
it looks like we're getting closer to a solution.... great work guys! :D
[Nook Color Android Development] MedLine:
probably unrelated, but did find /sys/class/power_supply/max17042-0 that returns current draw with "cat /sys/class/power_supply/max17042-0/current_now" and temp with "cat /sys/class/power_supply/max17042-0/temp" in CM7
[Nook Color Android Development] :
Man, I'm soo glad I have people like above to work on this stuff. You are all amazing :D

EDIT: Of course I got put on a new page, but you know what I mean...
[Nook Color Android Development] pryonix:
SOD Data

In the interest of getting to the root cause of this, I'd like to share with you some data I gathered.

I unplugged my NC from the charger and left it at home before I went to work today. I ran recording on CatLog and history on Battery Monitor Widget.

Timeline:

~3pm - May 31: I charged my NC to around 80%++ before I left the house

~1:10am - June 1: Returned home to find my Nook had SOD (screen of death)

Data:

Figure 1: Screenshot below shows text log of Battery Monitor widget indicating that SOD event happened around 7PM, May 31. Last recorded battery level prior to SOD event was 70%. When I booted up my device upon returning home at 1AM of the following day (which is today), device only had 20% power left.

---

Figure 2: Top graph shows charge percentage vs time. Bottom graph shows voltage. Each vertical grid line shows time passing for 1 hour. Note that almost 3 hours after I removed my NC from the charger, charge dropped from 70%->20% in a span of minutes. Grid below shows corresponding drop in voltage.

---

Figure 3: Same thing as above but this time bottom graph showing usage in mW (power) graph. Note the sudden spike in usage prior to SOD event.

---

Figure 4: Same thing as above but this time bottom graph showing usage in terms of mA (current). To be honest, I really don't know how to interpret this. It looks like a large discharge of current happened during SOD event (I'm interpreting this as -mA means discharge or current is flowing OUT of NC's batt, while +mA means charge meaning current is flowing into NC's batt).

---

Figure 5: Same thing as above but this time bottom graph showing temperature. The

alarming

thing here by the way is that after going through SOD event, it seems that the NOOK doesn't really power down. It's actually powered up and doing something but when you try to turn the screen on, it wouldn't.

I actually arrived home to find my nook slightly warmer than ambient room temperature (I live in the Philippines - it's the tropics - I know when things are warmer than they should be). I've noticed this happen for all the times my Nook went through SOD. It's actually warmer than how it gets when I'm operating it normally.

Based on the graphs above, it seems that something happens to the Nook after SOD. It doesn't really power down in the sense that it shuts itself off but rather, it seems to hang and continues to consume battery.

Anyway, can someone point me to a CM7 build that doesnt have SOD (screen of death)? Are the pre .32 nightlies stable in this regard? I had PhireMod 6.2 OCed to 1.3Ghz and I never encountered this on PhireMod. :( To be honest, I'm scared that this is damaging the device's hardware already.

NC Configuration:

CM7 87N SD-boot

1.2Ghz OC using 5/23 Kernel from Dal

MLO from 1.2

u-boot.bin cyan edition from fattire (multiboot based on 1.2)

verygreen's updater V1.3 as alternate boot option

CWM 3.2.0.8 modified for SD as recovery boot option

All of these are running on SD. The emmc is stock 1.2.
[Nook Color Android Development] keyodi:
Each time I boot to BN 1.2 the bin file should be getting valid data, so the u-boot shouldn't be getting "tripped up" when booting back to CM7.

If we can read the data, but can't write to it can it be as simple as file permissions? Is there a way to verify that the file is in fact being read?
[Nook Color Android Development] MedLine:
how about this ... CM7 n86 + 052311 OC kernel eMMC

i delete /rom/max17042.bin, then upon reboot the file is not recreated. as you know, this is in contrast to deleting /data/system/batterystats.bin, gets recreated upon reboot (ie a battery stat wipe)

feels like good time to do battery rundown test...