LowPowerLab Forum

Hardware support => Moteino => Topic started by: hneiraf on October 18, 2013, 08:15:23 AM

Title: Adjusting ACK_TIME with lower bitrates
Post by: hneiraf on October 18, 2013, 08:15:23 AM
Hi all,

#define ACK_TIME     50 works for 56kbps
I have changed the bitrate to lower values, and I have seen the moteinos reporting ACK fail.
As I understand I have to increase the 50ms time for the ACK_TIME in order to get ACK OK with lower bitrate. Is there a rule?
Or just test and test... ?

Best,

HN
Title: Re: Adjusting ACK_TIME with lower bitrates
Post by: Felix on October 18, 2013, 08:17:32 AM
Lower bitrate means longer time to transmit the message. I suppose there is a bitrate-transmit time relationship but not sure how to best determine it.
The simple way is to just increase it until you feel it's a good timeframe to catch any expected ACK.
Title: Re: Adjusting ACK_TIME with lower bitrates
Post by: jbeale on October 19, 2013, 12:19:27 AM
You can make a quick sketch to measure and print out the actual time for an ACK. The code I posted in this message does that, among other things:
http://lowpowerlab.com/forum/index.php/topic,160.msg623.html#msg623

Excerpt from its output:
Sending[1]: - wait 12 On try 1 ACK after 9 msec. Packets: 79301 Retries: 271
Sending[25]: - wait 18 On try 1 ACK after 16 msec. Packets: 79350 Retries: 271


With the default datarate and 1 byte of data, you can see that the ACK happened in 9 msec (although I allowed for 12 msec), and with 25 bytes of data, it took 16 msec (although I allowed 18 msec).  You can use similar code to measure the actual ACK time with whatever bitrate you configured, then set the ACK timeout to a few msec longer just in case.  That assumes your timing is determined only by the radio module Tx/Rx time, and your receiving unit is not delaying its ACK reply further with other local processing prior to replying.
Title: Re: Adjusting ACK_TIME with lower bitrates
Post by: hneiraf on October 22, 2013, 09:20:58 AM
Thank you Jbeale :)