manuelbl / ttn-esp32

The Things Network device library for ESP32 (ESP-IDF) and SX127x based devices
MIT License
301 stars 64 forks source link

Understanding when we can transmit new message #46

Closed maizezoidberg closed 2 years ago

maizezoidberg commented 2 years ago

Hi, I have an JOIN and data transfer duty cycle, but I have a question about LMIC timings and task states.

I have this logs (with my comments):

I (157380) Lora driver: Lora new message in queue, goes to join state I (157381) Lora driver: Lora state check join <--- here we call ttn_resume_after_power_off(60) I (157382) Lora driver: Lora state try to join TTN <--- here we call ttn_join() I (157388) ttn: event EV_JOINING I (164371) ttn: event EV_TXSTART I (169404) ttn: event EV_RXSTART I (169512) ttn: event EV_JOINED I (169513) Lora driver: Lora state try to join - success join, goes to send uplink <--- here we get TRUE result from ttn_join() I (169513) Lora driver: Lora state send uplink <--- here we call ttn_transmit_message(buffer, sizeof(buffer), 31, true) I (169519) ttn: event EV_TXSTART I (170561) ttn: event EV_RXSTART I (170641) ttn: event EV_TXCOMPLETE Uplink message [size: 13]: **<--- here we get TTN_SUCCESSFUL_TRANSMISSION from ttn_transmit_message(...)*** 0xA5 0x11 0x22 0x33 0x44 0x00 0x55 0x66 0x77 0x00 0x00 0x00 0x00

I (170653) Lora driver: Before idle ticks: 4002 <-- then we try to check ttn_busy_duration(), and get 4002 and call ttn_wait_for_idle()

I (174655) ttn: event EV_TXSTART <-- why LMIC open TX-RX1 cycle after transmit success (1 time) I (176797) ttn: event EV_RXSTART I (178325) ttn: event EV_TXCOMPLETE I (290160) ttn: event EV_TXSTART <-- why LMIC open TX-RX1-RX2 cycle after transmit success (2 time) I (292302) ttn: event EV_RXSTART I (293298) ttn: event EV_RXSTART I (293539) ttn: event EV_TXCOMPLETE

I (293610) Lora driver: After idle! <-- here ttn_wait_for_idle() unblock task and then we finish transmission

Help me understand why, after receiving a response about a successful transmission (ttn_transmit_message return TTN_SUCCESSFUL_TRANSMISSION ), the LMIC stack tries to open the TX-RX1-RX2 transmission windows twice more, and only after that goes into the IDLE state? Thank you for help

maizezoidberg commented 2 years ago

Solved! We did not set ADR DISABLE. https://github.com/manuelbl/ttn-esp32/issues/18