summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/dma.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-11-11 17:24:18 +1100
committerDamien George <damien.p.george@gmail.com>2016-11-11 17:24:18 +1100
commite6da6a720fb2bb48c6885e5f28f5f917690080fd (patch)
tree993914e07dd6a365e8f4e524c561bb3459e903cc /stmhal/dma.c
parent679c0c4c835371552fb0bc9b65a4893ceaaf7471 (diff)
downloadmicropython-e6da6a720fb2bb48c6885e5f28f5f917690080fd.tar.gz
micropython-e6da6a720fb2bb48c6885e5f28f5f917690080fd.zip
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.
Diffstat (limited to 'stmhal/dma.c')
-rw-r--r--stmhal/dma.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/stmhal/dma.c b/stmhal/dma.c
index 218d0fbef2..7b540f847e 100644
--- a/stmhal/dma.c
+++ b/stmhal/dma.c
@@ -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);
}