Reset the SOC counter after connecting a charging battery

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
4 posts / 0 new
Last post
Joffrey COFFINEAU
Offline
Last seen:2 years 11 months ago
Joined:2017-06-30 09:08
Reset the SOC counter after connecting a charging battery

Hi,

I'm working on a project using the DA14681 chip with the SDK_BTLE_v1.0.8.1050.1.

We use a system that disconnect the battery when the product is not used. The battery is connected on button press or when the USB cable is connected.

We have an issue when we start by connecting the USB cable , because the Dialog start before the battery switch is activated.

So when it initialize, the SOC value is set to 0. And then it is not updated. The battery is correctly charging but the SOC value is not updated with the correct value.

I tried to add an update of the SOC value by using the read done in the init function :

int16_t socf_reset_soc(void)
{
int64_t active_count;
uint64_t active_period;
int32_t current;
int16_t now_voltage;
active_period = SOCF_GET_DURATION(socf_pre_sample_time,
socf_start_count_time);
如果(active_period < 10) {
hw_cpm_delay_usec((10 - active_period) * 1000);
socf_pre_sample_time = rtc_get_fromISR();
active_period = SOCF_GET_DURATION(socf_pre_sample_time,
socf_start_count_time);
}
active_count = socf_get_count(true);
current = socf_get_avg_current(active_count, active_period);
now_voltage = (socf_vbat_via_adapter() + socf_vbat_via_adapter()
+ socf_vbat_via_adapter()) / 3;
socf_soc = socf_get_soc_vbat_ibat(now_voltage, current, vol_dis_low, vol_dis_high);
socf_accum_charge_count = SOCF_SOC_TO_COUNT(socf_soc);
}

I still have a problem because when I call this function the battery is already charging. So the estimated percentage is not correct as the charger is active.

Is there an other way to update the SOC value if the battery is connected after system initialization ?

Is it possible to stop and start the charge process with the SDK ? (Can we use hw_charger_stop_charging and hw_charger_start_charging directly ?)

Joffrey

Device:
MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
Joined:2015-06-08 11:34
Hi joffrey COFFINEAU,

Hi joffrey COFFINEAU,

Just to check if i correctly get the case, when your plug in your USB in order for the battery to start charging, the battery isn't yet actually attached on the device (it takes a certain amount of time before the battery is actually attached on the board when you plug in the usb), so the charger is starting the charging procedure with actually no battery on and this is what corrupts the SOC results ? Is my understanding correct ?

Thanks MT_dialog

Joffrey COFFINEAU
Offline
Last seen:2 years 11 months ago
Joined:2017-06-30 09:08
Hi,

Hi,

是的,是这样。The SOC result start at 0% instead of the battery level that is connected later.

For now as workaround I've commented theusb_attach()call inusb_charger_taskin order to not start the charger.

Then later in my application I execute the function that I've extract to reset SOC value. And just after I callhw_charger_vbus_cb(true)to trigger the usb attach.

This is temporary path while waiting a more detailed answer from you about what it is recommended.

MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
Joined:2015-06-08 11:34
Hi Joffrey COFFINEAU,

Hi Joffrey COFFINEAU,

The workaround that you have implemented is acceptable, and its one way to move forward, other approaches would be to reset the system when the battery is connected or to have the system in system initialization task until battery is connected. That depends on your design. So far we have not implemented such a solution in our SDK, since no battery is not a normal use case.

Thanks MT_dialog