What is the phase relationship between two PoAs on the dw3220？

this is my config

and I use dwt_readdiagnostics() to get diagnostic values.

but most time stsPOA - sts2POA does not equal to pdoa.

what’s wrong with that?

There is a phase rotation that occurs internally when calculating PDoA between STS1 and STS2 using mode 3.
Change to Mode 1, and use IP_POA - STS_POA.
Or if you need to use mode 3, you can set the CIA_ADJUST register = 0.

thank you for your reply. I did what you said. and it still didn’t work.
This is the waveform I got, with the green line representing pdoa and the purple line representing stspoa - sts2poa. As can be seen from the graph, sometimes the two lines coincide but sometimes they do not coincide, and when they do not coincide, the trend of change is the same.

Can you share the code you are using to convert the data?
You need to calculate the two’s complements as well.
Here is a code snippet to convert the data.

``````"""
poa_convert.py
===
Provides three functions to convert raw PoA register values to Phase Difference in degrees on DW3000
"""
import numpy as np

def convertPDoA(num):
answer = int(num) / (1 << 11) * (180 / np.pi)

def twc(val, nbits):
s_bit = 1 << (nbits-1)
return -(val & s_bit) | (val & (s_bit-1))

def convertPoA(num):
phase = int(twc(num, 14)) / (1 << 11) * (180 / np.pi)
return phase

def main():
# Example PDoA and PoA values
pdoa = [502, 96, 152, -112, 24, -822, -1266, -2466, -1862, -2686, -3346, -4448, -2442, -1180, -232, 1684, 2428, 2996, 4024, 4662, 5514, 5044, 5330, 4918, 3120, 1342, -630, 344]
sts1 = [10444, 13510, 3192, 13200, 10624, 6004, 1152, 13894, 894, 2136, 4376, 12944, 3384, 16034, 5406, 15508, 1008, 10894, 3226, 3184, 2386, 6378, 2880, 3098, 4124, 4470, 5486, 15308]
sts2 = [6426, 13414, 3040, 13312, 10600, 10342, 2418, 16360, 2756, 4822, 11238, 1008, 5826, 830, 5638, 13824, 14964, 4382, 15586, 14906, 13256, 1334, 13934, 14564, 1004, 3128, 6116, 14964]

print('PDOA raw: ', pdoa)
print('STS1 raw: ', sts1)
print('STS2 raw: ', sts2)
print(f'{"PDoA":>10}{"STS1":>10}{"STS2":>10}{"STS1-STS2":>12}')

# Here we print the actual value from the PDoA register and the PDoA calculated from the two STS PoAs
for n, p in enumerate(pdoa):
diff = (((convertPoA(sts1[n]) - convertPoA(sts2[n]))) + 180) % 360 - 180
print(f'{convertPDoA(pdoa[n]):>10.3f}{convertPoA(sts1[n]):>10.3f}{convertPoA(sts2[n]):>10.3f}{diff:>12.3f}')

if __name__ == "__main__":
main()
``````