CubeCell Programming TTN DevEui AppEui u. AppKey direct in program possible?

First it is possible to do the programming by AT-commands, but to save more power, it is advantageous to disable AT-commands.

So you must change the TTN-OTTA-Information in the commissioning.h file.

Is there a solution like this, in the program, possible?

static const u1_t PROGMEM APPEUI[8]={ 0xA2, 0xCB, 0x00, 0xC0, 0x7E, 0xD5, 0xB3, 0x70 };
void os_getArtEui (u1_t* buf) { memcpy_P(buf, APPEUI, 8);}

static const u1_t PROGMEM DEVEUI[8]={ 0x6C, 0x11, 0x11, 0xDA, 0xFD, 0xBD, 0x99, 0x00 };
void os_getDevEui (u1_t* buf) { memcpy_P(buf, DEVEUI, 8);}

static const u1_t PROGMEM APPKEY[16] = { 0xAE, 0xAF, 0x7A, 0x3B, 0xB4, 0x35, 0xC5, 0x89, 0xF7, 0x8A, 0x30, 0x13, 0xC4, 0x00, 0xAB, 0xCB };
void os_getDevKey (u1_t* buf) { memcpy_P(buf, APPKEY, 16);}

1 Like

Yes it is, since changing commissioning.h isn’t great when you have >1 device.

The variables that hold the Euis etc are accessible if you extern them, and then it’s a simple memcpy to overwrite the existing values from Commissioning.h.

For OTAA, here’s a code snippet with Euis changed to protect…me. ABP is similarly possible, just check LoRaWan_APP.cpp for the variable names.

const char myDevEui[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
const char myAppEui[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
const char myAppKey[] = { 0x72, 0x00, 0x84, 0x5D, 0xC8, 0x7E, 0x57, 0x59, 0x63, 0x1B, 0xFB, 0x64, 0xFC, 0x77, 0x00, 0xC9 };

extern uint8_t DevEui[];
extern uint8_t AppEui[];
extern uint8_t AppKey[];

void setup() {
    memcpy(DevEui, myDevEui, sizeof(myDevEui)); //Add these 3 lines to setup func
    memcpy(AppEui, myAppEui, sizeof(myAppEui));
    memcpy(AppKey, myAppKey, sizeof(myAppKey));
    DeviceState = DEVICE_STATE_INIT;

Enjoy, this is a cool board.

1 Like

thank for your code.
that makes my life easier

Hi thanks for the tip useful.I found the pre-config of commissioning.h god with the constant reload of code for a test node. Great device just looking at 433mhz one at mo to be used for reception if fossa sat1 Lora transmission from space,due to launch 25/11/19. Simon

1 Like