-
Notifications
You must be signed in to change notification settings - Fork 61
Description
MKRWAN 1310 ARD-078 1.2.3 with MKRWAN.h 1.1.0 <-> TTN v3
I cannot find any return value table in the documentation for joinOTAA(). Perhaps one of the developers can help in answering that.
I've got problems as well using the sketch LoraSendAndReceive and FirstConfiguration with EU868 parameter. The sketch hangs at modem.joinOTAA() in the following infinite while (1) loop:
MKRWAN/examples/LoraSendAndReceive/LoraSendAndReceive.ino
Lines 33 to 37 in 45cb552
| int connected = modem.joinOTAA(appEui, appKey); | |
| if (!connected) { | |
| Serial.println("Something went wrong; are you indoor? Move near a window and retry"); | |
| while (1) {} | |
| } |
The problem is identified by me to be in the context of modem.joinOTAA(). Therefore I suppose the problem is band (US or EU) independent. Upon successful connection with TTN v3 (I can see Accept join-request Successfully processed join-request Forward join-accept message in the TTN dashboard), my MKR WAN 1310 puts out a connect return value of 0. As far as I know that is a correct behaviour for a successful connect. But the sketch checks for !connected and throws the error then because it evaluates the return value connected = 0. And 0 is by definition a binary false.
As a workaround I changed the check to if (connected != 0) so everything goes well after that, the sketch can continue to the main loop and I can successfully send messages to TTN v3.
What is the right return value from joinOTAA() for a successful connection with TTN v3?