Quantcast
Channel: The Things Network - Latest posts
Viewing all articles
Browse latest Browse all 116439

LMIC-1.51 fitting in Arduino Atmega 328

$
0
0

AFAICS all the libraries referenced are based on my initial port of the LMIC library. I've been (finally) cleaning up my port last week (integrating all code from @tftelkamp's version). As part of that cleanup, I changed it to use PROGMEM as well, which makes the code fit in a 328p. Using the "ttn" example from my repo (which just sends messages with some ttn-specific settings): Sketch uses 22,762 bytes (70%) of program storage space. Global variables use 1,001 bytes (48%) of dynamic memory.

Looking back at the commits linked and talked about in this thread, I think they only add the PROGMEM keyword, without also updating the references to these arrays. This would mean the code compiles (and gets smaller), but doesn't actually work. I suspect that these commits haven't actually been tested on AVR hardware, then? My version does update the references to these arrays properly and has been tested on AVR hardware already (on an atmega256rfr2, I'm planning to test on a 328p / Arduino Uno today).

The code is here: https://github.com/matthijskooijman/arduino-lmic/tree/experimental (still in the experimental branch, I wanted to do a bit more testing before merging to the master branch). In the past, this library has been used on ESP8266 as well with some modifications. I think my experimental branch would work on the ESP8266 now as-is, though I don't have one set up to test (@popcorn, you tested this in the past, perhaps you could do so now?).

Using PROGMEM means that dat is not copied from flash to RAM on startup, but instead is read from flash directly, saving duplicating the data in RAM. The downside is that reading from flash is slightly slower, but that's minimal (2 cycles to read from RAM, 3 cycles to read from flash on a 328p. A bit more overhead could result from the reduced flexibility of reading from flash, though).


Viewing all articles
Browse latest Browse all 116439

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>