Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DSHOT on G4 #11158

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/main/drivers/dshot_bitbang.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,14 @@ static void bbUpdateComplete(void)
bbPort->inputActive = false;
bbSwitchToOutput(bbPort);
}
}
} else
#endif
{
#if defined(STM32G4)
// Using circular mode resets the counter one short, so explicitly reload
bbSwitchToOutput(bbPort);
#endif
}

bbDMA_Cmd(bbPort, ENABLE);
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/drivers/dshot_bitbang_ll.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ static void bbSaveDMARegs(dmaResource_t *dmaResource, dmaRegCache_t *dmaRegCache
dmaRegCache->PAR = ((DMA_ARCH_TYPE *)dmaResource)->PAR;
dmaRegCache->M0AR = ((DMA_ARCH_TYPE *)dmaResource)->M0AR;
#elif defined(STM32G4)
((DMA_ARCH_TYPE *)dmaResource)->CCR = dmaRegCache->CCR;
((DMA_ARCH_TYPE *)dmaResource)->CNDTR = dmaRegCache->CNDTR;
((DMA_ARCH_TYPE *)dmaResource)->CPAR = dmaRegCache->CPAR;
((DMA_ARCH_TYPE *)dmaResource)->CMAR = dmaRegCache->CMAR;
dmaRegCache->CCR = ((DMA_ARCH_TYPE *)dmaResource)->CCR;
dmaRegCache->CNDTR = ((DMA_ARCH_TYPE *)dmaResource)->CNDTR;
dmaRegCache->CPAR = ((DMA_ARCH_TYPE *)dmaResource)->CPAR;
dmaRegCache->CMAR = ((DMA_ARCH_TYPE *)dmaResource)->CMAR;
#else
#error MCU dependent code required
#endif
Expand Down