First findings after measuring delay times to see how far off the AB01 clock is from its nominal value. Tests done with same AB01 v1 board.
Method 1 - use a Timer
TimerEvent_t cycleTimer;
setup() {
Serial.begin(115200);
TimerInit(&cycleTimer, NextCycle);
NextCycle();
while (1) ;
}
void NextCycle(void) {
TimerSetValue(&cycleTimer, 10 * 1000);
TimerStart(&cycleTimer);
Serial.println();
}
Average deviation: 1208 ppm (≈1ms per 1000ms)
Method 2 - use delay()
setup() {
Serial.begin(115200);
while (1) {
Serial.println();
delay(10*1000);
}
}
Average deviation: 18852ppm (≈19 ms per 1000ms)
In both cases, the following terminal command sequence was used (cu.usbserial-0001 = host specific port name):
(stty speed 115200 >/dev/null && cat) </dev/cu.usbserial-0001 | ts -i %.S
-
So it appears the AB01 clock is not the root cause of the problem, but that it’s a software/firmware issue. That would also explain why @bns found almost the same ‘drift’ value. The use of Timer events instead of delay() seems a much better choice when accurate delays are required.
-
Next step was to change the Radio drift setting in ‘BuildOpt.h’, assuming that RadioLib uses delay():
#define RADIOLIB_CLOCK_DRIFT_MS (19)
Et voila, OTAA join request works!
(For now, one hurdle taken…)
the sleepDelay isn’t used everywhere in the stack, while the normal delay is.)
