Mac join otaa fails


(Clundy) #1

Hello,

I have been trying for weeks to get this arduino uno working and connecting to my gateway. The gateway is connected and registering with the console however the device cannot. Here is the message I get. Why is it denied?
Here is the setup.

Data Rate: 3
RX Delay 1: 1000
RX Delay 2: 2000
– JOIN
Model: RN2903
Version: 0.9.5

  1. I deleted the device, renamed it and tried several times
  2. I tried several different profiles through the Arduino sketches
  3. I tried moving the device and gateway which are 2 meters apart
  4. I have setup the Arduino properly using 915 mhz.

Can someone please help? Do I need to flash it? I cannot get past this.

Click to see the full logs
Sending: mac save 
Sending: mac set ch status 0 off
Sending: mac set ch status 1 off
Sending: mac set ch status 2 off
Sending: mac set ch status 3 off
Sending: mac set ch status 4 off
Sending: mac set ch status 5 off
Sending: mac set ch status 6 off
Sending: mac set ch status 7 off
Sending: mac set ch status 8 on
Sending: mac set ch drrange 8 0 3
Sending: mac set ch status 9 on
Sending: mac set ch drrange 9 0 3
Sending: mac set ch status 10 on
Sending: mac set ch drrange 10 0 3
Sending: mac set ch status 11 on
Sending: mac set ch drrange 11 0 3
Sending: mac set ch status 12 on
Sending: mac set ch drrange 12 0 3
Sending: mac set ch status 13 on
Sending: mac set ch drrange 13 0 3
Sending: mac set ch status 14 on
Sending: mac set ch drrange 14 0 3
Sending: mac set ch status 15 on
Sending: mac set ch drrange 15 0 3
Sending: mac set ch status 16 off
Sending: mac set ch status 17 off
Sending: mac set ch status 18 off
Sending: mac set ch status 19 off
Sending: mac set ch status 20 off
Sending: mac set ch status 21 off
Sending: mac set ch status 22 off
Sending: mac set ch status 23 off
Sending: mac set ch status 24 off
Sending: mac set ch status 25 off
Sending: mac set ch status 26 off
Sending: mac set ch status 27 off
Sending: mac set ch status 28 off
Sending: mac set ch status 29 off
Sending: mac set ch status 30 off
Sending: mac set ch status 31 off
Sending: mac set ch status 32 off
Sending: mac set ch status 33 off
Sending: mac set ch status 34 off
Sending: mac set ch status 35 off
Sending: mac set ch status 36 off
Sending: mac set ch status 37 off
Sending: mac set ch status 38 off
Sending: mac set ch status 39 off
Sending: mac set ch status 40 off
Sending: mac set ch status 41 off
Sending: mac set ch status 42 off
Sending: mac set ch status 43 off
Sending: mac set ch status 44 off
Sending: mac set ch status 45 off
Sending: mac set ch status 46 off
Sending: mac set ch status 47 off
Sending: mac set ch status 48 off
Sending: mac set ch status 49 off
Sending: mac set ch status 50 off
Sending: mac set ch status 51 off
Sending: mac set ch status 52 off
Sending: mac set ch status 53 off
Sending: mac set ch status 54 off
Sending: mac set ch status 55 off
Sending: mac set ch status 56 off
Sending: mac set ch status 57 off
Sending: mac set ch status 58 off
Sending: mac set ch status 59 off
Sending: mac set ch status 60 off
Sending: mac set ch status 61 off
Sending: mac set ch status 62 off
Sending: mac set ch status 63 off
Sending: mac set ch status 64 off
Sending: mac set ch status 65 on
Sending: mac set ch status 66 off
Sending: mac set ch status 67 off
Sending: mac set ch status 68 off
Sending: mac set ch status 69 off
Sending: mac set ch status 70 off
Sending: mac set ch status 71 off
Sending: mac set pwridx 5
Sending: mac set retx 7
Sending: mac set dr 3
Sending: mac join otaa 
Join not accepted: denied
Check your coverage, keys and backend status.
Sending: mac join otaa 
Join not accepted: denied
Check your coverage, keys and backend status.
Sending: mac join otaa

Sketch

#include <TheThingsNetwork.h>

// Set your AppEUI and AppKey
const char *appEui = "my appeui key";
const char *appKey = "my app key";

#define loraSerial Serial1
#define debugSerial Serial

// Replace REPLACE_ME with TTN_FP_EU868 or TTN_FP_US915
#define freqPlan TTN_FP_US915

TheThingsNetwork ttn(loraSerial, debugSerial, freqPlan);

void setup()
{
  loraSerial.begin(57600);
  debugSerial.begin(9600);

  // Wait a maximum of 10s for Serial Monitor
  while (!debugSerial && millis() < 10000)
    ;

  debugSerial.println("-- STATUS");
  ttn.showStatus();

  debugSerial.println("-- JOIN");
  ttn.join(appEui, appKey);
}

