Negative sts quality and dw_readstsstatus return error


I’m using DWM3000 with stm32f401ret6, I tried to add STS to my configuration and add the basic sts validation:

int goodSts = 0;           /* Used for checking STS quality in received signal */
int16_t stsQual;           /* This will contain STS quality index */
uint16_t stsStatus;        /* Used to check for good STS status (no errors). */
int err = 0;
goodSts = dwt_readstsquality(&stsQual);
err = dwt_readstsstatus(&stsStatus, 0);
if(!(goodSts >= 0) && !(dwt_readstsstatus(&stsStatus, 0) == DWT_SUCCESS)){
	dwt_rxenable(DWT_START_RX_IMMEDIATE); //re-enable receiver again - no timeout

My situation is that goodSts is returning almost always -76 and dwt_readstsstatus returning -1.
stsStatus have these values
68 - 1000100
76 - 1001100
64 - 1000000
What can I do to improve the sts quality? I feel kind of lost.

Thanks in advance.

PS. im using the default keys on both devices.
static dwt_sts_cp_key_t cp_key = { 0x14EB220F, 0xF86050A8, 0xD1D336AA, 0x14148674 };
static dwt_sts_cp_iv_t cp_iv = { 0x1F9A3DE4, 0xD37EC3CA, 0xC44FA8FB, 0x362EEB34 };

Error on STS usually means exactly what sts is for: to ensure that the same sts were used on tx anx rx sides.
If something wrong in your config or settings, you would get sts errors by its definition.
Secondly, sts would also test your antennas, if you are using custom antenna design.

Assuming you are using standard Qorvo design kit. You need to ensure that you ate transmitting frames with STS len set on both sides to the same: 64, 128, 256.
Sts key/iv should be set to the same value on each transmission & expected reception.
So you need to “load key iv” correct values every time.
When your transmitter or received tx/rx then inside the chip the iv counter gets incremented +1 on each successful tx/rx, so it is very easy to get them desynced. As a result you would always get wrong sts :wink:

So recommendations:
Ensure correct frames get sent.
Ensure the known sts loaded on each rx/tx