How To Use 3 Channels of The ADC in DMA Mode
How To Use 3 Channels of The ADC in DMA Mode
MX and ATOLLIC
ATTENTION:
Now we suggest to use the STM32CubeIDE that include ATOLLIC and CUBE-MX.
First is necessary configure the NUCLEO_L031K6 ADC pins and some other using the CUBE-MX.
The global MCU configuration is shown below.
Below there is the Clock configuration. We use 32 MHz.
PA1 (TempRel)
PA3 (PhotoRes)
PA4 (SensPhotoRes)
This explanation is extracted from our more complex project that we will publishing in the future on
this website.
It’s for this reason that there are some more PINs configured in the CUBE-MX that here are not used.
The schematic used here is show below.
Now generate the project for your prefered IDE, here we use ATOLLIC (TrueSTUDIO).
Open the ATOLLIC project.
Now is necessary insert some lines of code in main.c for use the ADC, see below.
Between the line:
uint16_t adcBuffer[3]; // Buffer for store the results of the ADC conversion
HAL_ADC_Start_DMA(&hadc, (uint32_t*)adcBuffer, 3); // Start ADC in DMA mode and declare the buffer
where store the results
}
/* USER CODE END 3 */
Here there is a video.
NOTE:
Use FIREFOX or CHROME for a clear view of the images present in this web site
For enlarge the image press: CTRL +
For reduce the image press: CTRL –