Hi there,
in RFM69 line 242 it says
//Serial.print(" ~ms:"); Serial.print(millis() - sentTime);
The comment in line 231 says
// replies usually take only 5..8ms at 50kbps@915MHz
What do you mean if talking about "replies"? If I'm not wrong the time "~ms-time" (millis() - sentTime) means the time for the message to travel from the sender to the receiver plus the time for the ack from the receiver to the sender. Am I right? According to the code it must be the time forth and back because "sentTime" is the sender's time when he sent the message.
But: Why do messages take about 20 ms (60 bytes) while the replay only takes a little bit less than half, around 8 ms? What am I missing here?
Thank you very much! It's pretty urgent :)
A message with more bytes takes more time to modulate into radio waves. Its like a long word taking more letters and ink and time to write down and read back. Just physics...
A reply usually means an ACK, or an empty packet with just the deader bytes but no payload. A normal message can have anywhere from 1 to 61 bytes in my implementation of the RFM69 library.
Hi Felix, thank you very much for your quick reply! I agree to your post. But I think you missunderstood my question. I'm familiar with the physical background and know your code very well.
My question refers to line 242 in RFM69.cpp: "//Serial.print(" ~ms:"); Serial.print(millis() - sentTime);"
This line will print a specific time (in milliseconds). But what does this time mean? In line 231 you are talking about replies and how long they take: "// replies usually take only 5..8ms at 50kbps@915MHz".
Can you please explain to me what this specific time means? At first I thought it's the time it takes for the ACK to be transmitted from the receiver to the sender (after the message was sent from the sender to the receiver). But "sentTime" refers to the time when the sender sends it's (payload) message. So the time in line 242 is the time it takes to send the message from the sender to the receiver plus the time for the ack to travel from the receiver to the sender of the (payload) message. Let's assume I am right: wouldn't that be equal to the TRANSMITPERIOD that I set in the example-files? If I set the TRANSMITPERIOD to such a short value (like 5 ms) so that the node is basically sending as fast as possible (as it is not limited by the transmitperiod), why does this take around 20 ms for 60 bytes (payload from sender to receiver and ack from receiver to sender) while the "specific time" (see line 242 in RFM69.cpp: Serial.print(millis() - sentTime) is less? They should be equal?
Thank you very very much in advance! :)
It's basically an assumption based on some scope and logic analyzer measurements I did when I developed the library. ACKs are empty messages with only a few header bytes. They take about 5-8ms to transmit. Those Serial.prints were included for debugging purposes to help see how long messages are taking between when the packet is placed in the radio, and when the radio raises the PACKET-SENT interrupt, that's all..