6 Replies Latest reply on May 3, 2017 3:35 PM by Intel Corporation

    How to apply a patch for V_VBAT_BKUP

    Snowmaniac80

      Hello Edison Community,

      I have been burning the midnight oil trying to change the charging voltage and current on the V_VBAT_BKUP pin of the Edison. I have found lots of great resources, but there seems to be some missing information that I need. I am an engineer, and not much of a programmer, but I have experience with Linux, BASH scripts, Python, and a little more. I have been diligently reading all the Yocto and Bitbake documentation, and have come to understand a fair bit... however not enough to get this figured out. So, any help here pointing me in the right direction will be deeply appreciated.

       

      1. I am starting with the latest release of the Intel firmware for the Edison which I downloaded from here: http://iotdk.intel.com/src/3.5/edison/iot-devkit-yp-poky-edison-20160606.zip . That link is on the Edison Downloads page.
      2. I have successfully compiled and loaded an Edison image using that source.
      3. Back in 2015 for a different version of the Edison firmware some smart makers created a patch to do what I need and generously shared that here: Re: Edison RTC backup battery charging parameters (ideally I would like to use this solution)
      4. Also, Intel created a nice document for me to follow on how the change the V_VBAT_BKUP settings here: Change V_VBAT_BKUP Configuration on an Intel® Edison Board

       

      My problem is, the solutions or 'recipes' as you might call them seem to be for other versions of the firmware... perhaps? That, and I am a bit short on having enough knowledge to make it work.

       

      Discussion on patch file in Re: Edison RTC backup battery charging parameters:

      So, the post listed in point 3 originally was setup to be used outside of the bitbake environment it seems like, and I do not yet know how to 'make' software for the Edison without bitbake (yet... I'm going to learn). Down at the bottom of the thread though a fella (CMata_Intel ) posted the patch and a really brief description of how to make it work with bitbake. He indicates I need to change the 'linux-yocto_3.10.bbappend' and place the patch with the 'upstream_to_edison.patch'. However in the 20160606 firmware there is no 'upstream_to_edison.patch' to be found, and I can find six (6) copies of the 'linux-yocto_3.10.bbappend' file! They are in the following locations:

      1. ./meta-intel/meta-crownbay/recipes-kernel/linux/linux-yocto_3.10.bbappend
      2. ./meta-intel/meta-emenlow/recipes-kernel/linux/linux-yocto_3.10.bbappend
      3. ./meta-intel/meta-isg/meta-valleyisland/recipes-kernel/linux/linux-yocto_3.10.bbappend
      4. ./meta-intel/common/recipes-kernel/linux/linux-yocto_3.10.bbappend
      5. ./meta-intel/meta-fri2/recipes-kernel/linux/linux-yocto_3.10.bbappend
      6. ./meta-yocto-bsp/recipes-kernel/linux/linux-yocto_3.10.bbappend

       

      I tried to modify the bbapend in the meta-yocto-bsp directory, place the patch in a subdirectory named "files", but nothing changed in the build. My bet is if I keep poking around with the various .bbappend files in the poky directory I might find one that works?

      So, bottom line is I can't get this to work.

       

      Discussion on Intel's Change V_VBAT_BKUP Configuration on an Intel® Edison Board procedure:

      Intel provided a patch here to apply as well. Again, the instructions are to modify the 'linux_yocto_3.10.bbappend' file. They specify exactly where that file should be: /meta-intel-edison/meta-intel-edison-bsp/recipes-kernel/linux/... but as you can see from my list of possible .bbappend files from above, there is not one in this directory. So, perhaps my next step should be to create a .bbappend file in that directory and see what happens??? The procedure suggest it should already be in existence, and again the .bbappend shows the 'upstream_to_edison.patch' which does not seem to exist.

       

      Feeling like I've hit all dead ends here. Please shine some light on the path forward. I will keep beating my head against the brick wall in the mean time.

      CHEERS!

        • 1. Re: How to apply a patch for V_VBAT_BKUP
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hi Snowmaniac80,

          Thank you for contacting us.

          Just to clarify, any kernel or image changes are beyond of our support scope. But, we always try our best to help the community.

          Having said that, I will investigate more about this, and I will contact you if I have updates about this.

          Have a nice day.

          Regards,
          Leonardo R.

          • 2. Re: How to apply a patch for V_VBAT_BKUP
            Snowmaniac80

            Leonardo- Thanks! If you can just point me in the right direction it would help. I keep chiseling away at this problem. I can tell you 100 things that don't work.

            • 3. Re: How to apply a patch for V_VBAT_BKUP
              Snowmaniac80

              Hey, I got it working. I'll post my solution tomorrow.

              Thanks!

              • 4. Re: How to apply a patch for V_VBAT_BKUP
                Intel Corporation
                This message was posted on behalf of Intel Corporation

                Hi Snowmaniac80,

                That's awesome! We were working on this too, but it is good to know that you solved it.

                Feel free to post the solution, it will be very helpful for the community.

                Have a nice day.

                Regards,
                Leonardo R.

                • 5. Re: How to apply a patch for V_VBAT_BKUP
                  Snowmaniac80

                  Leonardo and Edison Community-

                  I'm working on documenting all I learned today for my own internal uses, and as I said want to share the solution here as well. Since I'm not a programmer this took me a long time, and I learned a ton. I'm a little unsure about how much detail is useful to everyone, but I will do my best. If the detail is insufficient try contacting me, and I will try to do better.

                   

                  The Solution:

                  Ultimately the fix was supper simple, and I am somewhat embarrassed that I posted an entire page write-up about it.

                   

                  Which Patch?

                  I used the patch listed in my original post, bullet point 3. This allows the V_VBAT_BKUP register to be set to different values using a file. Please see the post Edison RTC backup battery charging parameters for complete details. This is going to be very useful for development and I can work it into production too.

                   

                  In summary: A programmer by the name bbrotherton created the initial patch, however his patch has lots of config changes I don't need (or want probably). A fellow named Andreas (who goes by ab-tools), and Intel employee Charlie (Cmata_Intel) both posted versions of the patch in the forum that were stripped of extra content. Andreas’ patch does not work however with the most recent Edison firmware (201606061707), therefore I used the patch file posted by Charlie. That patch was called “pmic_backup_battery.patch.zip”

                   

                  Caution: Every time power is cycled on the Edison this patch causes V_VBAT_BKUP to default to 0x01 (10uA at 2.5V and enabled)... so, you should include in your startup shell script the command to set this to the desired value for your application.  (i.e. echo 31 > /sys/devices/platform/pmic_ccsm/backup_battery_charge)

                   

                  To Apply the Patch:

                  To use this patch with the current Edison firmware build I modified the file linux-externalsrc.bb at this directory location:

                  iot-devkit-yp-poky-edison-20160606/poky/meta-intel-edison/meta-intel-edison-bsp/recipes-kernel/linux/linux-externalsrc.bb

                   

                  At line 12 (or 13 in this example) of linux-externalsrc.bb I added SRC_URI += "file://pmic_backup_battery.patch" . So the file reads like this:

                  LICENSE = "GPLv2"
                  LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
                  
                  inherit kernel
                  require recipes-kernel/linux/linux-yocto.inc
                  
                  # Allows to avoid fetching, unpacking and patching, since our code is already cloned by repo
                  #inherit externalsrc
                  
                  SRC_URI = "git://github.com/01org/edison-linux.git;protocol=https;branch=edison-3.10.98"
                  SRCREV = "edison-3.10.98"
                  #Add the line below.
                  SRC_URI += "file://pmic_backup_battery.patch"
                  
                  

                   

                  Next I created a subdirectory in the same directory listed above named “files”, and moved the unzipped patch file (pmic_backup_battery.patch) into that files directory. Just like Intel's support document says here.

                  Then I compiled, and it worked! (After I fixed a few more errors that bitbake threw completely unrelated to this. )

                   

                  Note, I ended up doing this with a clean build environment (no previous builds or sources fetched). Intel's support document that I just referenced (and referenced in original post bullet point 4) suggests running the following two commands if you are applying this to source that has been previously complied:

                  bitbake virtual/kernel –c cleanall

                  bitbake virtual/kernel

                   

                  In theory that should work, but I did not use this.

                   

                  Okay, so much more I could add about how I discovered this, why it works, how bitbake works... but hopefully this is enough to help out someone else.

                  Take Care All!

                  1 of 1 people found this helpful
                  • 6. Re: How to apply a patch for V_VBAT_BKUP
                    Intel Corporation
                    This message was posted on behalf of Intel Corporation

                    Hi Snowmaniac80,

                    That's an excellent reply, thank you so much! It definitely will be very useful for the community.

                    We really appreciate your participation in the community.

                    Thanks again.

                    Have a nice day.

                    Regards,
                    Leonardo R.