Skip to content

Conversation

@rightup
Copy link
Owner

@rightup rightup commented Oct 27, 2025

Adds automatic LDRO (Low Data Rate Optimization) calculation and configuration
based on symbol duration to prevent timing drift and CRC errors.

LDRO is now enabled when symbol duration > 16 ms, as per LoRa spec.
This resolves CRC errors observed with SF11 / 62.5 kHz (≈32.768 ms symbols)
where LDRO was previously disabled, causing receiver timing drift and packet corruption.

Changes:

  • Compute symbol duration: (2^SF) / (BW / 1000) ms
  • Enable LDRO automatically when symbol_duration_ms > 16.0
  • Pass ldro flag to setLoRaModulation() in both Waveshare and standard init paths
  • Add debug log showing LDRO state and symbol duration at startup
  • Improve configuration logging (removed redundant debug calls)
  • Include bandwidth in startup message
  • Add method to retrieve current noise floor in dBm

Fixes CRC errors on narrow-bandwidth setups (e.g., SF11/62.5kHz).

…row bandwidth

Add automatic LDRO calculation and configuration based on symbol duration.
LDRO must be enabled when symbol duration > 16ms to prevent timing drift
and CRC errors during reception.

- Calculate symbol duration: 2^SF / (BW / 1000) milliseconds
- Enable LDRO when symbol_duration_ms > 16.0
- Pass ldro parameter to setLoRaModulation() in both Waveshare and standard init paths
- Add debug logging to show LDRO state and symbol duration at startup

Fixes CRC errors that occurred with SF11/62.5kHz (32.768ms symbols) where
LDRO was incorrectly disabled, causing receiver timing drift and packet
corruption despite successful transmission.

Also improves configuration logging by adding bandwidth to startup message.
@rightup rightup requested a review from Copilot October 27, 2025 21:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes LoRa configuration issues by implementing automatic Low Data Rate Optimization (LDRO) detection and configuration. The primary purpose is to prevent CRC errors that occur with narrow bandwidth configurations (e.g., SF11 with 62.5 kHz) where symbol durations exceed 16ms.

Key changes:

  • Automatic LDRO calculation and configuration based on symbol duration threshold (>16ms)
  • Enhanced logging with bandwidth information and improved debug verbosity
  • New method to retrieve current noise floor measurements

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/pymc_core/hardware/sx1262_wrapper.py Implements LDRO auto-detection logic, adds noise floor getter method, and refines logging levels
src/pymc_core/init.py Version bump to 1.0.2

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rightup rightup merged commit 4e4c268 into main Oct 27, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants