analogdevicesinc / precision-converters-firmware

Precision Converters Embedded Firmware Repository
https://analogdevicesinc.github.io/precision-converters-firmware/
Apache License 2.0
16 stars 18 forks source link

Sign extend AD4170 data when channels are in bipolar configuration #105

Closed machschmitt closed 1 day ago

machschmitt commented 1 week ago

According to reports, "the AD4170 drivers don't do a sign extension when reading the ADC registers, as the ADC is 24 bits, but the int variable is 32-bit, it fills the 4th bit with zeroes even if bit 23 is 1."

The ADC output code is two's complement when the channel setup has the bipolar field configured in the AFE register. Sign extend ADC data when the channel is in bipolar configuration.

CLAassistant commented 1 week ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

machschmitt commented 2 days ago

Hello @jansunil , can you have a look at this bug fix? Thanks