Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
0e30739
Add bidirectional DShot telemetry and RPM gyro filtering
halfmanbear May 26, 2026
c9aa345
Merge upstream/maintenance-10.x to resolve conflicts with PR #11605
sensei-hacker Aug 3, 2026
fe94094
Fix unused-function CI failure on F4 StdPeriph targets
sensei-hacker Aug 20, 2026
0dcf861
Fix implicit-function-declaration on F7/H7 DMA request calls
sensei-hacker Aug 20, 2026
61fcc05
docs: regenerate Settings.md for PR #11605's new DShot telemetry sett…
sensei-hacker Aug 20, 2026
6d26d2a
Fix implicit-function-declaration for loadDmaBufferDshot on DMAR targets
sensei-hacker Aug 20, 2026
3b2a74d
fix: keep DShot telemetry decode out of ITCM
mart1npetroff Aug 20, 2026
c4bc589
Merge pull request #1 from mart1npetroff/fix/halfmanbear-itcm-overflow
halfmanbear Aug 22, 2026
ac6c735
BidirDshot - fix for H7, invertion of timer, reset DMA for reading te…
error414 Aug 29, 2026
abc7374
BidirDshot - hold the line to avoid double beeping durring FC bootup
error414 Sep 5, 2026
4499455
BidirDshot - skip circular DMA keepalive during EEPROM writes
error414 Sep 8, 2026
016f3c6
Merge branch 'maintenance-10.x' into master
sensei-hacker Sep 10, 2026
e6dcaf2
Merge pull request #2 from error414/error414/feat/bidir-dshot-fix
halfmanbear Sep 10, 2026
0a611ac
Merge branch 'fork/halfmanbear/master' into error414/feature/bidir-dshot
error414 Sep 21, 2026
57434f3
Bidir DSHOT - USE_DSHOT_BIDIR (H7), bidir_dshot.c, review fixes
error414 Sep 21, 2026
59a7161
DSHOT BIDIR - keep pin hight
error414 Sep 24, 2026
331cc72
Merge branch 'maintenance-10.x' into error414/feature/bidir-dshot
error414 Sep 24, 2026
1385fdd
DSHOT BIDIR - allow for all target without DMAR
error414 Sep 24, 2026
d94f0fc
DSHOT BIDIR - fix 1. SRXL2 telemetry disappears from consumers
error414 Sep 24, 2026
d9df0b4
DSHOT BIDIR - 2. AT32 motors never receive usable telemetry
error414 Sep 24, 2026
cb54594
DSHOT BIDIR - 5. Rp2350 accepts telemetry it cannot use - disable bi…
error414 Sep 24, 2026
4ec7ad6
DSHOT BIDIR - small fixes for RPM filters
error414 Sep 26, 2026
fdd4052
DSHOT BIDIR - add bidir dshot rpm to MSP
error414 Sep 28, 2026
df0bd31
Merge branch 'maintenance-10.x' into error414/feature/bidir-dshot
error414 Sep 28, 2026
61637a5
DSHOT BIDIR - fix DMA library clearing flag
error414 Sep 28, 2026
20b0c54
DSHOT BIDIR - add counters of frames for bidir and for aurt telemetry
error414 Sep 29, 2026
020f8f9
DSHOT BIDIR - add counters to MSP for configurator
error414 Sep 29, 2026
535673d
DSHOT BIDIR - adjust error counter
error414 Sep 30, 2026
5ef40b9
DSHOT BIDIR - pull up durring eeprom saving instead of dire driving pin
error414 Oct 1, 2026
7e2742d
DSHOT BIDIR - disable bidir for F7, not enought memory so far
error414 Oct 2, 2026
fc84c11
DSHOT BIDIR - optimize memory
error414 Oct 2, 2026
7086adc
Merge branch 'maintenance-10.x' into error414/feature/bidir-dshot
error414 Oct 5, 2026
d6ed722
DSHOT BIDIR - fix EDT, send EDT ON after arm
error414 Oct 6, 2026
4a7d4e2
DSHOT BIDIR - try to make space for F722
error414 Oct 6, 2026
e88caef
DSHOT BIDIR - use direct writing to registers for F7/H7
error414 Oct 9, 2026
776761b
DSHOT BIDIR - make F4 IRQ faster
error414 Oct 9, 2026
21fc86c
DSHOT BIDIR - add checking for getting RPM error
error414 Oct 12, 2026
2fffdef
DSHOT BIDIR - add motor_poles to BB header and to debug insert RPM in…
error414 Oct 17, 2026
8c2ab51
Merge pull request #3 from error414/error414/feature/bidir-dshot
halfmanbear Oct 27, 2026
abeae36
DSHOT BIDIR - AT32 bitbang
error414 Nov 3, 2026
5fae2af
DSHOT BIDIR - refactor dshot
error414 Nov 3, 2026
a6fe37e
DSHOT BIDIR - remove debug line for debug
error414 Nov 4, 2026
4fe8204
Merge branch 'next-10.1' into error414/feature/bidir-dshot
error414 Nov 6, 2026
86532df
DSHOT BIDIR - Stale ESC readings remain marked fresh
error414 Nov 8, 2026
ba4d2c7
DSHOT BIDIR - Silent ESC replies appear unmeasured
error414 Nov 8, 2026
caf348f
Merge remote-tracking branch 'inav/next-10.1' into error414/feature/b…
error414 Nov 15, 2026
38d0de5
DSHOT BIDIR - move settings to end of config structs
error414 Nov 22, 2026
f74b32b
Merge remote-tracking branch 'inav/next-10.1' into error414/feature/b…
error414 Nov 27, 2026
ef25528
DSHOT BIDIR - fix wrong merge
error414 Nov 27, 2026
767c469
Merge remote-tracking branch 'inav/next-10.1' into error414/feature/b…
error414 Dec 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/Blackbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ Available debug modes include:
- `GPS` - GPS debugging
- `ALTITUDE` - Altitude estimation debugging
- `MAG` - Raw, uncalibrated magnetometer samples (useful for external compass calibration)
- `RPM_FILTER` - Raw per-motor eRPM/100 (same unit as Betaflight's `eRPM[]` blackbox field, before the RPM filter's smoothing), motors 1-8 in `debug[0]`-`debug[7]`; RPM = value * 100 / (`motor_poles` / 2). Needs the RPM filter enabled, so bidirectional DShot or ESC telemetry. `src/utils/blackbox_rpm_to_erpm.py` renames the fields to `eRPM[]` for PIDtoolbox
- And 20+ other modes for specific subsystems

