Skip to content

Conversation

@VynDragon
Copy link
Contributor

Add missing bandwidths, set enum to be value in khz, add missing sf
use enum value in khz to calculate approximate symbol time
use symbol time to determine if ldro should be enabled
add option to always enable ldro regardless of symbol time

symbol time checked against lora calculator https://www.semtech.com/design-support/lora-calculator, formula is good enough to match without using floats.

See any modem datasheet for 16ms/16.38ms times and the symbol rate / symbol time formulas

@VynDragon
Copy link
Contributor Author

Okay was able to cross check using force-ldro, sx1278, and LLCC68, as expected they cant talk to each others when only one is forced into ldro, assuming the maths for the 16 ms is correct everything should be good.

Add missing values and replace arbitrary BW enum with actual value

Signed-off-by: Camille BAUD <mail@massdriver.space>
@VynDragon VynDragon changed the title drivers: lorawan: LDRO and bandwith additions drivers: lora: LDRO and bandwith additions Dec 13, 2025
@VynDragon
Copy link
Contributor Author

Well and went and checked the possible edge results for the maths with this little program:

#include <stdio.h>


int main()
{
	for (int sf = 5; sf < 12; sf++) {
		for (float bw = 1000.0; bw > 5.0 ; bw/=2.0) {
			int t = (1 << sf) / (int)(bw);
			if (t > 10 && t < 22) {
				printf("bw: %f (%d), sf: %d, t:%d\n", bw, (int)(bw), sf, t);
			}
		}
	}

}

Gets all the same result as the calculator so all good.

Enable LDRO when it should be enabled

Signed-off-by: Camille BAUD <mail@massdriver.space>
Allows Enabling LDRO all the time via DTS

Signed-off-by: Camille BAUD <mail@massdriver.space>
@sonarqubecloud
Copy link

BW_500_KHZ = 500, /**< 500 kHz */
BW_800_KHZ = 800, /**< 812 kHz */
BW_1000_KHZ = 1000, /**< 1000 kHz */
BW_1600_KHZ = 1600, /**< 1625 kHz */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the extra bandwidth options, whats the behaviour when an invalid bandwidth for the modem is selected? Does LBM reject it?

Copy link
Contributor Author

@VynDragon VynDragon Dec 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it does (I think i tried it once? but LBM doesnt know about LLCC68 for example sooo), but it doesn't matter, I was working on this to solve those kind of possible issues: #100989

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants