LoRaWAN version for TTN

Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Locked
User avatar
toddbu
 
Posts: 7
Joined: Mon Jun 04, 2018 11:59 pm

LoRaWAN version for TTN

Post by toddbu »

I've registered my RFM9x LoRaWAN module that I bought from AdaFruit (https://www.adafruit.com/product/3072) with The Things Network (TTN) and have managed to get it to show up in the TTN console. Since I couldn't find this module in the LoRaWAN Device Repository, I had to set it up manually. One piece of data that I needed to enter was the LoRaWAN version. I searched through Google for a couple of hours with no success. The chipset on the device shows HopeRF RFM95C and I found a spec sheet for RFM95CW, but I didn't see anything about the LoRaWAN version. So I picked version 1.0.2 thinking that it would probably be backwards compatible. Anyway, the device seems to work ok but I'm losing data packets. Sometimes it's just a few, and other times it won't send any data at all. I see the join messages in the console most but not all of the time. I also see some uplink and downlink messages. I'm using code that I found at https://github.com/ArmDeveloperEcosyste ... y-for-pico that's built in C on the pico-sdk and the SemTech lorawan.c libraries. I had read somewhere that getting the LoRaWAN specification wrong in the TTN setup can cause strange problems to occur. And since there's no way in TTN to edit an existing device then receating the device using trial-and-error is not a good option. Finally, I'm using the Things Network Internet Gateway (https://www.adafruit.com/product/4345) that I also purchased from Adafruit as my gateway, just in case that might make a different. How do you suggest we find the supported LoRaWAN versions for this chipset?

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: LoRaWAN version for TTN

Post by adafruit_support_mike »

LoRaWAN is handled entirely in software, so check the SemTech lorawan.c library to see if it mentions a version.

User avatar
jerryn
 
Posts: 1865
Joined: Sat Sep 14, 2013 9:05 am

Re: LoRaWAN version for TTN

Post by jerryn »

FWIW I am seeing the same thing with that library. Sometimes I seem to miss packets. Other times it works OK. I have not come up with a solution. I also set it up with 1.0.2 and from the documentation I have read, 1.0.3 and 1.0.2 should be the same. I suppose it is worth trying creating a new end device with 1.0.3.

I have gotten better results with the Arduino LMIC Library.
https://github.com/mcci-catena/arduino-lmic

User avatar
jerryn
 
Posts: 1865
Joined: Sat Sep 14, 2013 9:05 am

Re: LoRaWAN version for TTN

Post by jerryn »

Interesting -- switching to 1.0.3 seems to have helped. It is not missing packets now.
I just deleted the old device and created a new with
Version -LoRaWAN Specification 1.0.3
Regional Parameters - RP001 Regional Parameters 1.0.3 revision A


Also, I initially tried generating a new AppKey and it would not work - constant "MIC mismatches"
so I went back to the original AppKey I had been using for the version 1.0.2 case and now it is working well.

I am using the otaa_temperature_led demo and both uplink and downlink are working reliably with 1.0.3.

Your mileage may vary -- good luck ;-)
Last edited by jerryn on Tue Feb 21, 2023 7:50 am, edited 2 times in total.

User avatar
jerryn
 
Posts: 1865
Joined: Sat Sep 14, 2013 9:05 am

Re: LoRaWAN version for TTN

Post by jerryn »

I still don't understand why this works and 1.0.2 was not working....
From what I have read the changes from 1.02 to 1.0.3 should not have impacted this type of device.
It is using Class A
from https://lora-alliance.org/resource_hub/ ... on-v1-0-3/
The LoRaWAN1.0.3 now fully supports unicast & multicast classB devices.
The classA and classC sections are unchanged compared to LoRaWAN1.0.2 with the exception of a new MAC command “DeviceTimeRequest” used to synchronize the real time clock of a device.
For devices operating in classA or classC, there is no need to upgrade to LoRaWAN1.0.3
However, If you plan to use classB in your devices then you should use LW1.0.3
The LoRaWAN1.0.3 ClassB section is forward compatible with the LoRaWAN1.1 classB.
so - I'm glad it is working, but I can't claim to understand why....

User avatar
jerryn
 
Posts: 1865
Joined: Sat Sep 14, 2013 9:05 am

