1 2 Previous Next 23 Replies Latest reply on Aug 23, 2015 9:03 AM by ab-tools

    Changing V_VBAT_BCKP Voltage and Ampere Setting

    ab-tools

      Hello,

       

      I'm trying to change the voltage and ampere setting of V_VBAT_BCKP and got everything compiling (without any change) now which was already a not so easy way to go if you never compiled a Linux kernel before.

       

      I want to set it to

      Voltage: 3.3 V

      Current: 500 µA

      and therefore the new value should be "31" or "0x1F" (in HEX).

      Could somebody please verify first that this is correct?

       

      Now I want to make the change to the "intel_scu_pmic.c" file, but I'm not sure where I need to insert what. I've tried to add this single line

      intel_scu_ipc_iowrite8(0x52, 31);

      at this location:

      [...]
      #ifdef MODULE
      module_init(pmic_rpmsg_init);
      #else
      fs_initcall_sync(pmic_rpmsg_init);
      #endif
      intel_scu_ipc_iowrite8(0x52, 31); 
      static void __exit pmic_rpmsg_exit(void)
      {
             return unregister_rpmsg_driver(&pmic_rpmsg);
      }
      module_exit(pmic_rpmsg_exit);
      [...]

       

      But when I try to compile this, I get following compilation error:

      | /mnt/edison/edison-src/out/linux64/build/tmp/work/edison-poky-linux/linux-yocto/3.10.17-9/linux/drivers/platform/x86/intel_scu_pmic.c:469:24: error: expected declaration specifiers or '...' before numeric constant
      |  intel_scu_ipc_iowrite8(0x52, 31);
      |                         ^
      | /mnt/edison/edison-src/out/linux64/build/tmp/work/edison-poky-linux/linux-yocto/3.10.17-9/linux/drivers/platform/x86/intel_scu_pmic.c:469:30: error: expected declaration specifiers or '...' before numeric constant
      |  intel_scu_ipc_iowrite8(0x52, 31);
      |                               ^

       

      Is there an example code to change the setting to 3.3 V with 500 µA and the exact location where it needs to go in that file?

       

      Best regards and thanks in advance for your support

      Andreas

       

      P. S.: that's also a thread to this topic already, but as this was marked as "answered" already, I decided it's better to create a new one:

      V_VBAT_BCKP : Questions

        • 1. Re: Changing V_VBAT_BCKP Voltage and Ampere Setting
          CMata_Intel

          Hi  ab-tools,

           

          After you add the line intel_scu_ipc_iowrite8(0x52, 31) how are you compiling this? Are you using bitbake,  make, gcc.. ?

          Have you tried by changing the ret = intel_scu_pmic_iowrite(..,..)  and ret = intel_scu_pmic_ioread(..,..) in the file without adding anything just changing these lines? You could find these lines under the static ssize_t pmic_ops_store()

           

           

          Regards,

          Charlie

          • 2. Re: Changing V_VBAT_BCKP Voltage and Ampere Setting
            ab-tools

            Hello Charlie,

             

            I'm using BitBake.

             

            I saw these lines in the function "pmic_ops_store()", but I have no idea what I should change there:

            they are iterating over an array passed to that function (not just a simple call to "intel_scu_ipc_iowrite8" where I could just change the arguments).

             

            So could you please advice which exact change you would recommend there?

             

            Best regards

            Andreas

            • 3. Re: Changing V_VBAT_BCKP Voltage and Ampere Setting
              Itstechpro

              So, let me try to finalize my understanding of the RTC backup battery control register change since I also intend to use an 11maH Li rechargeable coin cell battery for the RTC and require the same settings as Andreas. Do I understand correctly that there is no other way to change register contents than to undertake the rather extensive task (for a complete newby) to modify and recompile and then reflash the Linux kernel?

              • 4. Re: Changing V_VBAT_BCKP Voltage and Ampere Setting
                Itstechpro

                Oh, and my host computer runs XP pro.  I don't have a Linus OS system available.  My only Linux 'machine' is the Edison / Arduino.

                • 5. Re: Changing V_VBAT_BCKP Voltage and Ampere Setting
                  Itstechpro

                  As another possibility, any way to directly access the control register with C? I would then run the reconfiguration every time I booted.

                  • 6. Re: Changing V_VBAT_BCKP Voltage and Ampere Setting
                    ab-tools

                    Hello Itstechpro,

                     

                    absolutely, I also really don't understand why we need to recompile the kernel and build the whole image (takes over 6 hours without preparations!) just for a setting change!

                    It really would be very interesting why Intel did not make the life of us developers much easier and just provided a small command line utility to accomplish this setting change...

                     

                    But if you need exactly the same settings than me I'm happy to provide you with the ready image as soon as I get it done.

                     

                    @Charlie: any news on an example including location in the code on how to accomplish this change?

                     

                    Best regards and thanks

                    Andreas

                    • 7. Re: Changing V_VBAT_BCKP Voltage and Ampere Setting
                      ab-tools

                      Hello Charlie again,

                       

                      I now additionally tried to add the code line

                      intel_scu_ipc_iowrite8(0x52, 31);

                      as last line directly before the "return size;" statement into the function "pmic_ops_store()" (I thought I just overwrite it again as soon as this register is set for testing if it works at all) and I even could compile successfully with that.

                       

                      Then I flashed this image to the Edison which also worked without problems.

                       

                      But unfortunately the setting did not change!
                      I just measured the voltage and it was still 2.5 V instead of 3.3 V.

                       

                      So could you please check if my setting "31" is correct for 3.3 V with 500 µA?

                      I just want to make sure I didn't do a mistake by converting the bits to this decimal number in the first place.

                       

                      And still it would be really great if someone could provide an example code:

                      I can't believe that I'm the first one who needs to change this setting...

                       

                      Best regards and thanks in advance

                      Andreas

                      • 8. Re: Changing V_VBAT_BCKP Voltage and Ampere Setting
                        Itstechpro

                        Andreas,

                        Thank you.  The Panasonic ML-920S/DN 11mAh coin cell I'm using has an optimum charge voltage of 3.1 volts although 3.3 would still probably be OK, they're concern is voltages getting up near 4 volts, which could result in cell damage.

                         

                        So,   hex 31 maps to 00110001

                        D5 = 1    Only the battery charging function within the main battery charger IC will be disabled when the Charger IC disable pin is asserted.

                        D4,3 = 10     backup supply charger current 100uA

                        D2,1 = 00     backup supply charging limit  2.5 volts  (so that's why the voltage didn't change)

                        D0 = 1         enable charging of backup supply

                         

                        If you want to keep the Charger IC disable pin you chose, then

                        for 500uA and 3.3 volts,

                        the bit pattern is 00111111 which maps to

                        3F  hex 

                         

                        the bit pattern for 500uA charge and 3.15 volts is 00111101 which maps to

                        3D hex

                        f

                        and, if you didn't intend to change the default setting of the Charger IC disable pin from its default value of 0

                        3F hex becomes 1F hex and

                        3D hex becomes 1D hex.

                         

                        Regards,

                        Jules

                        • 9. Re: Changing V_VBAT_BCKP Voltage and Ampere Setting
                          ab-tools

                          Hello Jules,

                           

                          first thanks for your reply - any help is very appreciated!

                           

                          But to be honest your reply confuses me a bit:

                          if I get you right - please correct me if I'm wrong - you come to the conclusion that - if I don't want to change the D5 "Charger IC PIN" (which I don't want) - a value of 1F in HEX is correct, right?

                          And if I'm not completely confused now, 1F in HEX = 31 in decimal, isn't it?

                          So my 31 should be correct and it has to work with the value I used, right?

                          ... and 31 in decimal = 1F in HEX = 11111 in binary?

                           

                          I plan to use the "Panasonic VL2330-1HFE" 50 mA coin cell by the way which may be charged at up to 3.4 V according this (German) website:

                          Vanadium-Pentoxyd-Lithium-Akkumulatoren Typ Panasonic VL.. | Bürklin · Die ganze Elektronik

                           

                          Best regards and looking forward to your reply

                          Andreas

                          • 10. Re: Changing V_VBAT_BCKP Voltage and Ampere Setting
                            Itstechpro

                            Andreas,

                            I might also increase the mAh rating of my backup battery and I think that 3.3 volts is fine.

                            I was under the impression that the hex value is what is passed to the control register, not decimal.

                            If I look at the example given on page 38 of the Intel Edison Compute Module Hardware Guide, the value 19, when interpreted as a hex value,

                            maps to the bit image  00011001

                            which is 500uA and 2.5 volts

                            The Guide also points out that bits D7,6,5 should remain as 0

                             

                            So, for the 3.3 volt and 500uA charge, the hex value is

                            1F     and the hex value is what is normally written to and read from registers

                             

                            I don't think you need the decimal value, but for a hex value of 1F, the decimal value is 31 ... the fact that the charge voltage remained at 2.5 volts indicates that the "31" you entered was interpreted as a hex value, not a decimal.

                             

                            So, again, 1F is the value which needs to be loaded into the register ..

                            Regards,

                            Jules

                            • 11. Re: Changing V_VBAT_BCKP Voltage and Ampere Setting
                              ab-tools

                              Hello Jules,

                               

                              first thanks again for your very quick reply!

                               

                              OK, using HEX value then, but I'm a bit confused in this case how I need to passed that as argument:

                              as far as I know HEX values are written with "0x" in the beginning, just like as the address "0x52" of the register. Therefore I used "31" (without "0x") to be interpreted as decimal and would have expected that this is identical to "0x1F".

                               

                              But you would suggest then to try this, right?

                              intel_scu_ipc_iowrite8(0x52, 0x1F);

                              Is that correct?

                               

                              Best regards

                              Andreas

                              • 12. Re: Changing V_VBAT_BCKP Voltage and Ampere Setting
                                Itstechpro

                                Andreas,

                                Hmmm..   31 is the decimal equivalent of hex 1F and should have worked if your compiler recognizes the 31 as a decimal representation of the bit pattern

                                00011111.  To be on the safe side, I'd use the 0x1F format, which should be OK for any C, C++ compiler ??

                                Jules

                                • 13. Re: Changing V_VBAT_BCKP Voltage and Ampere Setting
                                  ab-tools

                                  Hello Jules,

                                   

                                  I ran this test in the meantime and compiled everything again (if all is set up and you only do a code change, it takes "only" about 30-45 mins. to recompile and build the new image) with the code line

                                  intel_scu_ipc_iowrite8(0x52, 0x1F);

                                  but unfortunately with a very disappointing result:

                                  no voltage change at all, I still measure 2.486 V at the battery backup connection.

                                   

                                  So that's obviously either not the correct setting or (what I think more) not the correct place to add this line of code - I've tried it with these two places:

                                  at the beginning of the "pmic_rpmsg_init" and at the end (before "return", of course) of the "pmic_ops_store" function - both with no effect!

                                   

                                  @Charlie/Peter/Intel:

                                  so please, let us know what we need to do to change this setting?

                                  Where we need to put this line of code or do any other change?

                                   

                                  Best regards

                                  Andreas

                                  • 14. Re: Changing V_VBAT_BCKP Voltage and Ampere Setting
                                    ab-tools

                                    Hello,

                                     

                                    any news on that?

                                    Nobody can help here?

                                     

                                    I really would like to finish this project and changing this setting is the only missing part...

                                     

                                    Best regards and thanks in advance

                                    Andreas

                                    1 2 Previous Next