Skip to main content
nj_boelskov
Associate III
July 22, 2008
Question

Conversion of more regular channels using DMA

  • July 22, 2008
  • 2 replies
  • 733 views
Posted on July 22, 2008 at 14:44

Conversion of more regular channels using DMA

    This topic has been closed for replies.

    2 replies

    nj_boelskov
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:40

    I'm trying to converte 2 regular ADC channels, but it does not worke. I'm using DMA to put the result in memory.

    Every time an adc-conversion is over, a DMA request should be generated, and the data moved to a buffer in memory. But when I check the buffer, it only contains results from the first channel in the ADC-queue.

    The length of the ADC-queue is set to 2, and the DMA seems to work correctly. The problem must be that the ADC don´t convert the next channel in the queue or the ADC don't generate a DMA request after end of conversion of the second channel in the queue.

    Any ideas how to get this to work?

    smart
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:40

    it should be something like this

    DMA_InitStructure.DMA_PeripheralBaseAddr = ADC1_DR_Address;

    DMA_InitStructure.DMA_MemoryBaseAddr = (u32)ADC_RegularConvertedValueTab;

    DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;

    DMA_InitStructure.DMA_BufferSize =16;

    DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;

    DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;

    DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;

    DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;

    DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;

    DMA_InitStructure.DMA_Priority = DMA_Priority_High;

    DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;

    DMA_Init(DMA_Channel1, &DMA_InitStructure);