BCM20732S P15 connected to VBAT internally?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi,

Do I have to make sure to connect P15 to the supply voltage externally or has it been done already?

Regards,

Kilian

0 Likes
1 Solution
ShawnA_01
Employee
Employee
10 questions asked 5 comments on KBA First comment on KBA

P15 of the 20732S module (Pin 41) is not (internally) connected to the supply voltage. 

View solution in original post

7 Replies
ShawnA_01
Employee
Employee
10 questions asked 5 comments on KBA First comment on KBA

P15 of the 20732S module (Pin 41) is not (internally) connected to the supply voltage. 

Anonymous
Not applicable

I found P15 connected to VDDIO in your reference design ( iBeacon & WICED SENSE Kit). And in source code, it like this:

const BLE_PROFILE_GPIO_CFG hello_sensor_gpio_cfg =

{

    /*.gpio_pin =*/

    {

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

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

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

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

    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 =*/

    {

    GPIO_SETTINGS_WP,

    GPIO_SETTINGS_BUTTON,

    GPIO_SETTINGS_LED,

    GPIO_SETTINGS_BATTERY,

    GPIO_SETTINGS_BUZZER,

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

    }

  GPIO_PIN_BATTERY is config as GPIO or ADC? and Battery service will automatically read battery voltage?

IN my application, we use 3.2V~4.2V  chargeable Li-Battery, and VDDIO=1.8V by a DC-DC. We want to monitor battery voltage by ADC, because system will go to deep sleep mode while battery voltage is lower than 3.2V. Should I convert battery voltage to 0~1.8V by two resistors and connect to P15?

0 Likes

> GPIO_PIN_BATTERY is config as GPIO or ADC?

This configures the GPIO as an ADC input.

> Should I convert battery voltage to 0~1.8V by two resistors and connect to P15?

Yes. No ADC input should can be 10% over VDDIO.

> ...Battery service will automatically read battery voltage?

The application still needs to configure, initialize and poll the battery monitor. See Wiced-Smart/bleapp/app/bleprox.c (the proximity app in the ROM). The main idea is to invoke blebat_Init() in your application_create function after the call to bleprofile_GPIOInit(), and then periodically (typically in the either the 1s timeout or the fine timer callback, or in some other application defined manner) invoke blebat_pollMonitor(). Also see blebat_batmon_cfg in blebat.c for the default configuration. Your VDDIO will likely be 1.8v always, and setting GPIO_SETTINGS_BATTERY in hello_sensor_gpio_cfg will override blebat_batmon_cfg.adcInputConnectedToBattery. You might want to modify the other members of the blebat_batmon_cfg so it scales appropriately for your re-chargeable battery.

Anonymous
Not applicable

Hi Arvinds

Thanks a lot.

Blebat.c is fixed in ROM,  how to invoke blebat_Init() & blebat_pollMonitor()?  Could you give us some tips or sample code? 

BR

Edward

0 Likes
Anonymous
Not applicable

Since I have been there too, let me try to answer:

The code for blebat is located in:

WICED-Smart-SDK-1.1.0\WICED-Smart-SDK\Wiced-Smart\bleapp\app\blebat.c

Also there has been some discussion about the topic:

Measuring Battery life with BCM20732S

Getting blebat to work

To get an idea how to use it I guess automation_io.c could help. Notice that there is a service defined in the Gatt database. Beyond that in app_create() there should be a call to blebat_Init(), and in the second timer callback the blebat_pollMonitor() call can be found.

Regards,

Kilian

Anonymous
Not applicable

Hi Kilian

I don't understand atomation_io.c or hello sensor.c, they just modify some parameters, such as descriptor, characteristic value. They didn't invoke a real function, for example: blebat_init() etc.

I know, I could copy blebat.c .h files to myapp directory, and change UUID something. should I rename function name in blebat.c to avoid conflicting with ROM?

If I don't implement battery service, it's quite simple: just define P15 as ADC input, and read adc in timer event.

BR

Edward

0 Likes

You don't need to copy blebat.c into your application. This is in the ROM, so you can call these functions from your app. The simplest way to implement battery service requires you to do these three things:

1. Add the battery service and characteristics to your applications GATT DB. At minimum, you need the UUID_CHARACTERISTIC_BATTERY_LEVEL characteristic.

2. Call blebat_Init() in your application create function.

3. Call blebat_pollMonitor() periodically.

See Wiced-Smart/bleapp/app/bleprox.c - this is an implementation of the proximity application that is in the ROM. The proximity app under Apps/proximity replaces only the GATT DB of this proximity app in the ROM (all other functionality is implemented by the ROM code).