Closed dolfandringa closed 4 years ago
@dolfandringa Dolf, are you using a closed loop in your code? Like this or a similar approach:
while (1) {
os_runloop_once();
/* do something */
}
If yes, can you try for me please disabling your DEBUG logs back to original and inserting a small delay() call in the loop? Like this:
while (1) {
os_runloop_once();
/* do something */
delay(5);
}
Let me know of the results please.
I am using the standard arduino loop()
function and have indeed os_runloop_once
in there. I will add a delay in there to see if it help and let you know.
@altishchenko That indeed worked! I guess the os_runloop_once is called again before the timed handler was set properly or something? Weird, but it works! Thanks.
Describe your question or issue A timing issue is causing EV_TXCOMPLETE only to get issued if I add a few debug print statements. I am using the LMIC library with abp. I can consistently reproduce this issue with the teensy++ 2.0. I am using these compile flags:
I have modified lmic.h slightly so LMIC_DEBUG_PRINTF is also available with LMIC_DEBUG_LEVEL=0 (using
#ifdef LMIC_DEBUG_LEVEL
instead of#if LMIC_DEBUG_LEVEL > 0
). This allows me to add a few debug print statements manually.With the standard abp sample, but using only a single channel through
the EV_TXSTART event gets issued consistently, but the EV_TXCOMPLETE event never happens. The gateway does receive the packet, so it is sent correctly. And checking the DIO0 and DIO1 pins with my oscilloscope, they do go high. The IRQ's are also detected correctly (saw with a few debug statements), but somehow there is a timing issue once the IRQ happens, that prevents EV_TXCOMPLETE from being triggered.
If I add 2 LMIC_DEBUG_PRINTF statements, EV_TXCOMPLETE gets issued just fine. So I am guessing there is a timing issue which causes the timing of
os_setTimedCallback
to be wrong?Without additional debug statements, execution halts after updataDone like this:
But when adding debug print statements in setupRx1 and setupRx2DnData, EV_TXCOMPLETE gets issued normally like this:
I am guessing there is an issue with calculating the sec2osticks time? I do see the
OSTICKS_PER_SEC
, but don't know how an "ostick" is defined. The teensy++ 2.0 uses a 16MHz AT90USB1286, which I run at 3.3V.Environment