[En-Nut-Discussion] STM32F103: DMA

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Tue Mar 4 10:48:36 CET 2014

>>>>> "Achim" == Achim  <achim_muc1971 at gmx.de> writes:

    Achim> Dear Ulrich,

    Achim>  working with the Dma fuctions on a STM32F103 I
    Achim> figured out a problem with non-circular mode (in my case:
    Achim> peripheral to memory):

    Achim> The length of data to be transferred which has been configured
    Achim> with Dma_Setup in register CNDTR is zero after the
    Achim> transmission. Hence no further transmission can be startet, nor
    Achim> with Dma_Disable, neither with Dma_Enable.  To solve this I´ve
    Achim> added a funktion Dma_Restart (in stm32f1_dma.c):

    Achim> void DMA_Restart(uint8_t ch, uint8_t length) {
    Achim> DMA_Channel_TypeDef *channel =
    Achim> (DMA_Channel_TypeDef*)DmaTab[ch].dma_ch; if( (channel->CCR &
    Achim> 0x20) == 0 ) // Nicht-circular-mode // AWACK {
    channel-> CNDTR = length; //
    Achim> Reload length // AWACK }
    channel-> CCR |= DMA_CCR_EN;
    Achim> }

    Achim> What do you think about this solution?

DMA_CNDTRx has teh remark: "Once the channel is enabled, this register is
read-only". What in your program has disabled the DMA channel before?
Perhaps show the relevant lines of your code (and try to format the code
better than above). I have used DMA only in circular mode, so I haven't meat
this problem before.

Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

More information about the En-Nut-Discussion mailing list