Skip to content

joinOTAA() in sketch "LoRaSendAndReceive" and other examples from this lib gives false error "Something went wrong …" #139

@mac-arno

Description

@mac-arno

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:

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: documentationRelated to documentation for the projecttype: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions