Faulty dwt_readtempvbat readings

We get issues when reading out the temperature and voltage using the dwt_readtempvbat.
We use it with the fastSPI enabled, the deca_sleep(1) inside works as expected.
After transmitting we consistently read out the correct values.
After receiving a frame, we sometimes read out incorrect values.
After waking up the DW1000 and then using the dwt_readtempvbat we also sometimes read incorrect values.

In our data it seems the leftmost bit to be wrong.

0x8d which gives the assumed correct value of 47.5 degrees C
0x0d which gives the wrong value of -97.2 degrees C

0xa8 which gives the assumed correct value of 3.26V
0x28 which gives the wrong value of 2.53V

The faulty temperature and faulty voltage don’t happen consistently together.
We get the following readings:

  • both values are correct
  • only the temperature is incorrect
  • only the voltage is incorrect
  • both the temperature and voltage is incorrect

Hi mdw,

As you are using fast SPI, you should call the following dwt_readtempvbat(1). Can you confirm that’s what you do ? I guess yes as you mention the sleep, but just double checking.

Have you checked if you have the same issue with slowspi ?

For example swap the call for :
port_set_dw1000_slowrate(); temp_vbat = dwt_readtempvbat(0); port_set_dw1000_fastrate();


We are indeed using dwt_readtempvbat(1).
We experience the same issue with the suggested slowspi code.
With fastspi, increasing the internal sleep in dwt_readtempvbat to 5ms, this also does not resolve the issue.

Further testing shows adding a 4 millisecond delay after a frame has been received and then reading out the temperature/voltage, the issue does not happen anymore. at 1-3ms the issue still happens. (again using the fastspi)

are you using the DWM1001-DEV kit or a custom pcb?
If it is a custom pcb it can be an electrical problem.
Verify that you have decoupling capacitors and a low-curl regulator. ADC readings are very sensitive to the quality of the power supply.