I have a simple app which is polling a DWM1000 module to determine if a good packet has been received. Everything is running in single buffer mode, in that I don’t enable double buffer mode. It’s a small TDOA solution, with a handful of tags that blink at 0.5Hz. A master clock is transmitted every 100ms.
Randomly, the anchors get stuck with an RXOVRR in the SYS_STATUS register and turns the receiver off. What I can’t figure out is why, if everything is single buffer, and auto rx with RXAUTR is disabled. I’m expecting a packet every ~100ms, and a the tag blinks are at 0.5Hz. But once I received a good packet, I process that before turning the receiver back on. So there should never be an over run, as the receiver is only enabled when I’m finished processing the last packet received.
I have noticed that HSRBP and ICRBP do change when I print out the status register for debugging, but both are always set or clear.
I do have dwt_setrxtimeout(0) set, as I basically want to just wait and listen for packets to arrive - power isn’t a problem. I’ve tried with a timeout set, but the problem still appears randomly. This is a cut down snippet of the code that receives the packets.
status = dwt_read32bitreg(SYS_STATUS_ID);
if (status & (SYS_STATUS_RXFCG)) // Frame RX Checksum Good
{
// Receive and process packet
dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_RXFCG);
dwt_rxenable(DWT_START_RX_IMMEDIATE);
memset(rx_buffer, 0, sizeof(rx_buffer));
}
else if (status & (SYS_STATUS_ALL_RX_ERR)) // An RX error
{
printf("RX ERROR: 0x%08lX\n", status);
status_led_flash(1, LED_RED);
dwt_rxreset();
dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_ALL_RX_ERR);
dwt_rxenable(DWT_START_RX_IMMEDIATE);
}
else if ((status & SYS_STATUS_RXOVRR) == SYS_STATUS_RXOVRR)
{
status_led_flash(1, LED_RED);
printf("OVR ERROR: 0x%08lX\n", status);
dwt_forcetrxoff();
dwt_rxreset();
dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_ALL_RX_ERR);
dwt_rxenable(DWT_START_RX_IMMEDIATE);
}
The user manual RXOVRR is only cleared by writing to HRBPT, if I can’t prevent the RXOVRR error, would simply writing to HRBPT twice (to end up where it was) be a workaround? It also says it’s only used in double buffer mode, which I don’t use, so it’s all a bit confusing.
I’m using an ESP32-S3 for the anchors running at 240MHz, the SPI to the DWM1000 is 16MHz. Checking the SPI with a scope it’s all OK, and I don’t see any discrepancy between what the ESP32-S3 is reading compared to the SPI. I did have to enable SPI_EDGE in the SYS_CFG register for reliable SPI comms with the ESP32.