Thursday, July 23, 2009

Battery charge/discharge graphs

batman52 took the trouble of sampling the battery voltage both during the discharge and charge cycles. This is what it looks like:


This should help setting the battery status thresholds. It has also helped identifying the GPIO pin used to sense the battery charge status provided by the not-yet-identified power management integrated circuit. Though this information is yet to be verified, I've updated the GPIO mapping tables.

You probably know already that you can read the battery voltage from /proc/jz/battery (in millivols). You can also read the GPIO pin status from gpio[0-3]_pxpin files in the same directory. Do not mess around with the other gpio[0-3]_* files since you could damage your hardware.

5 comments:

  1. Is there a good way of reading PXPIN as binary values? What about reading the registers directly? Or using mmap?

    ReplyDelete
  2. @Slaanesh

    Linux seems to use the MMU to protect the I/O areas, so MAYBE you could directly read the PXPIN registers with a program. Get the registers definitions from jz4740.h and make sure that:

    1- You run your program as root.
    2- You issue the approritae ioperm call before actually accessign the registers.

    I'm not sure if this will work since I seem to remember that ioperm is for x86 platforms only, and I cannot check it out at the moment. If you do, please report sucess or failure.

    ReplyDelete
  3. been playing with testing inputs in /proc/jz/gpio3_pxpin, can read all the inputs from there, except the start button (gpio2_pxpin maybe? haven't looked yet)

    also to add to the gpio page on the googlecode:

    on port d, number 22 is listed as input??

    pretty sure it's the keylock (when you push the power switch downwards, 0 is clicked downwards, 1 is in normal position)

    oh and great work on everything, keep it up :D

    ReplyDelete
  4. @booboo
    The current libsdl has no joystick support.
    I can't compile things because some of them (Kaiten Patissier, Nofrendo) require it.
    Can you include joystick support in sdl in the next toolchain/rootfs release?
    BTW2 I wonder, are you interested in joining our #dingoo-a320 irc channel on freenode?
    It would be a lot easier to report things like that if you hanged around on irc.

    ReplyDelete