1

i struggle to figure out the max payload for the RF24 Network library without payload fragmentation. It uses a NetworkHeader with the Attributes from_node, to_node, id, type and reserved. This must be send to and lowers the amount of Bytes of the payload.

Can any one tell me how many Bytes I can write without sending two packages?

1 Answer 1

3

According to the source code:

const static unsigned int max_frame_payload_size = MAX_FRAME_SIZE-sizeof(RF24NetworkHeader);

that would be 24 bytes. Maximum lenght of payload for NRF24L01+ is 32 bytes and the RF24NetworkHeader seem to be 8 bytes long. So you can send up to 24 bytes in one package.

EDIT:
Here is the stripped RF24NetworkHeader declaration code from which can be seen sizeof(RF24NetworkHeader) is 8 bytes.

struct RF24NetworkHeader {
  uint16_t from_node;           // 2 bytes
  uint16_t to_node;             // 2 bytes
  uint16_t id;                  // 2 bytes
  unsigned char type;           // 1 byte
  unsigned char reserved;       // 1 byte
  static uint16_t next_id;      // static member doesn't count for sizeof()
  RF24NetworkHeader() {}
  RF24NetworkHeader(uint16_t _to, unsigned char _type = 0): to_node(_to), id(next_id++), type(_type) {}
  const char* toString(void) const;
};
2
  • Thanks, I hoped it is written somewhere in the library docs but this approach sounds very plausible too. Commented Dec 12, 2016 at 11:46
  • Maybe it even is written somewhere but I've never used Arduino and I don't even have one so I don't know :-) I've been using AVRs for years but only with AVR Studio and ISP programming. Now that you said, if you look at the source of the .h file, there is the: The actual frame put over the air consists of a header (8-bytes) and a message payload (Up to 24-bytes), line in the comments so it might have been picked by some doc generators.
    – Chupo_cro
    Commented Dec 12, 2016 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.