DW3000 Official Firmware | VBAT@3.0V or VBAT@1.62V

Hello,

I have a question regarding the initialization procedure outlined in the official firmware documentation.

As shown in the picture below, during the initialization procedure, the VBAT value is retrieved from OTP memory.

Due to the typecast to (uint8_t), the VBAT@1.62V value is stored in “pdw3000local->vBatP”.

However, the logic that follows later in the code indicates that the value of VBAT@3.0V is intended to be stored in pdw3000local->vBatP.

For example, only a few lines later, there is a test to determine if a value has been stored in OTP memory, and if no value has been stored, a default value for VBAT@3.0V is stored in pdw3000local->vBatP.

What is the intended value that should be stored in “pdw3000local->vBatP” ? Is it VBAT@1.62V or VBAT@3.0V ?

Hi Firstdragon,

Theoretically, you should read the value which corresponds to the operating voltage of your project.

In the sample code you sent, we’re using the 1.62V value if reading from OTP. If not, then the structure will equal 0 and we use a default value of 0x74 (discard the 3V0 comment).

Note this voltage is only used as a reference point, so if you don’t perform any compensation in your application it will actually not be used.