Author Topic: How was the timeout value decided?  (Read 794 times)

Tylerlee12

  • NewMember
  • *
  • Posts: 4
How was the timeout value decided?
« on: April 15, 2018, 04:28:33 PM »
Hi all.

The timeout value in the library code seems to be 50ms in the init function.  How was 50ms decided, and why is a timeout necessary in the first place?

https://github.com/LowPowerLab/RFM69/blob/f1cbbea15a224dc8c9125f0cf4206aa970b17193/RFM69.cpp#L112

Seems to be similar behavior here:

https://github.com/LowPowerLab/RFM69/blob/f1cbbea15a224dc8c9125f0cf4206aa970b17193/RFM69.cpp#L245

What is the CSMA limit?  Searched for CSMA in the datasheet but came up short.  Why is this CSMA timeout necessary here?

« Last Edit: April 15, 2018, 04:59:22 PM by Tylerlee12 »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: How was the timeout value decided?
« Reply #1 on: April 16, 2018, 08:55:17 AM »
There are different timeouts.
The first you point out is a safety limit used in the initialization of the radio (when your Mote starts up). If the radio is not even installed or defective or doesn't respond, we don't want the library code to be stuck forever waiting for a response. The radio module should respond way sooner than the 50ms. If it doesn't we exit from that loop.

The next is a collision avoidance mechanism, it is 1000ms. If the library detects there is activity in the RF channel and can't send for more than 1000ms, it exits.

Then there are the ACK limits used in the sketches, these can be variable but usually no more than 30ms on average.

All these limits are chosen as to what is reasonable in each scenario.