Re: LoRaWAN version for TTN

Post by jerryn »

another followup -- regarding changing the appkey.
For some reason that I still don't understand, deleting the device and trying to create a new one with a different appkey did not work. I had to use the same appkey as when I originally set up the board. This still puzzles me.

However, I did confirm that if I use a new MCU board -- with a different DEVEUI then I can create a new device with a new appkey.

I suspect there is something going on deep in the demo code that is not updating the appkey but I am relived to see that I can in fact create a new working device!

Since moving to 1.0.3 I have not missed any packets that I have noticed.

I hope all this is of some help. It has been a good exercise for me!

User avatar
toddbu
 
Posts: 7
Joined: Mon Jun 04, 2018 11:59 pm

Re: LoRaWAN version for TTN

Post by toddbu »

Thank you so much, Jerry! Interestingly enough, I tried version 1.1.0 with no success and 1.0.4 worked but had a hard time joining because of a too small DevNonce. (It eventually did connect after multiple retries.) I'll give 1.0.3 a try and maybe look at that Arduino library as well. I'll also check my library to see if it will tell me the version.

Thanks again for digging into this problem with me.

User avatar
toddbu
 
Posts: 7
Joined: Mon Jun 04, 2018 11:59 pm

Re: LoRaWAN version for TTN

Post by toddbu »

Version 1.0.3 seems to have fixed a number of my problems with losing packets. I still had one join request fail and the code that I got didn't handle that failure case at all, so I beefed up the logic a little bit. At this point I can reliably power down my Pico and turn it back on and have my join request go through, so I am a happy camper. To handle any uplinks that may still fail, I plan to layer my own retry logic on top of the uplink as I plan to only send each event once rather than periodically transmitting. This should help with battery life.

Thanks again for your help, @jerryn. And also to @adafruit_support_mike for pointing me in the right direction on where to find the LoRaWAN version.

User avatar
jerryn
 
Posts: 1865
Joined: Sat Sep 14, 2013 9:05 am

Re: LoRaWAN version for TTN

Post by jerryn »

@toddbu
I'm really glad you raised this question when you did. I had done some testing quite awhile ago with this library and had shelved the project until a few days ago when I tried it again and saw the same issues you raised. At that point I set it aside thinking "I should look into this". Your post prompted me to try it again and push a bit further.
I would like to get much more comfortable with setting up applications and end devices on TTN. This has been a big step.
I plan to move back to using the LMIC library via Arduino since it has broad support for sensor libraries and boards. Time to dust off some old projects!

User avatar
toddbu
 
Posts: 7
Joined: Mon Jun 04, 2018 11:59 pm

Re: LoRaWAN version for TTN

Post by toddbu »

@jerryn

Thanks for the update on your projects. Like you, I had shelved my project but for a bit longer. I live about 1/2 mile away from my mailbox and so, like many others, I decided to build a notifier for when postal mail arrives. The project might have stayed on the shelf indefinitely but I just got a new job building IoT devices at large scale that are built on top of LoRaWAN (tens of thousands of devices). I was so excited about the project during the interview that I just about begged my new boss if I could work for him. :-) As a software developer for 35+ years and an Extra class ham radio operator (WK7L), the alignment of my skills and interests with LoRaWAN is very high. I love anything having to do with extremely low power digital radio transmissions. Anyway, I had mentioned my mailbox project during my interview and decided that I couldn't show up for my first day of work without having made at least some progress on it. With your help I seem to have stabilized things quite a bit so again I really appreciate your help!

User avatar
jerryn
 
Posts: 1865
Joined: Sat Sep 14, 2013 9:05 am

Re: LoRaWAN version for TTN

Post by jerryn »

I'm glad if I was of some help! That sounds like a great project. I helped with a mailbox notifier last year but we just used point to point LoRa to send a message to a Raspberry Pi that could then relay the information as desired. We did not use LoRaWAN.
I am happily retired (also former software developer but all for embedded systems (instrument controllers for scientific satellites - no IOT)). Now I just tinker with way too many toys but am enjoying it.

Good luck with your project and with your new job!

Locked
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.

Return to “Internet of Things: Adafruit IO and Wippersnapper”