I'm using IMU (BNO08x) together with DWM1000 on the same SPI bus on ESP32-S3. When using only one of them, they worked out fine, but when using both together, none of them worked. DWM1000 will very frequently report RXOK-TXCONF-RXTO-RXERR in series while TXCONF shouldn't be initiated yet.
Solution: TXCONF-RXTO-RXERR shall not trigger at the same time, so after days of diagnosis, I figured that this is because in dwt_ISR() it checks for all interrupt types based on the SYS_STATUS_ID register. However, DW1000's SPI bus is not the most tolerant type: if the polarity of SCLK is flipped at the beginning of the transaction after CS is pulled low, it will not respond to the message, returning 0xFFFFFFFF for status. This will trigger all the interrupts in order. A walk-around already implemented in the code is adding a redundant read immediately after acquiring SPI bus:
// Add a idle read here to allow SPI to switch to the right mode.
// for ESP32, mode switching occurs at the start of transaction
// and this moment will be later than CS pulling low.
// Thus the first reading will be invalid.
// add this to ensure that the next useful spi reading is valid.
dwt_read32bitreg(SYS_STATUS_ID);
As long as you acquire bus using decamutexon() before doing anything, you are good.
I'm using IMU (BNO08x) together with DWM1000 on the same SPI bus on ESP32-S3. When using only one of them, they worked out fine, but when using both together, none of them worked. DWM1000 will very frequently report RXOK-TXCONF-RXTO-RXERR in series while TXCONF shouldn't be initiated yet.
Solution: TXCONF-RXTO-RXERR shall not trigger at the same time, so after days of diagnosis, I figured that this is because in
dwt_ISR()it checks for all interrupt types based on theSYS_STATUS_IDregister. However, DW1000's SPI bus is not the most tolerant type: if the polarity of SCLK is flipped at the beginning of the transaction after CS is pulled low, it will not respond to the message, returning 0xFFFFFFFF for status. This will trigger all the interrupts in order. A walk-around already implemented in the code is adding a redundant read immediately after acquiring SPI bus:As long as you acquire bus using decamutexon() before doing anything, you are good.