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
Parents
  • 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?

Reply
  • 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?

Children
  • 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".

Related