Unable to join network: Rx 2 timeout

Hey,

I got some sx1276 modules and I’m trying to make them connect to TTN with a RP2040 using this library, lorawan-for-pico which is a porting of LoRaMAC-node for the Raspberry Pi Pico.

When I use the example code for OTAA activation, I get the following repeated logs from the serial output:

###### =========== MLME-Confirm ============ ######
STATUS      : Rx 2 timeout

###### =========== MLME-Request ============ ######
######               MLME_JOIN               ######
###### ===================================== ######
STATUS      : OK

So I take it, that the node keeps trying to send a join request, but never gets a response from the gateway?
Looking at the gateway logs and the node logs I can see the join requests show up:


image

The messages in the node console are due to “MIC mismatch”

The node and the gateway are about 30 meters away from each uther (with walls in between) so distance shouldn’t be an issue.

I have also double checked and triple checked the devEUI, joinEUI, and app key.

If anyone could help with this, that would be greatly appreciated, thanks.

Search the forum / internet for MIC mismatch and then you will know all about the AppKey and making it match!

Hi, I have searched the forum extensively, but with no success. I have tried generating a new app key and even creating a whole new end device in the console, but I still get the same issue. I also tried in both little endian and big endian formats (not just for the app key, but also the joineui and deveui in different combinations).

When trying to decode the payload from the gateway in the lora packet decoder, it tells me that the MIC is invalid, but that’s not really news to me.

OK, which version of LW are you setting in the console?

Version 1.1 with RP001 Regional Parameters 1.1 revision B.

I have tried the older versions too - down to 1.0.4.

v1.0.4 is the version down from v1.1 with nothing in between - regional parameters are various settings, not changes in the protocol.

LMn is v1.0.3 unless you explicitly set it for v1.0.4.

Your honour, I object :judge:

We can discuss it over supper, but the pertinent issue for the defence is that LMn ain’t no v1.1!

3 Likes

Thanks for the help, I have tried setting the lorawan version in the console to v1.0.3 but with no success. I just get the same problem.

Is there any way you can check the radio modules with something like Sandeep’s LoRa code base to check that they are working OK on receive?

Or as you are using SX1276’s try LMIC?

I tried LMIC with a new SX1276 module but no dice. Nothing shows in console or gateway logs and the following is outputted in the serial monitor:

Starting
Packet queued
1855: EV_JOINING
2134: EV_TXSTART

Does this mean that no JR was received by the gateway?

May seem an obvious question, but do you have an antenna on the device?

I’m not as familiar with LMIC but yes I believe so.

Yes, I have a 8-12dB antenna connected . In the console logs, I see uplink messages every few hours from other people’s devices in the area. I’ll try with the little swivel antenna that came with the gateway though, just to make sure.

LMIC doesn’t change the gateway log …

I’m not an antenna expert, but such a huge gain is probably part of the issue. Likely overloading the RF input. Try 8cm of wire!

I tested with the small antenna but still no luck. I also drove to another gateway in my area that I saw come up on the map recently, but I couldn’t connect through that one either.

Not clear if this means more MIC mismatches or some other failure mode, if you could clarify then I may be able to find some other people with other perspectives on this.

I get MIC mismatch messages in the console and the same Rx 2 timeout messages as before from serial output.

The MIC mismatch means the payload wasn’t able to be verified so no Join Accept is issued so nothing for the device to hear as a request.

Talking to my colleague about this I remembered that in LMn there are effectively two keys, both in the same place, AppKey and NwkKey, you need to make both of them the same for LW v1.0.x. I never got in to the why and my provisioning isn’t hard coded anymore so it was a distant memory.

PS: That honking great antenna is still off-limits - may well exceed permissible transmission power as well as skewing the reception & overpowering the RFM

It looks like in Sandeep’s porting of LMn, both the APP_KEY and NWK_KEY are already passed LoRaMacMibSetRequestConfirm(), which seems to eventually set the secure element keys defined in the file you linked.

As for the antenna, I’ll be sure to use the little one for now while I develop my devices and check up on regulations :sweat_smile:. I bought it because I my goal is to work with local winemakers to create soil/weather monitoring systems for vineyards for my year 12 project. There is not much TTN coverage in my area and these vineyards span quite a long distance.

? for a gateway