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

LMIC-1.51 fitting in Arduino Atmega 328

$
0
0

Hi,

Looking for a simple and cheap way to make a node that would run the complete LoRaWAN stack, I have been porting the stack to the ESP8266 (see other topic).

At the same time, I wanted to run that code on the Arduio Pro-Mini which has a Atmega 328 cpu. However, the code would not fit in the MCU, mainly because the large static AES arrays did not fit the memory.

And, after playing several tricks on the code I had to come to the conclusion that even if the code would fit in the Arduino I would not have enough room left to run any application that would do meaningful work.

So I used another AES library and used that instead of the standard LMIC 1.5 AES code. As I did have the AES code of the Nexus (Gerben den Hartog/Ideetron) at hand I ported those AES functions to the LMIC-1.5 code.

The result is a new library (I called it LMIC-1.51 for lack of a better name) with a considerably smaller codebase. Just the vanilla hello world example code uses 25.716 bytes (83%) program space and leaves 230 bytes on the stack/local variables.

I know, you still cannot run ALL sketches just like that, but the Dallas temperature sensor DS18B20 and the I2C bus HTU21d temperature/humidity sensor do fit, the latter one runs fine at the moment on my mini LoRa sensor.

Suggestions for reducing the codebase even further are welcome.

The library is here: Things4U github site. I will publish some more documentation shortly, but the main pin connections can be found in the example sketch.

Maarten

Thanks to Niels for giving me moral support :smile: and advice and helping to test the new library.


Viewing all articles
Browse latest Browse all 117374

Trending Articles



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