This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF24L01+ ACK with payload basic question

After some days trying a very simple tx/rx, reading each page of the manual, looking at at this developer zone, etc. I´m still in trouble, with many distinct partial results, but none with a complete round trip.

I think it would be very helpfull to many people if you could post here all registers needed to be set at startup, and all registers needed to be set at each TX and RX moment. Also, registers to be checked to see if data arrived.

So, the simple transmission/reception shoud be:

1- PTX wants to send a 7 byte payload message to PRX and receive an ack payload of 7 bytes.

 ==> PRX Address is 3 byte (1,2,3). 
 ==> 2 times max. retransmission 
 ==> just pipe 0 is used (or any other that you recomend)
 ==> let´s use channel 100, 1Mb/s (or any other chnnel if you prefer) ?

 a- what registers shoud be configured at startup, in what order and values?
 b- what registers/ports shoud be configured when PTX wants to transmit, in what  order and values?

2- PRX previously has loaded a ack_payload same size ( 7 bytes)

 a- what registers shoud be configured at startup and in what order
 b- what registers/ports shoud be configured when entering reception mode

3- PTX receives ACK w/ payload

 a- what registers shoud be configured at startup and in what order (if any distinct from 1 above)
 b- what registers/ports shoud be configured in order to read this ack payload
  • I still could not find any simple working example all this site long, that shows a complete working example for nrf24L01+: one PTX transmit -> one PRX receive+ack+payload -> the PTX receives ack+payload.

    There are questions very similar and the problem is always almost the same: Partial results. For example, if both sides become ACK+PLD then PRX does not receive anymore (it was receiving when PTX/PRX where fixed lenght). devzone.nordicsemi.com/.../

    I think the final answer resides in the details, something is being "lost" during setup, besides registers, timings, sequences of register setups, etc.

    So, a basic complete and working example for nrf24L01+ and not for a "almost identical chip" would help a lot. (just one pipe, just one PTX and one PRX, just basic address, just fixed messages size (if it cares), etc.)

  • Hi,

    The nRF24L01+ is a radio transceiver. It does not include any MCU, just a SPI Slave interface that you control the device over. Since the nRF24L01+ can be controlled by any microcontroller with an SPI Master interface, it is hard to provide you with one working example, as there are just so many MCU-options to choose from.

    In order to send ACK payloads back and forth with two nRF24L01+ transceivers, you will need two setup both radios to share the same configuration except that one is on PRX mode and the other in PTX mode.

    Please see the "FEATURE" register in the nRF24L01+ datasheet, page 62. The three fields in this register must all be enabled, and to upload ACK_PLD on the PRX side, you need to do this with command "W_ACK_PAYLOAD" as described in page 51 in the datasheet.

    Cheers, Håkon

  • Thanks Hakon for your answer. Folows what I did in a PIC 16F + the results I got.

    I need to transmit a 7 byte msg, 3 (tried with 5 too)., and to receive auto ack+payload of 7 bytes in any channel/pipe.

    PTX side:

    INITIAL SETUP:

    • CONFIG => %00001110
    • SETUP_AW => $03
    • RX_ADDR_P0 (reg.$A0) => $41 42 43 [C2 C2] 3/5 bytes addr
    • TX_ADDR (reg. $10) => $41 42 43 [C2 C2]
    • EN_RXADDR => $01
    • SETUP_RETR => $92
    • RF_CH => $0A
    • RF_SETUP => %00000110
    • STATUS => $70
    • FEATURE=> %00000110
    • DYNPD => %0000001
    • cmd-> FLUSH_TX, FLUSH_RX

    LOOP send data each 2sec:

      • {
    • read/print status register

    • write status ==> $07

    • TX_ADDR (reg. $10)=> $41 42 43

    • W_TX_PAYLOAD=> $20 11 11 22 22 33 33

    • CONFIG=> %00001110

    • CE = 1 for 15 uS

    • wait 40mS (read/print registers)

    • flush TX, flush RX

    • wait 2 secs } --> ps: at this time I´m just trying to transmit, so I´m NOT reading ack+payload received.

    ==> DO you believe this is the right register setting and code to be able to transmit? Anything missing or out of sequence?

  • Hi, This looks correct from the PTX side config, but your handling of data is not correct. You should read the STATUS register, and write the content back to the STATUS register, not assuming all bits are set. It's important that you do not use a switch-case for masking the STATUS register, as there can be several bits set. Use a series of if-sentences: if (RX_DR){}, if (TX_DS){}, if (MAX_RT){}

    You should have the exact same configuration on the PRX side, besides CONFIG |= 0x01 for setting PRX mode. On your PRX when receiving an PAYLOAD, you can upload an ACK payload using cmd "W_ACK_PAYLOAD".

  • I received this sample project,Echo_ack_pl_ESB.zip, for the nRF24LE1, which contains an 8051 uP and an nRF24L01+ in one chip. The uP and RF parts communicate with each other via SPI internally, so you should be able to see the code and burrow down into its underlying SDK (nRFgo SDK) to see the actual calls being made. Hope this helps.

Related