drivers/batt_smbus: fix BQ40Z80 timeout problem (#22751)

Co-authored-by: cyril.calvez <c.calvez@elistair.com>
This commit is contained in:
Cyril C 2024-02-15 19:24:40 +01:00 committed by GitHub
parent 8dc3975456
commit 74303a79e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View File

@ -392,6 +392,12 @@ int BATT_SMBUS::get_startup_info()
uint16_t state_of_health;
ret |= _interface->read_word(BATT_SMBUS_STATE_OF_HEALTH, state_of_health);
/* ManufacturerAccess dummy command to init the ManufacturerBlockAccess routine
in the BQ40Zx0 and avoid timeout during LifetimeDataFlush.
test Sleep > 20 ms to give time to init the ManufacturerBlockAccess routine*/
ret |= _interface->write_word(BATT_SMBUS_MANUFACTURER_ACCESS, BATT_SMBUS_DEVICE_TYPE);
px4_usleep(30_ms);
if (!ret) {
_serial_number = serial_num;
_batt_startup_capacity = (uint16_t)((float)remaining_cap * _c_mult);

View File

@ -107,6 +107,7 @@ using namespace time_literals;
#define BATT_SMBUS_SECURITY_KEYS 0x0035
#define BATT_SMBUS_DEVICE_TYPE 0x0001
#define BATT_SMBUS_LIFETIME_FLUSH 0x002E
#define BATT_SMBUS_LIFETIME_BLOCK_ONE 0x0060
#define BATT_SMBUS_ENABLED_PROTECTIONS_A_ADDRESS 0x4938