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.
This commit is contained in:
parent
679c0c4c83
commit
e6da6a720f
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user