Commit e6da6a72 authored by Damien George's avatar Damien George
Browse files

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.
parent 679c0c4c
......@@ -430,9 +430,8 @@ void dma_init(DMA_HandleTypeDef *dma, const dma_descr_t *dma_descr, void *data){
dma_last_sub_instance[dma_id] = sub_inst;
// reset and configure DMA peripheral
if (HAL_DMA_GetState(dma) != HAL_DMA_STATE_RESET) {
HAL_DMA_DeInit(dma);
}
// (dma->State is set to HAL_DMA_STATE_RESET by memset above)
HAL_DMA_DeInit(dma);
HAL_DMA_Init(dma);
HAL_NVIC_SetPriority(dma_irqn[dma_id], IRQ_PRI_DMA, IRQ_SUBPRI_DMA);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment