STM32F1 DMA

Post here all questions related to LibMaple core if you can't find a relevant section!
Post Reply
serkanc
Posts: 5
Joined: Fri Feb 14, 2020 8:07 am

STM32F1 DMA

Post by serkanc »

Hi,

I try to implement XY2-100 galvo mirror scanner control protocol. I want to use dma for setting gpio pins. I

rcc_clk_enable(RCC_DMA1);
DMA1_BASE->CPAR1 = (uint32_t)&GPIOA->regs->ODR;
DMA1_BASE->CMAR1 = (uint32_t)pingBuffer;
DMA1_BASE->CNDTR1 = 10;
DMA1_BASE->CCR1 = (DMA_CCR_PL_HIGH | DMA_CCR_DIR_FROM_MEM | DMA_CCR_MINC | DMA_CCR_PSIZE_32BITS | DMA_CCR_MSIZE_8BITS);

I can copy pingBuffer to GPIO ODR register when I enable Dma channel (DMA1_BASE->CCR1 |= DMA_CCR_EN;) if I add Mem2Mem to CCR register. How can I use Timer2 Channel 3 ( According to rm0008 datasheet, Peripharel request signal for DMA1 Channel 3 --> Timer2 Ch3, ADC1, Timer4 Ch1 ) as DMA trigger source without using Timer overflow, because signal is 2Mhz and will overhead cpu....
Thanks
serkanc
Posts: 5
Joined: Fri Feb 14, 2020 8:07 am

Re: STM32F1 DMA

Post by serkanc »

I found. After enabling Timer2 Channel 3, Timer Dier Register should be updated with this bit
Bit 11 CC3DE: Capture/Compare 3 DMA request enable
miki
Posts: 26
Joined: Mon Jan 27, 2020 3:39 pm

Re: STM32F1 DMA

Post by miki »

simpler.
RCC_BASE->AHBENR |= RCC_AHBENR_DMA1EN ; // Enable clock on DMA1
//--
TIMER2_BASE->DIER = TIMER_DIER_CC3DE ;//Capture/Compare 3 DMA request enable
Post Reply

Return to “General discussion”