How do I query the state of the DW1000? That is, I want to check if it is in IDLE, RX, or TX.
As far as I know, you can issue commands to force it into a particular state, like issuing the [font=Courier New]dwt_rxenable()[/font] API function to put it into RX, but you cannot check which state it is currently in.
The issue I’m having is that after several minutes of use it will randomly stop receiving and return to IDLE. I can’t just repeatedly call [font=Courier New]dwt_rxenable()[/font] because this will cancel a reception if one is in progress. I’d like to check if it has been IDLE for too long and reset if so.
The DW1000 will not stop randomly … it will stop because of a receive event - please check what this is (e.g. timeout, error, good packet etc.) and re-enable the receiver accordingly.
Note: If you issue consecutive commands, e.g. RX followed by another RX or TX, the second command will not stop the 1st operation … the 1st operation will either stop as a result of RX event or if you issue a TRXOFF command.
Are you sure about this? I tried repeatedly calling rxenable and it stopped receiving. Also: the manual says there is a 16us delay after setting the RXENAB bit so it would make sense that spamming RXENAB would disable the receiver. It doesn’t say anything about ignoring subsequent RXENABs.
It also makes sense that re-enabling RX would disable it temporarily, because if you’ve changed any RX settings (preamble, PAC, SFD, etc) it has to reload the new settings and start over.
Looks like all the system state bits are in register 0x19. I wonder why didn’t they put this in the manual? It just register 0x19 is “reserved” and doesn’t list any of the bits.