AnsweredAssumed Answered

Nucleo-144 DMA Memory to Memory Transfer not working

Question asked by Bare.Bradley on Jun 23, 2016
Latest reply on Jun 23, 2016 by Bare.Bradley
I am trying to configure the DMA2 using the registers and I cannot get the DMA to work.

I must be having a bad day because nothing seems to be working correctly.

Here is my simple code that does not work

//GPIO clock is already enabled and GPIO is configured
 
RCC->AHB1ENR |= RCC_AHB1ENR_DMA2EN;
//enable DMA2
 
GPIO_ResetOutput(GPIOA,GPIO_PIN_1); //GPIO OFF
 
uint32_t from = 0xffffffff;
uint32_t to = 0;
 
DMA2_Stream0->CR &= DMA_SxCR_EN;
while((DMA2_Stream0->CR & DMA_SxCR_EN) != 0)
;
//wait for DMA to turn off
 
DMA2_Stream0->CR = 0b00000000000000110101000010000000;
//set mem2mem, no increment, datasize as 32bit.
 
DMA2_Stream0->PAR = &from;   //from address
DMA2_Stream0->M0AR = &to;   //to address
DMA2_Stream0->NDTR = 1;     //data to transfer
DMA2_Stream0->FCR &= ~0b11; //Lowest FIFO level
DMA2_Stream0->CR |= DMA_SxCR_EN;        //Enable Stream.
 
DelayMilli(1000); //Delay to allow stream to transfer for test
 
if(to == from) //test the memory transfer was successful
{
    GPIOSetOutput(GPIOA,GPIO_PIN1); //GPIO ON
}



Nothing ever happens. I am a lost puppy because the DMA should be simple but I am having nothing but problems.

Thank you for any opinions

Outcomes