adc_dma_8/main.c
/*
  Start ADC conversion sequence in background.
  DMA will copy the data to ADCRawValues array.
  ADC1_IRQHandler will be called at end of sequence.
*/
Start ADC conversion sequence in background.
DMA will copy the data to ADCRawValues array.
ADC1_IRQHandler will be called at end of sequence.
Start ADC conversion sequence in background . DMA will copy the data to ADCRawValues array . ADC1_IRQHandler will be called at end of sequence .
void startADC(void)
{
  ADCStartTime = SysTick->VAL;          
  DMA1_Channel1->CCR = 0; 
  DMA1_Channel1->CPAR = (uint32_t)&(ADC1->DR);
  DMA1_Channel1->CMAR = (uint32_t)&(ADCRawValues[0]);
  DMA1_Channel1->CNDTR = ADC_SRC_CNT;
  DMA1_Channel1->CCR = DMA_CCR_PL               
    | DMA_CCR_MSIZE_0                           
    | DMA_CCR_PSIZE_0                           
    | DMA_CCR_MINC                              
    | DMA_CCR_CIRC                              
    ;
  DMAMUX1_Channel0->CCR = 0;
  DMAMUX1_Channel0->CCR =  5<<DMAMUX_CxCR_DMAREQ_ID_Pos;   
  DMA1_Channel1->CCR |= DMA_CCR_EN;   
  ADCScanActive = 1;
  ADC1->CR |= ADC_CR_ADSTART; 
}
void startADC ( void ) { ADCStartTime = SysTick -> VAL ; DMA1_Channel1 -> CCR = 0 ; DMA1_Channel1 -> CPAR = ( uint32_t ) & ( ADC1 -> DR ) ; DMA1_Channel1 -> CMAR = ( uint32_t ) & ( ADCRawValues [ 0 ] ) ; DMA1_Channel1 -> CNDTR = ADC_SRC_CNT ; DMA1_Channel1 -> CCR = DMA_CCR_PL | DMA_CCR_MSIZE_0 | DMA_CCR_PSIZE_0 | DMA_CCR_MINC | DMA_CCR_CIRC ; DMAMUX1_Channel0 -> CCR = 0 ; DMAMUX1_Channel0 -> CCR = 5 << DMAMUX_CxCR_DMAREQ_ID_Pos ; DMA1_Channel1 -> CCR |= DMA_CCR_EN ; ADCScanActive = 1 ; ADC1 -> CR |= ADC_CR_ADSTART ; }
Start ADC conversion sequence in background.
Start ADC conversion sequence in background .
/* store start time of the background sampling activity */ /* disable DMA */ /* highest piority */ /* 32 bit transfer memory size */ /* 32 bit peripheral size */ /* increment memory address after each transfer */ /* repeat with inital memory address */ /* DIR=0: transfer from CPAR to CMAR */ /* 
    DMA MUX channel 0 connected to DMA channel 1!
    
    see code comment here:
    https://vivonomicon.com/2019/07/05/bare-metal-stm32-programming-part-9-dma-megamix/
    --> mux channel0 connects to dma1
  */ /* 5=ADC */ /* enable DMA */ /* start the ADC conversion */