LoRaONE device EUI

I’ve just bought some LoRaONEs. To get ABP parameters (device address, network session key, and application session key) from our network server, I need to enroll the device using it’s Device EUI. Where can I get that from? Thanks

With ABP you don’t use the hardware DevEUI, you use parameters like below - devAddr has too be unique for the network you are subscribing to.

const uint8_t devAddr[4] =  { 0x02, 0x03, 0x04, 0x05 };
const uint8_t appSKey[16] = { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C };
const uint8_t nwkSKey[16] = { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C };

LoRaBee.initABP(loraSerial, devAddr, appSKey, nwkSKey, false);

However to get DevUI you write “sys get hweui” to the RN2483, it will respond with the device unique id

Thanks. How do I communicate with the RN2483 module on LoRaONE? I’m familiar with the sys and mac commands. A standard serial terminal after plugging in the USB doesn’t seem to work.

Besides dev EUI, I also need to configure the channels on the RN2483 which I can do if I can communicate with it using the mac ch commands.

A standard serial terminal after plugging in the USB doesn’t seem to work.

What do you mean, connecting to the USB of the LoraOne ? - This will not work it is NOT connected as pass-thru you have to write some code to make that work (see below)

void setup() {
// put your setup code here, to run once:
Serial1.begin(57600);
SerialUSB.begin(57600);
}

void loop() {
// put your main code here, to run repeatedly:
if (Serial1.available) { // See if RN2483 has output for us
SerialUSB.write(Serial1.read()); // Write it to the USB port

}
if (SerialUSB.available) { // See if data available on the USB port
Serial1.write(SerialUSB.read()); // Write it to the Serial1 port (RN2483)
}

}

When you write to the RN2483 make sure it is terminated with CR-LF or the RN2483 will not start processing the data received.

I have the Autonomo LoRaWan Dev. Kit and it works as a personalized device with the new TTN settings, also downlink messages work.
Now i want it to OTAA on TTN but i need the hweui.
I found that u have to request it to the RN2483, but i run into problems (possible reason == noob)

The code above gives me a error, i tryed this one, hope it does the same:

void setup()
{
Serial.begin(115200);
Serial1.begin(115200);
}

void loop()
{
if (Serial.available()) Serial1.write(Serial.read());
if (Serial1.available()) Serial.write(Serial1.read());
}

This gives no errors, tryed Putty on the port of my Autonomo but nothing happend.
Can u please explain how to get the hweui for OTAA on TTN.

Thanks,

Have you correctly selected the Autonomo as the board to compile for?

A serial pass through sketch for the Autonomo between your computer and the RN2483 should use SerialUSB and Serial1. If SerialUSB is causing the error, then you do not have the correct board selected (see Tools->Board in the menu).

Serial1 should be opened at 57600, and also make sure to terminate your commands with CR-LF.

Add below to your sketch, it will output some variables including the hweui

const char *diag[] = {"sys get ver","sys get hweui","sys get vdd",NULL};
char buffer[128];

void send(const char *s,bool wait = true) {
    //
    Serial1.println(s);
    //
    if (wait) {
        SerialUSB.print(s);
        SerialUSB.write(" ");
    }
    else
        SerialUSB.println(s);
    if (wait) {
        *buffer = 0;
        int i = Serial1.readBytesUntil('\n', buffer,sizeof(buffer));
        if (i) buffer[i-1] = 0;
               SerialUSB.println((char *) buffer);
    }
}

void setup () {
    pinMode(BEE_VCC, OUTPUT);
    digitalWrite(BEE_VCC, HIGH);
     // LED_BUILTIN
     pinMode(LED_BUILTIN, OUTPUT);
     digitalWrite(LED_BUILTIN, HIGH);
     //
     //Wait for SerialUSB or 10 seconds
     while ((!SerialUSB) && (millis() < 10000)) ;
     //
    Serial1.begin(57600);
    for (int x = 0; diag[x] != NULL; x++)
        send(diag[x]);
}

I get a error on the line: *buffer = 0;
‘buffer’ was not declared in this scope

Would be sweet if some sketch was as a example available from Sodaq to do this, would at least make my day allot easier :smiley:
Mainly the problem is also that i don’t know anything about Arduino and programming, so far copy and pasting and changing some code did the job :blush:

Added one line to declare buffer, check above …

That solved the problem, but then i got another.
That was easy to solve, i added:

void loop() {
// put your main code here, to run repeatedly:
}

const char *diag[] = {“sys get ver”,“sys get hweui”,“sys get vdd”,NULL};
char buffer[128];

void send(const char *s,bool wait = true) {
//
Serial1.println(s);
//
if (wait) {
SerialUSB.print(s);
SerialUSB.write(" ");
}
else
SerialUSB.println(s);
if (wait) {
*buffer = 0;
int i = Serial1.readBytesUntil(’\n’, buffer,sizeof(buffer));
if (i) buffer[i-1] = 0;
SerialUSB.println((char *) buffer);
}
}

void setup () {
for (int x = 0; diag[x] != NULL; x++)
send(diag[x]);
}

void loop() {
// put your main code here, to run repeatedly:
}

Now the Sketch is OK, and uploaded to the Autonomo board.

I open the monitor and try to send something but i get no reply or data.
What should i send to trigger it to give back the hweui?

Hi Pietje,

This was not meant as a ready to go example, just some lines you could add to an existing sketch. Add a few more lines to setup() (see above to enable the RN2483 and to turn on the onboard led

Here are some examples for the Autonomo

1 Like

@w4e Thanks allot, this did the job.

const char *diag[] = {“sys get ver”,“sys get hweui”,“sys get vdd”,NULL};
char buffer[128];

void send(const char *s,bool wait = true) {
//
Serial1.println(s);
//
if (wait) {
SerialUSB.print(s);
SerialUSB.write(" ");
}
else
SerialUSB.println(s);
if (wait) {
*buffer = 0;
int i = Serial1.readBytesUntil(’\n’, buffer,sizeof(buffer));
if (i) buffer[i-1] = 0;
SerialUSB.println((char *) buffer);
}
}

void setup () {
pinMode(BEE_VCC, OUTPUT);
digitalWrite(BEE_VCC, HIGH);
// LED_BUILTIN
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);
//
//Wait for SerialUSB or 10 seconds
while ((!SerialUSB) && (millis() < 10000)) ;
//
Serial1.begin(57600);
for (int x = 0; diag[x] != NULL; x++)
send(diag[x]);
}

void loop() {
// put your main code here, to run repeatedly:
}

1 Like

Hi,

I’m trying to get EUI of my LoRa One card and I’m using your code but the result is empty. Not possible to receive any information. Do you have an idea why I have this problem ? Or how I can get my EUI ?

Thanks a lot in advance for your help.

Regards,

Bernard

We have two SodaqOne boards.
How can that happen that both have the same HWEUI at startup??

Q1
Is the HW EUI the same as the DEV EUI?

Q2
With the SODAQ module , can we get access to the RN2903 commands directly.

See the screenshots from the SODAQs

Second Sodaq board: