cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F411 continuous DMA from ADC, how?

PRenn.1
Associate II

ADC1 configured as
Mode "Independend Mode"
Scan Conversion Disabled
Continuous Conversion Enabled
Discontinuous Conversion Disabled
DMA Continuous REequests Enabled
End of Conversion "EOC Flag at the end of single conversion"

DMA2 configured as
Direction "Peripheral To Memory"
Mode "Circular"
Increment Adress Memory (Peripheral is unchecked)

Start code in main.c :

/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_USB_DEVICE_Init();
MX_I2C1_Init();
MX_ADC1_Init();

/* USER CODE BEGIN 2 */
//where?? HAL_ADCEx_Calibration_Start(&hadc1, ADC_SINGLE_ENDED);

HAL_ADC_Start_DMA(&hadc1,(uint32_t*)&value_adc,1); <= fetches only one value !

 


Questions:
What file to include for HAL_ADCEx_Calibration ?
Why do I have to guess the Include file's name ?
Will Calibration make the DMA Transfer autorepeat (??) or just enhace accuracy?
What is missing for "autorepeat DMA" ?
Where do I see how frequently the ADC will run, if at all?
What does "circular" do w/o being given a buffer to write multiple values to, in a circular fashion?

Somehow I'm truly wishing there were a Guide, with naming examples (took me a while to figure out the names for port and gpio pin) and descriptions what one has to do manually after changing the configuration (like add includes files CubeMX has forgotten..)

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

Here's an example for continuously capturing ADC values into a single location with circular DMA:

STM32CubeF4/Projects/STM324xG_EVAL/Examples/ADC/ADC_RegularConversion_DMA at 4f7969ab6fcb229bc5d28e8e87187fd34e271f56 · STMicroelectronics/STM32CubeF4

 

You can use the Example Selector to load this into STM32CubeIDE and run it. May need modified slightly for your specific chip.

 

HAL_ADCEx_Calibration_Start doesn't exist on STM32F4.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

2 REPLIES 2
TDK
Guru

Here's an example for continuously capturing ADC values into a single location with circular DMA:

STM32CubeF4/Projects/STM324xG_EVAL/Examples/ADC/ADC_RegularConversion_DMA at 4f7969ab6fcb229bc5d28e8e87187fd34e271f56 · STMicroelectronics/STM32CubeF4

 

You can use the Example Selector to load this into STM32CubeIDE and run it. May need modified slightly for your specific chip.

 

HAL_ADCEx_Calibration_Start doesn't exist on STM32F4.

If you feel a post has answered your question, please click "Accept as Solution".

@TDK wrote:

HAL_ADCEx_Calibration_Start doesn't exist on STM32F4.


TDK, thanks for pointing this out!