To use debug mode logging:
Expand Down
17 changes: 17 additions & 0 deletions docs/ESC and servo outputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,23 @@ ESC protocol can be selected in Configurator. No special configuration is requir

Check the ESC documentation for the list of protocols that are supported.

### Bidirectional DSHOT

With `dshot_bidir_enabled = ON` the ESC answers every DSHOT frame with its eRPM on the motor
wire (and, with `dshot_edt_enabled`, temperature, voltage and current), which feeds the RPM
filter and the ESC telemetry without a separate ESC telemetry UART. Set `motor_poles` to the
pole count of the motors so the eRPM is converted to RPM. The ESC firmware must support
bidirectional DSHOT (BLHeli_32, Bluejay, AM32).

On STM32 the reply is captured by the motor's own timer channel, so every motor output needs
its timer channel's DMA stream. On AT32 the motor pins are "bitbanged" instead, as in
Betaflight: a spare channel of TMR8 or TMR1 paces DMA transfers that drive and read the
whole GPIO port, one per port with motors on it. That timer must be unused by anything else
(LED strip, servos, beeper). If neither TMR8 nor TMR1 is free, bidirectional DSHOT is switched
off for that boot: the motors run plain DSHOT on their timers, there is no eRPM telemetry or
RPM filter, and the boot log reports "Bitbang DSHOT unavailable". Without
`dshot_bidir_enabled` DSHOT on AT32 stays on the timers as before.

## Servo outputs

By default, INAV uses 50Hz servo update rate. If you want to increase it, make sure that servos support
Expand Down
21 changes: 21 additions & 0 deletions docs/Settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,7 @@ Defines debug values exposed in debug variables (developer / debugging setting)
| FW_TURN | |
| MAG | |
| I2C | |
| RPM_FILTER | |

---

Expand Down Expand Up @@ -945,6 +946,26 @@ Sets the DShot beeper tone

---

### dshot_bidir_enabled

Enable bidirectional DShot telemetry on motor outputs. Required for RPM filtering without a separate ESC telemetry UART

| Default | Min | Max |
| --- | --- | --- |
| OFF | OFF | ON |

---

### dshot_edt_enabled

Enable extended DShot telemetry (temperature, voltage, current in addition to eRPM). The ESC is asked for it on every arm, so the values appear after the first arm

| Default | Min | Max |
| --- | --- | --- |
| OFF | OFF | ON |

---

### dterm_lpf2_hz

Dterm pre-differentiation LPF cutoff (Hz). Filters gyro before differentiation to reduce noise amplification. Higher = less delay, more noise. 0 = disabled. Values around 200-250Hz can add smoothing with small delay.
Expand Down
6 changes: 4 additions & 2 deletions docs/development/msp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4156,16 +4156,18 @@ When the MSP JSON specification changes, bump `msp_messages.json` version:
**Notes:** Requires `USE_PROGRAMMING_FRAMEWORK`. Fixed 8-byte reply carrying one 64-bit mask as two `uint32_t` halves, low half first. Only the first `MIN(MAX_LOGIC_CONDITIONS, 64)` bits are evaluated. A condition counts as configured when any of `enabled`, `activatorId` (default -1), `operation`, `operandA.type`, `operandA.value`, `operandB.type`, `operandB.value` or `flags` differs from its default.

## <a id="msp2_inav_esc_rpm"></a>`MSP2_INAV_ESC_RPM (8256 / 0x2040)`
**Description:** Retrieves the RPM reported by each ESC via telemetry.
**Description:** Retrieves the RPM and telemetry link quality reported by each ESC.

**Request Payload:** **None**

**Reply Payload:**
|Field|C Type|Size (Bytes)|Units|Description|
|---|---|---|---|---|
| `escRpm` | `uint32_t` | 4 | RPM | RPM reported by the ESC |
| `frameSuccess` | `uint8_t` | 1 | % | Share of the counted telemetry replies that decoded in the last closed window. 255 when nothing was counted in that window |
| `frameTotal` | `uint16_t` | 2 | frames | Telemetry replies counted in the last closed window. Serial ESC telemetry: one per request, a missing reply included. Bidirectional DSHOT: only replies that reached the capture, a missing reply is not counted |

**Notes:** Requires `USE_ESC_SENSOR`. Payload size depends on the number of detected motors with telemetry.
**Notes:** Requires `USE_ESC_SENSOR` or `USE_DSHOT_BIDIR`. 7 bytes per motor, `getMotorCount()` entries. Source follows the RPM filter: bidirectional DSHOT when `isDshotTelemetryActive()`, serial ESC telemetry otherwise. The frame statistics come from fixed back-to-back windows of `ESC_FRAME_WINDOW_MS` (1 s), so they change once per window. A counted reply fails when it does not pass CRC/GCR decoding or (serial) times out. Bidirectional DSHOT counts only replies that were at least partly captured, as Betaflight does, since an ESC may skip replies when busy; an ESC that never replies therefore reports 255 / 0, the same as a source without frame counting (SRXL2).

