diff --git a/ChangeLog b/ChangeLog index 027d1639cf5..46dc95a2ec1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5854,4 +5854,7 @@ ARCH_HAVE_NET that determines if a network is present or not. This currently can happen if CONFIG_NET is set or if CONFIG_WL_CC3000 is is set (23013-10-23). + * arch/arm/src/stm32/stm32f10xxx_dma.c: DMA fix from David Sidrane: + The DMA_CNDTRx register cannot be modified if the DMA channel is + disabled (2013-10-23). diff --git a/arch/arm/src/stm32/stm32f10xxx_dma.c b/arch/arm/src/stm32/stm32f10xxx_dma.c index 01d697e87bd..c92db5dcea5 100644 --- a/arch/arm/src/stm32/stm32f10xxx_dma.c +++ b/arch/arm/src/stm32/stm32f10xxx_dma.c @@ -457,11 +457,20 @@ void stm32_dmafree(DMA_HANDLE handle) * ****************************************************************************/ -void stm32_dmasetup(DMA_HANDLE handle, uint32_t paddr, uint32_t maddr, size_t ntransfers, uint32_t ccr) +void stm32_dmasetup(DMA_HANDLE handle, uint32_t paddr, uint32_t maddr, + size_t ntransfers, uint32_t ccr) { struct stm32_dma_s *dmach = (struct stm32_dma_s *)handle; uint32_t regval; + /* Then DMA_CNDTRx register can only be modified if the DMA channel is + * disabled. + */ + + regval = dmachan_getreg(dmach, STM32_DMACHAN_CCR_OFFSET); + regval &= ~(DMA_CCR_EN); + dmachan_putreg(dmach, STM32_DMACHAN_CCR_OFFSET, regval); + /* Set the peripheral register address in the DMA_CPARx register. The data * will be moved from/to this address to/from the memory after the * peripheral event. @@ -508,7 +517,8 @@ void stm32_dmasetup(DMA_HANDLE handle, uint32_t paddr, uint32_t maddr, size_t nt * ****************************************************************************/ -void stm32_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg, bool half) +void stm32_dmastart(DMA_HANDLE handle, dma_callback_t callback, + void *arg, bool half) { struct stm32_dma_s *dmach = (struct stm32_dma_s *)handle; uint32_t ccr; @@ -542,7 +552,6 @@ void stm32_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg, bool */ ccr |= (half ? (DMA_CCR_HTIE|DMA_CCR_TEIE) : (DMA_CCR_TCIE|DMA_CCR_TEIE)); - } else {