bitcraze / libdw1000

Driver for DW1000
Apache License 2.0
44 stars 32 forks source link

Added receiver only reset for fixing aleatory wrong timestamp meassurements #12

Closed acecilia closed 6 years ago

acecilia commented 6 years ago

Added receiver only reset for fixing aleatory wrong timestamp meassurements, needed due to error in the RX auto-re-enable functionnality. See page 35 of DW1000 manual, v2.13:

Note: Due to an issue in the re-initialisation of the receiver, it is necessary to apply a receiver reset after certain receiver error or timeout events (i.e. RXPHE (PHY Header Error), RXRFSL (Reed Solomon error), RXRFTO (Frame wait timeout), etc.). This ensures that the next good frame will have correctly calculated timestamp. It is not necessary to do this in the cases of RXPTO (Preamble detection Timeout) and RXSFDTO (SFD timeout). For details on how to apply a receiver-only reset see SOFTRESET field of Sub- Register 0x36:00 – PMSC_CTRL0.

See also: https://github.com/Decawave/dwm1001-examples/blob/master/deca_driver/deca_device.c#L2275

In terms of tof, this PR avoids aleatory spikes in tof meassurements: captura de pantalla 2018-07-03 a las 15 03 55

Also, added handling for more errors and timeouts according to what seems to be the official Decawave DW1000 C driver (https://github.com/Decawave/dwm1001-examples/blob/master/deca_driver/deca_regs.h).

Also, seems like due to this error with the RX auto-re-enable functionnality, Decawave recommends to use manual RX re-enable. See: https://www.decawave.com/decaforum/showthread.php?tid=613

krichardsson commented 6 years ago

Thanks!