stm32f411-adc
|
I wanted to use the ADC with DMA in Arduino with my STM32F411 Black Pill processor together with my Arduino Audio Tools!
Unfortunately STMDuino does not provide this functionality.
My first trials failed miserably using the DMA versions of the HAL API, so I decided to generate a working solution using the STM Cube IDE and then convert this to Arduino library, that provides the following functionality:
PINs | FUNCTIONs |
---|---|
PA0 | Channel0 |
PA1 | Channel1 |
PA3 | Channel2 |
PA4 | Channel3 |
PA5 | Channel4 |
PA6 | Channel5 |
PA7 | Channel6 |
PB0 | Channel7 |
Below I demonstrate the basic API provided by this library.
The preferred way to read the data in continuous mode is by using analogRead();
Here is the link to the actual documentation.
You might also find further information in my Blogs
You can download the library as zip and call include Library -> zip library. Or you can git clone this project into the Arduino libraries folder e.g. with
I recommend to use git because you can easily update to the latest version just by executing the git pull
command in the project folder.
Copyright © 2022 Phil Schatzmann
Copyright © 2015 STMicroelectronics
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.