Hi all guys!
I’m a master’s degree student and i’m using TREK1000 kit for my thesis (with original version 2.10).
Now, i’m trying to face the problem of NLOS condition. Doing some researches, I found out that I could need two functions of the DW1000 API: dwt_readdignostics() and dwt_readaccdata.
So, I build up two functions that retrieve the data I need and put them out in the USB (using TeraTerm i can see what happens).
-
void readacc()
{
uint8 usbCOMout_acc[LCD_BUFF_LEN*4];
int n_acc;
for(int i = 0;i<992;i++)
{
uint8 *cir; cir = (uint8 )malloc(5sizeof(uint8));
dwt_readaccdata(cir, 5, 4*i);
int16 real =0;
int16 imag =0;
double amp = 0;
real = (int16)(cir[2] << 8) | (int16)(cir[1]);
imag = (int16)(cir[4] << 8) | (int16)(cir[3]);
amp = fmax(abs(real),abs(imag)) + 1/4*fmin(abs(real),abs(imag));
n_acc = sprintf((char*)&usbCOMout_acc[0], “REAL: %d, IMAG: %d, AMP: %f\n”,real,imag,amp);
send_usbmessage(&usbCOMout_acc[0], n_acc);
usb_run();
free(cir);
}
}
-
void readdiag()
{
uint8 usbCOMout_diag[LCD_BUFF_LEN*4];
int n_diag;
dw_rxdiag_t info_utili;
dwt_readdignostics(&info_utili);
n_diag = sprintf((char*)&usbCOMout_diag[0], “FP1_AMP: %d, FP2_AMP: %d, FP3_AMP: %d, FP_IND: %f\n”,info_utili.firstPathAmp1,info_utili.firstPathAmp2,info_utili.firstPathAmp3,info_utili.firstPath);
send_usbmessage(&usbCOMout_diag[0], n_diag-2);
usb_run();
}
Now, my problem is where I should insert this functions.
At the beginning, I tried to insert them in main.c after the function instance_run() that implement the TWR application.
An example of what I see (using only readdiag() and 1 anchor with 1 tag):
mc 01 0000009f 00000000 00000000 00000000 47f1 c0 001d2698 a2:0
mr 01 ffffffba 00000000 00000000 00000000 47f1 c0 404b404b a2:0
FP1_AMP: [color=#ff3333]2242[/color], FP2_AMP: [color=#ff3333]2218[/color], FP3_AMP: [color=#ff3333]1827[/color], FP_IND: [color=#ff3333]0.00000[/color]
Clearly, data are wrong cause I know that these values should be about 17k-20k and the first path index should not be 0.
So, I tried to move the functions around the code, first in instance.c after the reception of the frame ( case DWT_SIG_RX_OKAY) and then also in instance_common.c, always in the case DWT_SIG_RX_OKAY.
The results are always the same, with these amplitudes of about 2k.
[color=#333333]What might be the cause?[/color]
[color=#333333][color=#333333]Thank you in advance[/color]
Alessio[/color]