## <a id="msp2_inav_esc_telem"></a>`MSP2_INAV_ESC_TELEM (8257 / 0x2041)`
**Description:** Retrieves the full telemetry data structure reported by each ESC.
Expand Down
16 changes: 14 additions & 2 deletions docs/development/msp/msp_messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -9797,13 +9797,25 @@
"ctype": "uint32_t",
"desc": "RPM reported by the ESC",
"units": "RPM"
},
{
"name": "frameSuccess",
"ctype": "uint8_t",
"desc": "Share of the counted telemetry replies that decoded in the last closed window. 255 when nothing was counted in that window",
"units": "%"
},
{
"name": "frameTotal",
"ctype": "uint16_t",
"desc": "Telemetry replies counted in the last closed window. Serial ESC telemetry: one per request, a missing reply included. Bidirectional DSHOT: only replies that reached the capture, a missing reply is not counted",
"units": "frames"
}
],
"repeating": "getMotorCount()"
},
"variable_len": "getMotorCount()",
"notes": "Requires `USE_ESC_SENSOR`. Payload size depends on the number of detected motors with telemetry.",
"description": "Retrieves the RPM reported by each ESC via telemetry."
"notes": "Requires `USE_ESC_SENSOR` or `USE_DSHOT_BIDIR`. 7 bytes per motor, `getMotorCount()` entries. Source follows the RPM filter: bidirectional DSHOT when `isDshotTelemetryActive()`, serial ESC telemetry otherwise. The frame statistics come from fixed back-to-back windows of `ESC_FRAME_WINDOW_MS` (1 s), so they change once per window. A counted reply fails when it does not pass CRC/GCR decoding or (serial) times out. Bidirectional DSHOT counts only replies that were at least partly captured, as Betaflight does, since an ESC may skip replies when busy; an ESC that never replies therefore reports 255 / 0, the same as a source without frame counting (SRXL2).",
"description": "Retrieves the RPM and telemetry link quality reported by each ESC."
},
"MSP2_INAV_ESC_TELEM": {
"code": 8257,
Expand Down
8 changes: 8 additions & 0 deletions src/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,14 @@ main_sources(COMMON_SRC
drivers/pwm_esc_detect.h
drivers/pwm_mapping.c
drivers/pwm_mapping.h
drivers/dshot/bidir_dshot.c
drivers/dshot/bidir_dshot.h
drivers/dshot/dshot.c
drivers/dshot/dshot.h
drivers/dshot/dshot_bitbang.c
drivers/dshot/dshot_bitbang.h
drivers/dshot/dshot_bitbang_decode.c
drivers/dshot/dshot_bitbang_decode.h
drivers/pwm_output.c
drivers/pwm_output.h
drivers/pinio.c
Expand Down
9 changes: 6 additions & 3 deletions src/main/blackbox/blackbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -1591,8 +1591,10 @@ static void loadSlowState(blackboxSlowState_t *slow)

#ifdef USE_ESC_SENSOR
escSensorData_t * escSensor = escSensorGetData();
slow->escRPM = escSensor->rpm;
slow->escTemperature = escSensor->temperature;
if (escSensor) {
slow->escRPM = escSensor->rpm;
slow->escTemperature = escSensor->temperature;
}
#endif

#ifdef USE_DRONECAN
Expand All @@ -1618,7 +1620,7 @@ static bool writeSlowFrameIfNeeded(bool allowPeriodicWrite)
if (shouldWrite) {
loadSlowState(&slowHistory);
} else {
blackboxSlowState_t newSlowState;
blackboxSlowState_t newSlowState = {0};

loadSlowState(&newSlowState);

Expand Down Expand Up @@ -2179,6 +2181,7 @@ static bool blackboxWriteSysinfo(void)
#endif
BLACKBOX_PRINT_HEADER_LINE("serialrx_provider", "%d", rxConfig()->serialrx_provider);
BLACKBOX_PRINT_HEADER_LINE("motor_pwm_protocol", "%d", motorConfig()->motorPwmProtocol);
BLACKBOX_PRINT_HEADER_LINE("motor_poles", "%d", motorConfig()->motorPoleCount);
BLACKBOX_PRINT_HEADER_LINE("motor_pwm_rate", "%d", getEscUpdateFrequency());
BLACKBOX_PRINT_HEADER_LINE("debug_mode", "%d", systemConfig()->debug_mode);
BLACKBOX_PRINT_HEADER_LINE("features", "%d", featureConfig()->enabledFeatures);
Expand Down
1 change: 1 addition & 0 deletions src/main/build/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ typedef enum {
DEBUG_FW_TURN,
DEBUG_MAG,
DEBUG_I2C,
DEBUG_RPM_FILTER,
DEBUG_COUNT // also update debugModeNames in cli.c
} debugType_e;

Expand Down
3 changes: 3 additions & 0 deletions src/main/drivers/dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ DMA_t dmaGetByRef(const DMA_Stream_TypeDef * ref);
DMA_t dmaGetByRef(const dma_channel_type * ref);

void dmaMuxEnable(DMA_t dma, uint32_t dmaMuxid);
// Walks the channel table; NULL past its end. Any channel serves any peripheral through
// the DMAMUX, so a user without a fixed assignment can take whichever is still free.
DMA_t dmaGetByIndex(unsigned index);

#endif

Expand Down
5 changes: 5 additions & 0 deletions src/main/drivers/dma_at32f43x.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ DMA_t dmaGetByTag(dmaTag_t tag)
return (DMA_t) NULL;
}

DMA_t dmaGetByIndex(unsigned index)
{
return index < ARRAYLEN(dmaDescriptors) ? &dmaDescriptors[index] : NULL;
}

void dmaEnableClock(DMA_t dma)
{
if (dma->dma == DMA1) {
Expand Down
Loading
Loading