Merge pull request #2662 from blckmn/f4_dma_fix

Fix for F4 broken DSHOT
This commit is contained in:
borisbstyle 2017-03-16 13:22:51 +01:00 committed by GitHub
commit 1acf06c69c
2 changed files with 4 additions and 5 deletions

View File

@ -153,11 +153,7 @@ void ws2811LedStripHardwareInit(ioTag_t ioTag)
DMA_Init(dmaRef, &DMA_InitStructure); DMA_Init(dmaRef, &DMA_InitStructure);
TIM_DMACmd(timer, timerDmaSource(timerHardware->channel), ENABLE); TIM_DMACmd(timer, timerDmaSource(timerHardware->channel), ENABLE);
DMA_ITConfig(dmaRef, DMA_IT_TC, ENABLE); DMA_ITConfig(dmaRef, DMA_IT_TC, ENABLE);
#ifdef STM32F4
DMA_ClearITPendingBit(dmaRef, dmaFlag_IT_TCIF(dmaRef));
#endif
ws2811Initialised = true; ws2811Initialised = true;
} }

View File

@ -188,13 +188,16 @@ void pwmDigitalMotorHardwareConfig(const timerHardware_t *timerHardware, uint8_t
dmaInit(timerHardware->dmaIrqHandler, OWNER_MOTOR, RESOURCE_INDEX(motorIndex)); dmaInit(timerHardware->dmaIrqHandler, OWNER_MOTOR, RESOURCE_INDEX(motorIndex));
dmaSetHandler(timerHardware->dmaIrqHandler, motor_DMA_IRQHandler, NVIC_BUILD_PRIORITY(1, 2), motorIndex); dmaSetHandler(timerHardware->dmaIrqHandler, motor_DMA_IRQHandler, NVIC_BUILD_PRIORITY(1, 2), motorIndex);
DMA_Cmd(dmaRef, DISABLE);
DMA_DeInit(dmaRef);
DMA_StructInit(&DMA_InitStructure); DMA_StructInit(&DMA_InitStructure);
#if defined(STM32F3) #if defined(STM32F3)
DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)motor->dmaBuffer; DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)motor->dmaBuffer;
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST; DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST;
DMA_InitStructure.DMA_M2M = DMA_M2M_Disable; DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
#elif defined(STM32F4) #elif defined(STM32F4)
DMA_InitStructure.DMA_Channel = timerHardware->channel; DMA_InitStructure.DMA_Channel = timerHardware->dmaChannel;
DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)motor->dmaBuffer; DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)motor->dmaBuffer;
DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral; DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral;
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Enable; DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Enable;