Skip to content

Add bidirectional DShot ESC telemetry#11605

Open
halfmanbear wants to merge 1 commit into
iNavFlight:masterfrom
halfmanbear:master
Open

Add bidirectional DShot ESC telemetry#11605
halfmanbear wants to merge 1 commit into
iNavFlight:masterfrom
halfmanbear:master

Conversation

@halfmanbear
Copy link
Copy Markdown

Ports bidirectional DShot (GCR) telemetry from Betaflight, enabling RPM-based gyro filtering without a dedicated ESC telemetry UART.

After each DShot output frame the motor pin is switched to timer input capture mode via per-channel DMA to receive the ESC's GCR-encoded eRPM response. The decoded eRPM feeds the existing RPM filter infrastructure.

New settings:

  • dshot_bidir_enabled: enable bidirectional DShot telemetry
  • dshot_edt_enabled: enable Extended DShot Telemetry (temperature, voltage, current in addition to eRPM)

Changes:

  • drivers/dshot.c/.h: GCR decode, EDT frame parsing, eRPM-to-RPM conversion, motor frequency LPF (ported from Betaflight, GPLv3)
  • drivers/pwm_output.c: per-channel DMA direction switching between DShot output and GCR input capture on STM32 (StdPeriph/HAL) and AT32
  • sensors/esc_sensor.c/.h: DShot bidir data path into ESC sensor framework (escSensorSetDshotData, escSensorIsActive)
  • flight/rpm_filter.c: DShot telemetry as frequency source alongside serial ESC sensor path
  • target/common_post.h: USE_RPM_FILTER enabled for any USE_DSHOT target
  • fc/fc_init.c: call initDshotTelemetry() at startup; fix RPM filter init condition to accept DShot bidir as a valid source
  • blackbox/blackbox.c: fix NULL dereference when escSensorGetData() returns NULL; fix uninitialized blackboxSlowState_t comparison
  • telemetry/srxl.c: replace Betaflight-specific USE_DSHOT_TELEMETRY guards with INAV's USE_DSHOT/USE_ESC_SENSOR; use escSensorGetData()

Tested on SPEEDYBEEF405V4 (STM32F405, StdPeriph) with Bluejay ESC firmware. eRPM telemetry confirmed in blackbox;

Ports bidirectional DShot (GCR) telemetry from Betaflight, enabling
RPM-based gyro filtering without a dedicated ESC telemetry UART.

After each DShot output frame the motor pin is switched to timer input
capture mode via per-channel DMA to receive the ESC's GCR-encoded eRPM
response. The decoded eRPM feeds the existing RPM filter infrastructure.

New settings:
- dshot_bidir_enabled: enable bidirectional DShot telemetry
- dshot_edt_enabled: enable Extended DShot Telemetry (temperature,
  voltage, current in addition to eRPM)

Changes:
- drivers/dshot.c/.h: GCR decode, EDT frame parsing, eRPM-to-RPM
  conversion, motor frequency LPF (ported from Betaflight, GPLv3)
- drivers/pwm_output.c: per-channel DMA direction switching between
  DShot output and GCR input capture on STM32 (StdPeriph/HAL) and AT32
- sensors/esc_sensor.c/.h: DShot bidir data path into ESC sensor
  framework (escSensorSetDshotData, escSensorIsActive)
- flight/rpm_filter.c: DShot telemetry as frequency source alongside
  serial ESC sensor path
- target/common_post.h: USE_RPM_FILTER enabled for any USE_DSHOT target
- fc/fc_init.c: call initDshotTelemetry() at startup; fix RPM filter
  init condition to accept DShot bidir as a valid source
- blackbox/blackbox.c: fix NULL dereference when escSensorGetData()
  returns NULL; fix uninitialized blackboxSlowState_t comparison
- telemetry/srxl.c: replace Betaflight-specific USE_DSHOT_TELEMETRY
  guards with INAV's USE_DSHOT/USE_ESC_SENSOR; use escSensorGetData()

Tested on SPEEDYBEEF405V4 (STM32F405, StdPeriph) with Bluejay ESC
firmware. eRPM telemetry confirmed in blackbox; RPM gyro filter
updating notch frequencies with motor speed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@qodo-code-review
Copy link
Copy Markdown
Contributor

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@github-actions
Copy link
Copy Markdown

Branch Targeting Suggestion

You've targeted the master branch with this PR. Please consider if a version branch might be more appropriate:

  • maintenance-9.x - If your change is backward-compatible and won't create compatibility issues between INAV firmware and Configurator 9.x versions. This will allow your PR to be included in the next 9.x release.

  • maintenance-10.x - If your change introduces compatibility requirements between firmware and configurator that would break 9.x compatibility. This is for PRs which will be included in INAV 10.x

If master is the correct target for this change, no action is needed.


This is an automated suggestion to help route contributions to the appropriate branch.

@Jetrell
Copy link
Copy Markdown

Jetrell commented May 30, 2026

Have you had a chance to look at log data. To compare the latency improvement bdshot dynamic notch has over the matrix filter ? Or even over ESC telemetry RPM, to be sure it's working correctly.

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