dparson55 / NRFLite

nRF24L01+ library with AVR 2 pin support, requiring very little code along with YouTube videos showing all available features.
MIT License
161 stars 26 forks source link

(NRF24L01) ("NRFLite.h") (SplitDataAcrossMultiplePackets_RX) can't modify the packet size >30 #84

Closed gordon4liu closed 7 months ago

gordon4liu commented 7 months ago

Hi, I only modify the packet size to 60 on the dual side; SplitDataAcrossMultiplePackets_RX and SplitDataAcrossMultiplePackets_TX. const static uint8_t RADIO_PACKET_DATA_SIZE = 60;

The Tx part don't show any error on COM port. The Rx side don't show any thing. Could you give any suggestion?

PS: the initial size 30 that is work well.

dparson55 commented 7 months ago

Hello, the radio hardware only supports a packet size of 32 bytes so the RadioPacket in SplitDataAcrossMultiplePackets_TX and SplitDataAcrossMultiplePackets_RX can only be that large, you cannot change the value to 60. 1 byte is used for the SentenceId, 1 byte for the PacketNumber, and 30 bytes for Data (1 + 1 + 30 = 32).

struct RadioPacket
{
    uint8_t SentenceId;
    uint8_t PacketNumber;
    uint8_t Data[30];
};

The SplitDataAcrossMultiplePackets_TX and SplitDataAcrossMultiplePackets_RX examples show how to get around this 32 byte limitation. SplitDataAcrossMultiplePackets_TX cuts a 72+ byte string of data into 3 packets and sends them one at a time while SplitDataAcrossMultiplePackets_RX re-assembles those 3 packets back into the original 72+ byte piece of data.

If you read the comment at the top of SplitDataAcrossMultiplePackets_TX.ino maybe it will help.

The radio hardware supports a maximum data packet size of 32 bytes, so if you have a single piece of data that
cannot fit into a packet, the data will need to be spread across multiple packets.

In this example a fake GPS data sentence containing at least 72 bytes is created and then sent
using 3 separate packets.
dparson55 commented 7 months ago

Please close the issue if my answer was sufficient.

dparson55 commented 7 months ago

Closing due to lack of response.