RAKWireless / WisBlock

Quickstart, tutorials and examples for the RAKwireless WisBlock product line.
https://www.rakwireless.com
MIT License
156 stars 117 forks source link

Rak11300 - OTAA join failed! #51

Closed Famosi closed 2 years ago

Famosi commented 2 years ago

I'm trying to run the LoRaWAN_OTAA_ABP example for the Rak11300 core.

I'm getting the following error:

12:32:48.121 -> =====================================
12:32:48.121 -> Welcome to RAK11300 LoRaWan!!!
12:32:48.121 -> Type: OTAA
12:32:48.121 -> Region: EU868
12:32:48.121 -> =====================================
12:33:16.042 -> OTAA join failed!
12:33:16.042 -> Check your EUI's and Keys's!
12:33:16.042 -> Check if a Gateway is in range!

Check your EUI's and Keys's!: EUI and Keys are correct. Check if a Gateway is in range!: The Gateway is 1meter from the device.

I've registred the device on the helium console and I receive 3 Join Request replied with 3 Join Accept. Here is a screenshot: https://imgur.com/gallery/PExIFE6.

Note: I've also tried the example LoRaWAN_OTAA_ABP example for the Rak4631 core. In this case I have no problem. Everything works fine and I receive packets succesfully.

If you need more info let me know.

beegee-tokyo commented 2 years ago

I updated the LoRaWAN examples for RAK11310 two days ago. https://github.com/RAKWireless/WisBlock/tree/master/examples/RAK11300/communications/LoRa/LoRaWAN/LoRaWAN_OTAA_ABP

Do you use the changed example?

There was as well a bug in the SX126x-Arduino library. ==> https://github.com/beegee-tokyo/SX126x-Arduino/releases

Please update to latest version 2.0.11

Famosi commented 2 years ago

I was using an old version of the example. Now the device join succesfully :)

However, it should sends a frame every 20s but do not send it! It prints:

=====================================
14:30:26.425 -> Welcome to RAK11300 LoRaWan!!!
14:30:26.425 -> Type: OTAA
14:30:26.425 -> Region: EU868
14:30:26.425 -> =====================================
14:30:40.919 -> OTAA Mode, Network Joined!
14:31:01.883 -> Sending frame now...

but, if adding a cout at line 281 after this, it doesn't print anything.

Famosi commented 2 years ago

I needed to make little changes to your code. In particular to the tx_lora_periodic_handler function.

Here is my working version:

void tx_lora_periodic_handler(void)
{
  send_now = true;
  appTimer.attach(tx_lora_periodic_handler, (std::chrono::microseconds)(LORAWAN_APP_INTERVAL * 1000));
}

Does it makes sense to you?

beegee-tokyo commented 2 years ago

That is one of the problems with the RP2040 BSP. It needs sometimes such workarounds because it is based on mbed.

Glad you could solve it.