1 Reply Latest reply on Aug 28, 2017 12:11 AM by BoonT_56 Branched from an earlier discussion.

    Re: Measuring Battery life with BCM20732S (Con't)

    thomas.younsi_2228536

      Hi, i am trying to use the battery characteristic on P8 as well do I need to have a dedicated GPIO for the GPIO_SETTINGS_BATTERY ?

      If so does this GPIO has to be connected to a physical PIN ?

       

      I am usine 2 AA battery or mini USB using 5 V to 3.3 V LDO to power the board with automatic detection of mini USB vs battery. Right now everytime I read the characteristic using BLE Explorer even after 40 hours of usage It is still reporting 100 %

      Other than calling blebat_Init(); do I need to plug specific code ?

       

      // Following structure defines GPIO configuration used by the application

      const BLE_PROFILE_GPIO_CFG meatsitter_gpio_cfg =

      {

          /*.gpio_pin =*/

          {

          -1,//GPIO_PIN_WP,      // This need to be used to enable/disable NVRAM write protect

          -1,//GPIO_PIN_BUTTON,  // Button GPIO is configured to trigger either direction of interrupt

          -1,//GPIO_PIN_LED,     // LED GPIO, optional to provide visual effects

          8,//GPIO_PIN_BATTERY, // Battery monitoring GPIO. When it is lower than particular level, it will give notification to the application

          -1,//GPIO_PIN_BUZZER,  // Buzzer GPIO, optional to provide audio effects

          -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 // other GPIOs are not used

          },

          /*.gpio_flag =*/

          {

          0,//GPIO_SETTINGS_WP,

          0,//GPIO_SETTINGS_BUTTON,

          0,//GPIO_SETTINGS_LED,

          0,//GPIO_SETTINGS_BATTERY,

          0,//GPIO_SETTINGS_BUZZER,

          0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

          }

      };

       

       

       

      // Initialize GATT database

      void my_database_init(void)

      {

          //Initialized ROM code which will monitor the battery

          blebat_Init();

      }

        • 1. Re: Measuring Battery life with BCM20732S (Con't)
          BoonT_56

          I think we have addressed this in an exact same post previously. The battery monitoring system (with gpio P15 directly connected to VBAT) is embedded in the rom code of which it cannot be changed in its present form. I can only draw your attention to the below two functions in the wiced_sense app that implement it.

           

          //Scale battery level into percentage and update GATT DB.

          void wiced_sense_scale_battery_level_to_percentage_and_update(void)

           

          // Measures the average ADC reading from P15 of the battery level

          void wiced_sense_measure_battery_level_and_average(void)

          1 of 1 people found this helpful