void loop()
{
  debugSerial.println("-- LOOP");

  // Prepare payload of 1 byte to indicate LED status
  byte payload[1];
  payload[0] = (digitalRead(LED_BUILTIN) == HIGH) ? 1 : 0;

  // Send it off
  ttn.sendBytes(payload, sizeof(payload));

  delay(10000);
}
'''

(Lachlan Etherton) #2

I have the same problem which has a similar output. I’ve written up an issue post about this on Github:

Would be interested to hear if this issue can be resolved, because it means that I can’t use the TTN library rather have to using the @jpmeijers RN2483 Arduino Library one instead (you must set the frequency plan to TTN_US)


(Afremont) #3

I don’t know about the Mac, but on Arduino with LMIC, the EUI fields have to be in little endian (lsb) order, meaning the reverse of how they appear in the console. You could try reversing the byte order if your appeui. I’m assuming, since it’s not specified in your code, that the deveui is stored in your device somewhere that the Lorawan software stack can see it. It appears that you have the correct set of channels enabled for the US. I’m not so sure on the datarate.


#4

I would start updating the RN2903 firmware to 1.03


(Jac Kersing) #5

As @Borroz suggestes, first update the firmware. Next when the device is transmitting, check if the ‘data’ tab of your gateway shows any packets. You should see packets with lightning bolts as icons for the OTAA requests.


(Clundy) #6

Ok updated the firmware to 1.0.3 and now the thing is not working properly. When using the send otaa sketch i receive the following data.

– STATUS
EUI: ⸮
Battery: ⸮
AppEUI: )
DevEUI: )
Data Rate: )
RX Delay 1: i
RX Delay 2: )
– JOIN
Model: )
Version: Sending: mac set deveui f
Response is not OK: )
Sending: mac set adr off
Response is not OK: ⸮

Any ideas? I can run the Blink Sketch and it works. I can run many others as well.


#7

can you start with

  • how did you update your firmware
  • what version and from where

(Clundy) #8

I updated my version from Microchip. I used their LoRaSuite LoRaDevUtility.jar. I will try that again.


(Clundy) #9

Same deal here.

EUI: )
Battery: ⸮
AppEUI: ⸮
DevEUI: )
Data Rate: )
RX Delay 1: )
RX Delay 2: ⸮

Use the EUI to register the device for OTAA
-------------------------------------------

Device Information

EUI: ⸮
Battery: ⸮
AppEUI: ⸮
DevEUI: ⸮
Data Rate: ⸮

And it takes up to 30 seconds per line. Maybe longer.


#10

It seems that your update went wrong then.
you must retry that and choose the right file (use a low flash speed also)


(Clundy) #11

Thank you for your assistance. Can you please point me to the right file? That way I can use what you are using.


#12

I have to search because its a long time ago I did this myself…I remember I wrote about it in some topic… have to find it first :slight_smile:


(Clundy) #13

Here is where I downloaded the files.

https://www.microchip.com/wwwproducts/en/RN2903


#14

filern

and selected the bootloader, just try it again, take some screenshots from the utility during the process for reference


(Clundy) #15

Ok got the flast to work properly this time. I had to start the LoRaDevUtility jar and then had to load the bootloader in that app. That reset the ports so the utility could see the device. Once I did that I was able to load the RN2903_Parser.production.unified.hex to the utility and as you mentioned, I set the baud to 9600 and it loaded successfully. You can see the screenshots.

After deleting the app and recreating it i still get the same message, join not accepted: denied, check your coverage, keys and backend status.

I have the gateway about 10 feet from the device. I see it is working and can see it connected.

46%20AM 30%20AM 13%20AM 52%20AM 48%20AM


#16

hmmm … :roll_eyes:

1 - please show output of this code


(Clundy) #17
Device Information

EUI: 0004A30B001C5D10
Battery: 3294
AppEUI: 70B3D57ED00176DE
DevEUI: 0004A30B001C5D10
Data Rate: 3
RX Delay 1: 1000
RX Delay 2: 2000

Use the EUI to register the device for OTAA
-------------------------------------------

Here is my sketch for OTAA

#include <TheThingsNetwork.h>

// Set your AppEUI and AppKey
const char *appEui = "70B3D57ED00176DE";
const char *appKey = "BD9EE4B9158334AB599534955D3FDF6E";

#define loraSerial Serial1
#define debugSerial Serial

// Replace REPLACE_ME with TTN_FP_EU868 or TTN_FP_US915
#define freqPlan TTN_FP_US915

TheThingsNetwork ttn(loraSerial, debugSerial, freqPlan);

void setup()
{
  loraSerial.begin(57600);
  debugSerial.begin(9600);

  // Wait a maximum of 10s for Serial Monitor
  while (!debugSerial && millis() < 10000)
    ;

  debugSerial.println("-- STATUS");
  ttn.showStatus();

  debugSerial.println("-- JOIN");
  ttn.join(appEui, appKey);
}

void loop()
{
  debugSerial.println("-- LOOP");

  // Prepare payload of 1 byte to indicate LED status
  byte payload[1];
  payload[0] = (digitalRead(LED_BUILTIN) == HIGH) ? 1 : 0;

  // Send it off
  ttn.sendBytes(payload, sizeof(payload));

  delay(10000);
}

Also, I have The Things Gateway Backer Edition

15%20PM


(Afremont) #18

Passing strings in for your appeui and appkey looks a little odd to me. I think they need to be binary. If this is an Arduino, the appeui needs to be lsb order, I believe.


(Arjan) #19

The code that is shown is using the TTN Arduino library. That library indeed expects MSB string values, so that part looks fine.

@clundy it’s not clear to me if you see anything related to the OTAA Join Request (orange icon) and maybe the Join Accept (green icon) in the device’s Data page and the gateway’s Traffic page in TTN Console?


(Afremont) #20

Thanks, I didn’t realize how the things uno was constructed. I made the assumption (I know) that it was LMIC based. I see now that it uses regular strings in msb order for configuration.