Welcome, Guest

Author Topic: Boot fails with battery connected  (Read 3983 times)

kostas

  • Newbie
  • *
  • Posts: 19
  • Karma: +0/-0
Boot fails with battery connected
« on: April 28, 2014, 09:54:36 PM »
Hello again
I own an IMX233 MAXI with the standard linux kernel and rootfs (2.6.35-8-ARCH+)
I also got a LiPO battery which i was intended to use as a backup in case of power failure, mainly to keep in operation its internal hwclock (32bit counter) and do some house keeping (close files, etc).
Unfortunately , when both battery as well as external power are connected, booting operation stops when trying to analyze sdcard. I can provide the whole starting sequence record, but it finishes as below

mxs-rtc mxs-rtc.0: setting system clock to 1970-01-01 00:13:39 UTC (819)
mmc0: new high speed SDHC card at address b368
mmcblk0: mmc0:b368 USD   3.75 GiB
mmcblk0: p1 p2 p3 p4

At this point it blocks for ever.

When battery is the only power source, everything is fine
Everything is also fine if the only power source is the external power supply (12V 1A switching ps)

Is that normal?

Best Regards
Kostas

kostas

  • Newbie
  • *
  • Posts: 19
  • Karma: +0/-0
Re: Boot fails with battery connected
« Reply #1 on: April 29, 2014, 03:52:59 PM »
Actually has anybody suceeded to operate its iMX233 double powered (battery +power supply) so far

kaputnik

  • Newbie
  • *
  • Posts: 7
  • Karma: +2/-0
Re: Boot fails with battery connected
« Reply #2 on: May 15, 2014, 07:00:51 PM »
Not really, I am writing a PMIC driver for the imx233 for 3.14.x kernel.

The board crashes some seconds after 5V is removed. 

kostas

  • Newbie
  • *
  • Posts: 19
  • Karma: +0/-0
Re: Boot fails with battery connected
« Reply #3 on: May 15, 2014, 09:29:32 PM »
Kaputnik,
Thanks for your response. Some times i feel i'm the only one who owns this board, at least the only one who has problems with it.
It looks like 2.6.35 kernel is the most suitable for ARM9 CPUs. I've seen it in several embedded devices.
Just a couple of things missing, among them this double powered crash matter. I've seen a patch about, in Freescale forum, i didn't have the time to apply yet, since, i guess, i will need to collect every patch released up to now.
I've test drive both 3.13 Debian and the "official" archlinuxarm 3.7.1
The latest crashes every time i try to write some data to the sdcard.
I,ve made a post in archlinuxarm forum http://archlinuxarm.org/forum/viewtopic.php?f=58&t=7214
but guess, no reply. It looks like imx233 olinuxino has been abandoned by its creator by means of software maintainance. It's a pitty, since, according to Freescale, i.MX233  has at least five more years of life, while AllWinners come and go.

Best Regards
Kostas


kaputnik

  • Newbie
  • *
  • Posts: 7
  • Karma: +2/-0
Re: Boot fails with battery connected
« Reply #4 on: May 19, 2014, 09:49:49 PM »
I am running mainline kernel wise. The support in recent kernels (3.14) is very mature except for the power subsystem. I have scoped all powerrails and the inductor pin. All rails are stable until the dcdc inductor voltage goes down some time later the rail drop as expected. This is the point where the imx resets itself.
I think its a HW design Problem AS there are NO reports oft running stable Form battery supply.



kaputnik

  • Newbie
  • *
  • Posts: 7
  • Karma: +2/-0
Re: Boot fails with battery connected
« Reply #5 on: May 19, 2014, 09:53:22 PM »
Also there is a bug in uboot which kills vddio while boot from battery. I will post a patch that will fix it.

mbergmann

  • Jr. Member
  • **
  • Posts: 61
  • Karma: +3/-0
    • My blog
Re: Boot fails with battery connected
« Reply #6 on: May 20, 2014, 09:11:56 AM »
I think its a HW design Problem AS there are NO reports oft running stable Form battery supply.

I can not speak for the Olimex board, but we use a very similar design for our i.MX233 based audio player and audio development board and it does run very stable on battery. Our code is pure bare metal, no OS involved.

Personally I do not think it's a hardware problem.

Regards

Mike


kaputnik

  • Newbie
  • *
  • Posts: 7
  • Karma: +2/-0
Re: Boot fails with battery connected
« Reply #7 on: May 20, 2014, 09:48:58 AM »

I can not speak for the Olimex board, but we use a very similar design for our i.MX233 based audio player and audio development board and it does run very stable on battery. Our code is pure bare metal, no OS involved.

Personally I do not think it's a hardware problem.

Regards

Mike

Hi Mike, thanks for your reply. I own a Sansa Fuze+ mp3 player, it is based on STMP3780 which is the same as the imx233. It was running great from Bat....not the display is broken.

Can you post a dump of your power registers while on battery ? This will be very helpful.

This is the State of my Olimex-Board before it resets, running from battery.
0x80044000

0x000 0x00118024
0x010 0x00108503
0x020 0x00000040
0x030 0x00010000
0x040 0x0002071C
0x050 0x0000270C
0x060 0x00002614
0x070 0x00000110
0x080 0x00000018
0x090 0x00000000
0x0A0 0x0000305F
0x0B0 0x00167021
0x0C0 0x01001210
0x0D0 0x00FB0000
0x0E0 0x01FF040F
0x0F0 0x00000000
0x100 0x3E770002
0x110 0x00000000
0x120 0x00000000
0x130 0x03010000

mbergmann

  • Jr. Member
  • **
  • Posts: 61
  • Karma: +3/-0
    • My blog
Re: Boot fails with battery connected
« Reply #8 on: May 20, 2014, 12:24:47 PM »
Hi kaputnik,

I too have a Sansa+ here running with RockBox very stable on Battery, so maybe the RockBox code is of some help for you.

Additionally if you need some bare metal code regarding power transition and charging we can arrange something via private mail.

I dumped the register sets after starting on battery as well as after transition to 5V (charging) and back to battery.

Startup on batt:

Code: [Select]
80044000 = 00518024
80044010 = 04100192
80044020 = 00000040
80044030 = 00010000
80044040 = 00320413
80044050 = 0000240C
80044060 = 00002608
80044070 = 0000020C
80044080 = 00000018
80044090 = 00000000
800440A0 = 0000305F
800440B0 = 00160021
800440C0 = 01005011
800440D0 = 00FE0000
800440E0 = 01EF0600
800440F0 = 00000000
80044100 = 00000000
80044110 = 00000000
80044120 = 00000000
80044130 = 03010000

After charging:

Code: [Select]
80044000 = 01418AA6
80044010 = 04028117
80044020 = 00000040
80044030 = 00410000
80044040 = 00020413
80044050 = 0000240C
80044060 = 00002608
80044070 = 0000020C
80044080 = E0800000
80044090 = 00000000
800440A0 = 0000305F
800440B0 = 00160021
800440C0 = 20021218
800440D0 = 00FC0000
800440E0 = 01F10600
800440F0 = 00000000
80044100 = 00000000
80044110 = 00000000
80044120 = 00000000
80044130 = 03010000

Btw:

Christian Jann started porting the Arch 3.9.4 to our board but its missing the power transition part, too.
So I'm very interested in your code if you got it working :-)

kind regards

Mike

kaputnik

  • Newbie
  • *
  • Posts: 7
  • Karma: +2/-0
Re: Boot fails with battery connected
« Reply #9 on: May 20, 2014, 08:50:32 PM »
Hi mbergmann,

Thanks for the help.

I think I found some thing, i have a register setup in which it seems to run reliably from Battery...
I will investigate further and keep you updated.

The power transition code is always interesting especially considering the Errata in the Chip.

The kernel driver is in very early alpha state and works only for 5v to bat transition until now.
I will implement the rest if i can fix boot from battery reliably.


kaputnik

  • Newbie
  • *
  • Posts: 7
  • Karma: +2/-0
Re: Boot fails with battery connected
« Reply #10 on: May 21, 2014, 04:13:50 PM »
Hi all,

booting from battery is working again  :D

The patch for u-boot can be found here: http://patchwork.ozlabs.org/patch/350968/

mbergmann

  • Jr. Member
  • **
  • Posts: 61
  • Karma: +3/-0
    • My blog
Re: Boot fails with battery connected
« Reply #11 on: May 22, 2014, 11:29:36 AM »
Great, thanks.

Btw: you have PM with power transition code examples. I hope it is of some help.

Mike

kaputnik

  • Newbie
  • *
  • Posts: 7
  • Karma: +2/-0
Re: Boot fails with battery connected
« Reply #12 on: May 23, 2014, 05:42:53 PM »
I hope it is of some help.


Hi Mike,

thank you for the code, it gave me some hints.

It took some days...and is wasn't as funny as i thought at the beginning but finally it works. 
I have the kernel driver up and running. At the moment it only does the power switching to and from battery and handles the charging. There is no userland interface.

The next step is brownout handling. I hope there are not that much problems as with DCDC powerup....
Than a userland interface for battery and other regulators...but this should not be a that much of a problem.

The code need some cleanup at this point, after that beta testers are welcome ;)




Grawp

  • Newbie
  • *
  • Posts: 17
  • Karma: +3/-0
Re: Boot fails with battery connected
« Reply #13 on: June 18, 2014, 12:31:39 PM »
Hi kaputnik,

First I'd like to ask what U-boot repo/branch & custom patches you are using or recommend.

So far I've only used imx-bootlets, could somebody tell me what features does u-boot have? I can recall that the imx-bootlets didn't support hand-off to 5V back from battery.

Btw. It's wonderful that you are working on PMIC driver for > 3.10 kernels. Will you announce it on this forum once it's ready for testing? Or is there some way we can track your progress?

Thanks
« Last Edit: June 19, 2014, 03:19:45 PM by Grawp »