LibreSolar / bms-firmware

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

bq769x0: repeat read due to crc fail might read different bytes an might led to wrong data read #53

Closed kfessel closed 9 months ago

kfessel commented 9 months ago

line 140 will probably try reading a different byte after the crc check failed -> there might be wrong date

https://github.com/LibreSolar/bms-firmware/blob/aa2203aedb176e5c9566f8ba862edca976f1ea4c/drivers/bms_ic/bq769x0/bq769x0.c#L139-L150

you might want to extend the loop to include a reg-addr write before the read retry

martinjaeger commented 9 months ago

True, good spot. Thanks for reporting!

Do you already have a fix? Otherwise I can make a suggestion in the coming days.

martinjaeger commented 9 months ago

@kfessel Please see PR #55 for a fix.