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

custom write ack payload.

My end goal for development is something like the following.

Master sends 0x00 slave sends back 13 bytes of data.
Master sends 0x01 slave sends back one byte of data.
Master sends 0x02, 0x03, 0x04 slave calls a function with parm (3,4)

My plan is to send the data with disabling auto ack from the master and then going in to receive mode, and having the slave return the data by going in to  transmit mode. Though I was wondering if any of that can be automated with a custom ack?

EDIT: Ok just read this on the net.

"This acknowledgement message can contain a preloaded payload, meaning a system of bi-directional communications can be established entirely using a master device that transmits data requests to each slave device in succession. The nRF24L01+ does this by storing a preloaded message into its transmit First-In-First-Out (FIFO) buffer, and sending this message on the listening pipe address as soon as a message with ack payload requested is received."

If that sort of thing is possible, is there a small example or write up on that? Can a "preloaded message" be dynamic?

  • Hi,

      

    My plan is to send the data with disabling auto ack from the master and then going in to receive mode, and having the slave return the data by going in to  transmit mode. Though I was wondering if any of that can be automated with a custom ack?

     As you mention, you can do this with using auto ACK, and ACK payload.

    To ensure that you receive the data, it is recommended that you send a "prepare ACK payload" command first to allow the host to upload it to the FIFO, then a dummy payload to fetch the actual ACK payload.

    If that sort of thing is possible, is there a small example or write up on that? Can a "preloaded message" be dynamic?

     What do you mean by "dynamic"? You can upload a ACK payload on a specific pipe, and on the next received payload on that specific pipe, the ACK will then be sent with your ACK payload.

     

    Kind regards,

    Håkon

  • Sounds straight forward. But as soon as I enable ackpayload or dynamicpayload I can no longer receive. Also noticed since I have been working with this my master needs to have tx and rx both set to the same address. (0x30 and 0x2a) IF not it will not send. I never understood that.

    master short code

    0x20,0x0A
    0x25,2
    0x26.0x0E
    0x23,3
    0x3D,6
    0x22,0x3f
    0x30,1,1,1,1,1
    0x2a,1,1,1,1,1
    pulse

    0xa0, 0xff send payload ready flag
    0xa0, 3 test code
    pulse


    receiver
    This is an Arduino so I do not know what it is really doing but here is the output.

    STATUS         = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
    RX_ADDR_P0-1     = 0x0101010101 0c2c2c2c2c2
    RX_ADDR_P2-5     = 0xc3 0xc4 0xc5 0xc6
    TX_ADDR         = 0x0101010101
    RX_PW_P0-6     = 0x01 0x01 0x00 0x00 0x00 0x00
    EN_AA         = 0x3f
    EN_RXADDR     = 0x03
    RF_CH         = 0x02
    RF_SETUP     = 0x0f
    CONFIG         = 0x0b
    DYNPD/FEATURE     = 0x03 0x06 <--- with this set I never receive data. with 0,0 I do.
    Data Rate     = 2MBPS
    Model         = nRF24L01+
    CRC Length     = 8 bits
    PA Power     = PA_MAX

  • Hi,

     

    ulao said:
    Also noticed since I have been working with this my master needs to have tx and rx both set to the same address. (0x30 and 0x2a)

    This is to get the hardware feature of auto-acking working. The transmitter will send on the TX_ADDR, then switch over to RX mode and wait for an incoming ACK on RX_ADDR_P0.

    On the PTX (primary transmitter), you need to set the TX_ADDR equal to RX_ADDR_P0 to get auto-acking working.

    On the PRX (primary receiver), this is not required.

    ulao said:
    But as soon as I enable ackpayload or dynamicpayload I can no longer receive.

    Do you have the exact same configuration on both the PRX and PTX device?

    If you only enable it on one side, it will stop working.

      

    ulao said:
    RX_ADDR_P0-1     = 0x0101010101

     Its very little change in bit pattern here. Its better if you test with the default "0xe7e7e7e7" address instead.

    The rule of thumb is to avoid starting with 0x00, 0xFF, 0x55, 0xAA, as these bit patterns have longer bit-wise '0' or '1' sequences, and 0x55/0xAA looks like a continuation of a preamble-sequence.

     

    Kind regards,

    Håkon

  • Do you have the exact same configuration on both the PRX and PTX device?

    It turned out to by the dynpd, I didnt know that was required. it was set to 3 on the slave and default on the master. Setting both to 3 fixed it.

    TNX!

  • Are there any other tips for speed here? my address is e7e7e7e7e7, my speed is 2MBPS and my rf at 18db.  I'm getting about 300us for the reply. I'm only 1 inch a way from the receiver. I set my SPI to max for my device and my nrf crc is 8 bit and I played with the pulse, where 3us does work, its not always working... So 10us it is then. Every us is going to count here so I want to make sure I think of everything before I move to the next step.

Related