I am writing code for an ESP32 to send data using a NRF24L01+ module to another NRF24L01+ module connected to an Arduino Pro Mini. The Arduino can successfully send data to the ESP32. So everything is properly wired up and the RF settings are compatible. However, when I switch roles, no packets are received on the Arduino and all transmitted packets set the MAX_RT (maximum retries reached) flag in the status register (on the ESP32 side).
The strangest thing is that I'm unable to flush the TX FIFO queue, which one is supposed to do to continue with the next package. Sending 0xE1 to the RF module seems to have no effect. After three failed packets, both the STATUS and the FIFO_STATUS register indicate TX FIFO full. And no amount of flush commands can clear it.
Question: Why does the FLUSH_TX command have no effect?
The code is written in C for the ESP32 SDK (aka ESP32 IDF) based on FreeRTOS. The communication is a simple unidirectional communication: either end is either sender or receiver only.
I've already ruled out many things:
- I have verified the SPI communication with a logic analyzer and not found a problem.
- I have compared the SPI communication of the ESP32 to the Arduino and they are almost identical. Main differences: timing; and ESP32 code stores configuration registers in memory to reduce number of register reads.
- I have swapped the NRF24L01+ modules with no effect.
- I have added a 47µF capacitor between GND and VCC close to the RF module.
Here's a dump of most of the registers:
STATUS = 0x0f: RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=1 TX_FULL=1
FIFO_STATUS = 0x21
RX_ADDR_P0 = 0x38a8bb7201
RX_ADDR_P1 = 0x389f30cc1b
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0x38a8bb7201
RX_PW_P0-6 = 0x20 0x20 0x00 0x00 0x00 0x00
EN_AA = 0x3f
EN_RXADDR = 0x03
SETUP_AW = 0x03
REG_SETUP_RETR = 0x5f
RF_CH = 0x52
RF_SETUP = 0x03
CONFIG = 0x0e
DYNPD/FEATURE = 0x00 0x00