OSTICKS and Timing question #661
Replies: 3 comments 1 reply
-
I use the Adafruit Feather M0 LoRa board, which is a SAMD21G18 with an RFM95W.
However, there are some funny problems with the normal BSPs, having to do with interrupt enable and disable. Since MCCI uses the SAMD21G18, you can probably download our BSP, select the "Catena 4420" variant, and build. If that fixes your timing problem, we may have found the problem. The other thing to cosider is what you're doing in your app. The LMIC runs sort of in the background while your app is running. Since there's no multi-tasking on the Arduino, you have to give it some CPU time periodically by calling There's also the possibility of clock error. Not likely on a SAMD21, but I see that on the Murata module when running at 2MHz - the clock just drifts badly with temperature changes, and if things end up slow, you'll miss the window. There's an API for dealing with this; what it means in practice is that the LMIC will open the receive window much earlier. Arguably, we should have an option that causes the LMIC to open the receive window right away after an uplink, and keep it open continually until it concludes that a downlink isn't coming. Many use cases of the LMIC are not battery powered; the current design is really a system power optimization. In practice, the power from having the rx window open is so much less than the TX power that this would have a second-order impact on battery life. But that's not how it works now! |
Beta Was this translation helpful? Give feedback.
-
Hi Terry, thank you very much for your prompt reply and explanations. I do very much appreciate it! So for the Could there be a problem with how my
and my micros() method looks like this:
The methods are derived from the default arduino ones and slightly changed to fit into my architecture. I do believe, I tested these methods well, but maybe there is a flaw here. Is there any more documentation about what LMIC expects from the Regarding the Catena BSP, that is not really an option, since I am using the Atmel studio and the BSPs you are talking about are for the Arduino IDE I assume? But I will look into the IRQ enable disable methods. Regarding CPU time for the LMIC, that should not be a problem, at least not right now. All I do in my main method is:
Regarding clock error, I remember, I had to set this up for my Feather32u4 and possibly also for the M0 to make it work. I will also experiment with that. For now I will try to find out if my Cheers, |
Beta Was this translation helpful? Give feedback.
-
Instructing me to look into the README did the trick. Thanks for pointing that out. It's one of the most complete READMEs I've seen so far! After studying it thoroughly I stumbled over the After activating it, it started working instantly (at 2% clock error). Now I have to figure out, why there is a clock error of 2%. Do you think using the internal High Accuracy Internal Oscillator (OSC32K) of the SAMD21G18 and multiplying it to 24 MHz using the Digital Frequency Locked Loop (DFLL48M) could introduce an error of this size? |
Beta Was this translation helpful? Give feedback.
-
Hello,
I am currently trying to get the LMIC library to work with a SAMD21G18 and a RFM95W chip. I am using the Atmel Studio and so I wrote the necessary helper methods (SPI, micros, etc. ) myself. The communication with the chip and the interrupts works fine. The chip also sends the Join Request to the LoRa network (TheThingsNetwork), but it fails to receive the Join Accept from the Gateway. It is no reception problem, since the RSSI of the reception at the gateway is -60db. The problem seems to be in the timing of the library. And this is where I need some clarification how things work. The error is a "rxtimeout". That means, the radio chip does not receive the answer during the time window it is listening. And I do believe, that is because the systicks and speed of my chip do not work with the library.
My first question is about the "OSTICKS_PER_SEC" and following settings in the config file. All the timing calculations seem to depend on these settings. The config file documentation states the following : "LMIC requires ticks to be 15.5μs - 100 μs long". My SAMD21 is running with 24MHz and the Systick can only use the core clock. This means, my Systicks are only 0.04us long. Is this a problem? It seems that 24MHz is not such a high Frequency for a chip. Does LMIC not support this? Or is my understanding of this (hopefully) wrong?
Thank you all very much for your support! :-)
Beta Was this translation helpful? Give feedback.
All reactions