Hello all,
I’m trying to get my lorawan packets working with a SparkFun SAMD21 Pro RF device.
I keep getting the MIC Mismatch error and can’t seem to get past that.
I’m using an TTN Indoor gateway using the US 915 frequency band.
I was following Sparkfun’s hookup guide here (admittedly it’s pretty outdated)
https://learn.sparkfun.com/tutorials/sparkfun-samd21-pro-rf-hookup-guide/all#hardware-overview
I started with the lmic library that was mentioned there and got this error.
If I try to use the ttn-otaa example, (keeping in mind the endianness of the keys, and lifting the keys from the gui while the correct toggle is set msb/lsb), I get MIC mismatch.
I’ve also tried to make the code change which does something with the timing to get it working, and it hasn’t worked for me.
The gateway is receiving the packet and is ‘trying to’ forward it to my app, but it seems to fail the test of the mic checksum so I’m not able to receive the message in my app and decode it and do something useful with it.
I’m able to get this working (i.e. messages getting received by the app without the mic mismatch) if I use the other example ttn-abp and supply all the keys. But it quickly stops working if the device has to be restarted and the frame counters go out of sync between the server and the device (which starts at zero after the reboot)
I know I’m not running out of memory on my samd21 processor because when I compile my sketch on the Arduino IDE, my sketches memory footprint never goes beyond 15-18%, in general.
I’ve since tried other lorawan libraries and have had no luck. I’ve tried MCCI_LoRaWAN_LMIC_library, and also Beelan_LoRaWAN library, installed directly from the IDE.
I’m also keeping the version of LoRaWAN at 1.0.3 when I setup my end device.
The message coming through the gateway looks like this:
{
"name": "gs.up.receive",
"time": "2023-09-02T17:54:20.223951078Z",
"identifiers": [
{
"gateway_ids": {
"gateway_id": "eui-58a0cbfffe803eed",
"eui": "58A0CBFFFE803EED"
}
}
],
"data": {
"@type": "type.googleapis.com/ttn.lorawan.v3.GatewayUplinkMessage",
"message": {
"raw_payload": "AAAAAAAAAAAA6wkG0H7Vs3AIe2tU05g=",
"payload": {
"m_hdr": {},
"mic": "a1TTmA==",
"join_request_payload": {
"join_eui": "0000000000000000",
"dev_eui": "70B3D57ED00609EB",
"dev_nonce": "7B08"
}
},
"settings": {
"data_rate": {
"lora": {
"bandwidth": 125000,
"spreading_factor": 9,
"coding_rate": "4/5"
}
},
"frequency": "903900000",
"timestamp": 3210588796,
"time": "2023-09-02T17:54:20.159689903Z"
},
"rx_metadata": [
{
"gateway_ids": {
"gateway_id": "eui-58a0cbfffe803eed",
"eui": "58A0CBFFFE803EED"
},
"time": "2023-09-02T17:54:20.159689903Z",
"timestamp": 3210588796,
"rssi": -85,
"channel_rssi": -85,
"snr": 13,
"uplink_token": "CiIKIAoUZXVpLTU4YTBjYmZmZmU4MDNlZWQSCFigy//+gD7tEPzk9voLGgsIzO3NpwYQsbXUaiDg6ISwuLMO",
"received_at": "2023-09-02T17:54:20.049262536Z"
}
],
"received_at": "2023-09-02T17:54:20.223681201Z",
"correlation_ids": [
"gs:conn:01H99M32GWBM7RA6B8QY1YGVQS",
"gs:uplink:01H9BGG3DZSGT5Q249Z1H1GNCN"
]
},
"band_id": "US_902_928"
},
"correlation_ids": [
"gs:conn:01H99M32GWBM7RA6B8QY1YGVQS",
"gs:uplink:01H9BGG3DZSGT5Q249Z1H1GNCN"
],
"origin": "ip-10-101-5-145.us-west-1.compute.internal",
"context": {
"tenant-id": "CgN0dG4="
},
"visibility": {
"rights": [
"RIGHT_GATEWAY_TRAFFIC_READ"
]
},
"unique_id": "01H9BGG3DZGK09GWNSA72XFHCV"
}
Inside my app, the mic mismatch says this:
{
"name": "ns.up.join.cluster.fail",
"time": "2023-09-03T17:32:57.410469072Z",
"identifiers": [
{
"device_ids": {
"device_id": "eui-70b3d57ed00609eb",
"application_ids": {
"application_id": "my-new-sparkfun-application"
},
"dev_eui": "70B3D57ED00609EB",
"join_eui": "0000000000000000"
}
}
],
"data": {
"@type": "type.googleapis.com/ttn.lorawan.v3.ErrorDetails",
"namespace": "pkg/joinserver",
"name": "mic_mismatch",
"message_format": "MIC mismatch",
"correlation_id": "f2a82591ce5c4fecad4e02f4d1fb5330",
"code": 3
},
"correlation_ids": [
"gs:conn:01H9C6FW7G67AN3JTZ3Z4WWC6G",
"gs:up:host:01H9C6FWBTWZ8CNXQDXW6WV56K",
"gs:uplink:01H9E1NNNQ672SJD4KB8930W3C",
"ns:uplink:01H9E1NNNR2XATSAK6KMH906ZS",
"rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01H9E1NNNRRSVP8VYPRZ32TM3B"
],
"origin": "ip-10-101-15-68.us-west-1.compute.internal",
"context": {
"tenant-id": "CgN0dG4="
},
"visibility": {
"rights": [
"RIGHT_APPLICATION_TRAFFIC_READ"
]
},
"unique_id": "01H9E1NNP22WQ0DBVQ11FYARQA"
}
Sorry for unloading a ton of information about all the stuff I’ve already tried.
I’m a lorawan noob and have tried to comb through all of the previous threads to see if I can find something that’s applicable, and nothing has worked.
Any help you can provide will be much appreciated.