Skip to content

Commit e6da6a7

Browse files
committed
stmhal/dma: De-init the DMA peripheral properly before initialising.
The DMA state is always HAL_DMA_STATE_RESET because of the memset clearing all the data, so prior to this patch HAL_DMA_DeInit was never called. Now it is always called to make sure the DMA is properly reset.
1 parent 679c0c4 commit e6da6a7

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

stmhal/dma.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,8 @@ void dma_init(DMA_HandleTypeDef *dma, const dma_descr_t *dma_descr, void *data){
430430
dma_last_sub_instance[dma_id] = sub_inst;
431431

432432
// reset and configure DMA peripheral
433-
if (HAL_DMA_GetState(dma) != HAL_DMA_STATE_RESET) {
434-
HAL_DMA_DeInit(dma);
435-
}
433+
// (dma->State is set to HAL_DMA_STATE_RESET by memset above)
434+
HAL_DMA_DeInit(dma);
436435
HAL_DMA_Init(dma);
437436
HAL_NVIC_SetPriority(dma_irqn[dma_id], IRQ_PRI_DMA, IRQ_SUBPRI_DMA);
438437
}

0 commit comments

Comments
 (0)