ProfFan / dw3000-ng

BSD 3-Clause "New" or "Revised" License
10 stars 4 forks source link

[ADD] Carrier Frequency Offset estimation #12

Open trembel opened 4 months ago

trembel commented 4 months ago

This commit adds functionality to the Receiver type in order to estimate the Carrier Frequency Offset between a sender and a receiver according to DW3000 User Manual, Chapter 8.2.7.6.

ProfFan commented 3 months ago

r_wait_buf is meant to be small, I wonder how this could be elegantly handled, as a lot of other functionalities share this pattern. What I am currently doing is reading this register after r_wait_buf and before enabling RX again which clears the register. Pls let me know what you think

trembel commented 2 months ago

Sorry for the late response; You think to split it out of the rwait... and then sequentially read it out? I'm good with this as well; however, then I think also the readout of CIR / estimation of signal quality does not belong in there (as it is also very time intense) and to some extense even the readout of rx_time.

I'm a bit struggling on which structure would make sense. IMO there would be the need of a new state - as the ready state is the wrong state to readout rx_time, cir, cfo, ... (as there might not be any message arrived before). That's why I put it into the rx_wait fct, as afterwards the state is changed.

ProfFan commented 2 months ago

Note that only

rxing.finish_receiving()

will switch the type state, so you can read all these things before calling this function. One just need to be careful not to read stuff when r_wait_buf has not returned Ok.