[En-Nut-Discussion] STM32F103: DMA

Achim achim_muc1971 at gmx.de
Mon Mar 3 16:35:39 CET 2014


Dear Ulrich,

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

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

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

What do you think about this solution?

If you think it´s good, please insert it in NutOS!

Regards,
Achim



More information about the En-Nut-Discussion mailing list