From 41109e52aa5119444524822ec96dd35c9131bf48 Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Fri, 30 Jul 2021 20:51:55 +0200 Subject: [PATCH 1/2] Fix no output when DSHOT BITBANG on H7 targets without an SD card. Initially only the SD card buffer used the DMA RW AXI section, but now the code enabled by `USE_DSHOT_CACHE_MGMT` uses it too. Both the `DMA_RAM` and `DMA_RW_AXI` are only defined when `USE_DMA_RAM` is used. So adding gating on `USE_DMA_RAM`. # Conflicts: # src/main/drivers/memprot_stm32h7xx.c --- src/main/drivers/memprot_stm32h7xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/drivers/memprot_stm32h7xx.c b/src/main/drivers/memprot_stm32h7xx.c index 05b3a67f9d..49772f7d0c 100644 --- a/src/main/drivers/memprot_stm32h7xx.c +++ b/src/main/drivers/memprot_stm32h7xx.c @@ -45,6 +45,7 @@ mpuRegion_t mpuRegions[] = { .bufferable = MPU_ACCESS_BUFFERABLE, }, #endif +#ifdef USE_DMA_RAM { // DMA transmit buffer in D2 SRAM1 // Reading needs cache coherence operation @@ -57,7 +58,6 @@ mpuRegion_t mpuRegions[] = { .cacheable = MPU_ACCESS_CACHEABLE, .bufferable = MPU_ACCESS_NOT_BUFFERABLE, }, -#ifdef USE_SDCARD_SDIO { // A region in AXI RAM accessible from SDIO internal DMA .start = (uint32_t)&dmarwaxi_start, From f3bda6a4a15e769b00d1a8d7d0542d415e93611d Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Fri, 30 Jul 2021 22:40:55 +0200 Subject: [PATCH 2/2] Fix no motor outputs when bi-directional dshot is disabled (the default). The issue is that the DMA is never enabled, and thus the DMA IRQ handler was never called either. --- src/main/drivers/dshot_bitbang.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/drivers/dshot_bitbang.c b/src/main/drivers/dshot_bitbang.c index 24009a36d0..f8f9379f10 100644 --- a/src/main/drivers/dshot_bitbang.c +++ b/src/main/drivers/dshot_bitbang.c @@ -605,22 +605,21 @@ static void bbUpdateComplete(void) } #endif -#ifdef USE_DSHOT_TELEMETRY for (int i = 0; i < usedMotorPorts; i++) { bbPort_t *bbPort = &bbPorts[i]; +#ifdef USE_DSHOT_TELEMETRY if (useDshotTelemetry) { if (bbPort->direction == DSHOT_BITBANG_DIRECTION_INPUT) { bbPort->inputActive = false; bbSwitchToOutput(bbPort); } - - - bbDMA_Cmd(bbPort, ENABLE); } - } #endif + bbDMA_Cmd(bbPort, ENABLE); + } + lastSendUs = micros(); for (int i = 0; i < usedMotorPacers; i++) { bbPacer_t *bbPacer = &bbPacers[i];