LibreSolar / bms-firmware

Firmware for LibreSolar BMS boards based on bq769x0, bq769x2 or ISL94202
https://libre.solar/bms-firmware/
Apache License 2.0
146 stars 67 forks source link

OV/UV_TRIP config kind of return probaly off by 1000 * (set im V return in mV) #58

Open kfessel opened 6 months ago

kfessel commented 6 months ago

sorry very short

https://github.com/LibreSolar/bms-firmware/blob/58d2384f013ec466e16b1b6201fbb8aac653a2c9/drivers/bms_ic/bq769x0/bq769x0.c#L287-L288

of by a factor of 1000 (adc_gain is in µV/LSB)

ic_conf->cell_uv_limit =
    ((0x1000UL | (uv_trip << 4)) * dev_data->adc_gain / 1000.0 + dev_data->adc_offset) / 1000.0;

https://github.com/LibreSolar/bms-firmware/blob/58d2384f013ec466e16b1b6201fbb8aac653a2c9/drivers/bms_ic/bq769x0/bq769x0.c#L244-L245

of by a factor of 1000 (adc_gain is in µV/LSB) and for ti manual SLUSBK2I – page 22 OV trip level is mapped to “10-XXXX-XXXX–1000”.

therefor the (1U << 13 | ov_trip << 4) should probaly be (1U << 13 | ov_trip << 4|0x8) to match the effective value

 ic_conf->cell_ov_limit = 
    ((0x2008UL | (ov_trip << 4)) * dev_data->adc_gain / 1000.0 + dev_data->adc_offset) / 1000.0;