SlimLoRa library

@Jeff-UK I thought

implemented large parts of the LoRaWAN 1.0.3 spec

made it pretty clear that itā€™s not another send and forget library. But I agree that I could have made it clearer. In the end, I just threw it in, in case it helps someone.

I did not go through the whole thread so idk about all the problems discussed. I did not run into any of the problems mentioned in the first post.
The project is tested against V3 and works fine for me. However I canā€™t guarantee that there are no bugs. Iā€™ve been using it for two years now and for my use cases it works.

I created a fork at https://github.com/novag/SlimLoRa and prepared it for usage with the Arduino std library. It does not work yet since the timing related code has to be adapted to the Arduino libraries. I do not have much experience with Arduinos so this might take some time. Thereā€™s still polishing work to do and, given the much looser memory requirements, lots of functionality can be added or rewritten. I will add issues for the things I remember. Since I am quite busy until the end of March, it may take some time.
Contributions welcome.

@rvdvoort This shouldnā€™t be too hard. Leave me a message with what does not work.

2 Likes

Iā€™m sorry but in the context of this thread ā€˜implemented large partsā€¦ā€™ has little weight and sounds no better than a statement/assertion such as the earlier

It likely would just as easily still not be LoRaWAN, though I am glad you have provided more information and the fact that it

Sounds promising, but TinyLoRa works for others so I would like to know e.g. whilst working for you does it cause problems for others such as triggering the download avalanche discussed and described earlierā€¦do you have access to a gw? Does it indicate node misbehaviour? If not then sounds promising :slight_smile: and I await reports back from other users with their assessments of if plays nicely with V3 :wink: please keep posting & help us fill in the blanksā€¦ :+1:

THANK YOU! You give me hope. Still trying to undestand MCCI LMIC code, TinyLoRa style is easier for me.

Already opened an issue with some PR from TinyLoRa thatā€™s maybe helpful.

@Jeff-UK @cslorabox I donā€™t get the rush to criticize him. One click away is the repos. After reading his message, the first thing I did, was to click.

1 Like

If you can find an evening to give us some pointers at what needs looking at, itā€™s certainly something worth taking forward ā€¦

2 Likes

The libraryā€™s name SlimLoRa is a bit misleading as it tries to target LoRaWAN, not LoRa.
SlimLoRaWAN looks more appropriate but the library is not (fully) LoRaWAN compliant.
If it (also) is based on LMIC then SlimLMIC might be a good candidate for a name.

[update]
Based on below responses SimpleLoRa is still the most suitable of the above three names.

I am fine with both names :slight_smile: brevity vs precision

Not to start a discussion here but not being (fully) compliant is usually easier.
(e.g. mastering only half of the theory required for driving a car in public traffic is easier but will make you a poor driver.)

No event handling

This library does not implement any kind of event handling. A call to the Join and SendData methods will block for several seconds until the end of the second receive window.

If there is no support for event handling then how do you handle (sequence of) downlinks?

That will also trigger the Lora Alliance as it infringes on their rights. Nothing wrong with the current name.

4 Likes

If I remember correctly, when thereā€™s pending data for a class A device, the device has to send another uplink packet to receive the pending data no? While thereā€™s currently no pending data support it would be easy to notify the user of the pending data and ask him to queue for a second uplink packet.

How this exactly happens on protocol level Iā€™m not sure.
When using LMIC and the node receives a sequence of queued downlinks, this will happen automatically without intervention of the application code. This is done by the library automatically (like handling of MAC command like Status request).
The application will handle al downlink messages (payload data) via an event handler. Therefore I was interested in how SimpleLoRa handles downlink messages without supporting event handling.

The author said the code ā€œwill block for several seconds until the end of the second receive window.ā€.

Thus it handles downlinks by not doing anything else while they are possible.

Since TTN only supports class A, a downlink is only possible in direct response to an uplink. Even the FPending bit is just an invitation to send another uplink so that an additional downlink can follow, the additional downlink wonā€™t be sent on its own.

4 Likes

With (MCCI) LMIC this is handled automatically by the LMIC library.

Itā€™s presumably handled by this library too. Though not handling it would not really cause an issue, because the network canā€™t do anything until the node sends another uplink, and its free to make that minutes, hours, or days later at its discretion.

Perhaps some of the confusion is coming from the way some other codebases try to create a sort of interface between library and application (LMiC does so in a very unclear way, LoRaMAC does so not just there but between layers of itself in a way abstracted nearly to the point of absurdity); I suspect this one is flatter and more directly coupled.

2 Likes

After changing the sleep commands to the correct ATTiny84 version and selecting the correct port for tne RFM95 NSS I only had 1 error during compiling regarding the timer TIMSK in the timing.cpp file.

I made the following change in timing.cpp file
TIMSK |= (1 << OCIE0A); ====> TIMSK0 |= (1 << OCIE0A);

After that I was able to compile but no result when trying to connect to TTN

Than I changed
TCCR0B |= (0 << CS02) | (0 << CS01) | (1 << CS00); ===> TCCR0B |= (1 << CS01) | (1 << CS00);

This resulted into 1 activation message as per below. So I believe it has something to do with how the timer has been set-up. However I am not familiar with how to correctly set-up the timer for the ATTiny84 using registers. Maybe you can help me setting up this part of the code correctly.

Appreciate any help you can give me.

1 Like

Seems likely the timer issues may be preventing firing up the receiver at the correct time to catch the join accept message

On my fork / branch: try-to-compile I adapted some code and compiles with arduino IDE.

Only the first time I had a successfull join (!) and afterwards an uplink. I was excited and moved forward and added SetPower, SetDataRate, debugging options, but after that I never joined again. Tested with V3. I abandoned OTAA and tried ABP. It works since it does need downlinks, but it seems that also the downlinks are not working.

In other words, it seems that the timing creates problem with downlinks. I didnā€™t investigate it further. I have the impression that instead of 5 seconds it opens the window at approx 1 sec.

The code is here.

@novag thanks for sharing.

1 Like

TTN V3 absolutely requires proper downlink and MAC command support, even for ABP.

The reality is that trying to make a minimal LoRaWan implementation which actually works correctly is extremely hard, because LoRaWan is not a simple protocol at all.

Thereā€™s been talk / an effective feature request that TTN have a way to register nodes with only partial LoRaWan support, but so far it does not - unless or until such a thing is added ā€œincompleteā€ nodes must not be registered on TTN. because they will trick the network into sending unanswered downlinks over and over and over again, each of which blocks the gatewayā€™s ability to receive other properly functioning nodes.

I know. Thatā€™s the reason for my report and my effort to port it to arduino. To enable support for downlinks. At current state itā€™s the same with TinyLoRa.

Today I saw two examples for timing. I hope I will try those days.

Forgot to add, that maybe the problem is with my GW. Thatā€™s one more reason I want people to test SlimLoRa. Maybe itā€™s already listening for downlinks at right time (default 5 secs to my understanding).

2 Likes

Still no functional library for Arduino?