cancel
Showing results for 
Search instead for 
Did you mean: 

ADC1 DMA Scan Conversions Start at Wrong Array Index Every Other Scan

spflanze
Associate II
Posted on April 13, 2016 at 06:16

I have an ADC1 buffer that is being filled by DMA once every time on this call:

HAL_ADC_Start_DMA( &hadc1, (uint32_t *)ADC_Data, 3 );

Where:

uint16_t ADC_Data[] = { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF }; 

I can tell by the initialized values that ADC_Data[3] never gets a conversion as expected.

What is not expected is that the array element that gets the first conversion of the scan is changing. It is alternating between

ADC_Data[0] and

ADC_Data[1] every call to

HAL_ADC_Start_DMA()

. When it is

ADC_Data[1] the last of the three conversions gets wrapped around to 

ADC_Data[0]. Why is it starting at ADC_Data[1] every other scan instead of always at ADC_Data[0] as expected? I need it to always start at ADC_Data[0].

The configuration code is in the attached file.

This is an STM32CubeMX generated project for an STM32F373VCT processor.

#adc1-stm32-conversion-order
1 REPLY 1
Walid FTITI_O
Senior II
Posted on April 13, 2016 at 12:22

Hi Stephen,

I suggest that you refer to this [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32F373RB%20ADC%2bDMA%2bInterrupt&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=14]discussion where you find a good help for your case.

-Hannibal-