MIC erorr in chirpstack

I use the RAK7248C to have a gateway
And also ARDUINO to make end device with arduino and otaa code :
I enter correctly the :
APPEUI
DEVEUI
APPKEY
But when send the join request to chirpstack I have this error on chirpstack :
“join-server returned error: response error, code: MICFailed, description: invalid mic”

I realize you say you entered the keys correctly but this error is typically because the keys are wrong. Maybe just triple check them?

Also the appEUI is only relevant in Chipstack if you have an external join server (which is not the default), it can be any value and the join should work.

thank you for your respond
Yes I enter every key correctly :

this is the code in Arduino :
static const u1_t PROGMEM APPEUI[8]={ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
void os_getArtEui (u1_t* buf) { memcpy_P(buf, APPEUI, 8);}

// This should also be in little endian format, see above.
static const u1_t PROGMEM DEVEUI[8]={ 0xa7, 0x27, 0x71, 0x42, 0x7a, 0xe7, 0x30, 0x30 };
void os_getDevEui (u1_t* buf) { memcpy_P(buf, DEVEUI, 8);}

// This key should be in big endian format (or, since it is not really a
// number but a block of memory, endianness does not really apply). In
// practice, a key taken from ttnctl can be copied as-is.
static const u1_t PROGMEM APPKEY[16] = { 0x1c, 0x8b, 0x1f, 0xa9, 0x1e, 0xaf, 0xc7, 0x61, 0xd8, 0x0a, 0x8a, 0x25, 0x76, 0x51, 0xda, 0x16 };
void os_getDevKey (u1_t* buf) { memcpy_P(buf, APPKEY, 16);}

static uint8_t mydata = “Hello, world!”;
static osjob_t sendjob;

// Schedule TX every this many seconds (might become longer due to duty
// cycle limitations).
const unsigned TX_INTERVAL = 10;

// Pin mapping
const lmic_pinmap lmic_pins = {
.nss = 10,
.rxtx = LMIC_UNUSED_PIN,
.rst = 9,
.dio = {2, 6, 7},
};

And also this is the data in chirpstack :

application key :
16 da 51 76 25 8a 0a d8 61 c7 af 1e a9 1f 8b 1c
Device EUI : 3030e77a427127a7
Gateway ID : d83addfffe7c8043

Your appkey is backwards. Since it uses big-endian it will be the same value as in Chirpstack, right now it is reversed in little-endian fashion.

Why the code would have the devEUI little endian and the appKey big endian is beyond me.

That is why you check out RadioLib (although it doesn’t fit in the flash space of a usual Arduino) :wink:

1 Like

Thank you for your response.
Do you mean I cannot use Arduino to create nodes?

Thank you for your response

You can if you try very hard to use LMIC, but it’s generally a pain (you found one of the reasons) and costs time and frustration. If you are able to use something other than an Arduino (such as an ESP32), your life is much easier.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.