stm32 timed multichannel ADC DMA conversions on STM32F030k6

  Рет қаралды 16,324

Random Rick

Random Rick

2 жыл бұрын

Yet another "note to future self" video about STM32 DMA ADC acquisition. This time, multiple channels are being sampled into a buffer, triggered by a TIM1 event, rather than by repetitive software calls.
This way, the ADC subsystem does its thing in the background and your code can react when it's ready.
Sorry for the ghastly video and audio production values. I'm not a pro.

Пікірлер: 16
@joshprice7349
@joshprice7349 3 ай бұрын
Wow...I spent most yesterday trying to figure this one out with no luck...It worked first try after watching this! Thanks man!
@randomrickUK
@randomrickUK 3 ай бұрын
You're very welcome!
@DavidBinette1
@DavidBinette1 Жыл бұрын
Thank you so much for the clear and concise explanation.
@randomrickUK
@randomrickUK Жыл бұрын
You're welcome. I hope it was helpful.
@Pojdefulldps
@Pojdefulldps 7 ай бұрын
Thank you so much for this video! I was using low power modes and was looking for a way to trigger DMA to get ADC values but only once per sec, not in the continuous mode. Just for the sake of lower energy consumption. Couldnt get this on my own, had to enable DMA Continuous requests for it to trigger, such a small detail :/
@sohrabmesbah
@sohrabmesbah 2 жыл бұрын
Dear Rick, Thanks a lot, your video is a clean and pro one, Thanks.
@ahmetyldz5674
@ahmetyldz5674 9 ай бұрын
This is very very helpful. Thank you.
@techmakerandhacker7867
@techmakerandhacker7867 7 ай бұрын
thank you soo much this was super helpful
@robc3863
@robc3863 Жыл бұрын
Fab overview, one question though, for continuous automatic timer driven ADC DMA transfers of say 32 words a go, using 2 independent ADCs, when the last ADC word is transferred the timer will be generating another DMA request to both ADCs. If the ADC DMA isn't quite finished when the timer event occurs, could there be a problem? I'll test this I guess, only way to find out right? PS I need both ADCs to transfer to the same slot in each buffer at the same time, hence the need for a timer to synchronise the transfers rather than letting the ADCs just run continuously.
@sohrabmesbah
@sohrabmesbah 2 жыл бұрын
On stm32f103 there is no DMA continious concersion, but circular is enough, but it will not work. The solution is so easy: swap adc_init and dma_init. DMA must be initialized first in the code.
@MrSlackrick
@MrSlackrick 2 жыл бұрын
Thanks, Sohrab! This problem has been seen before. It happened to me too - and took me hours to find the problem! I wish I had known this fix sooner.
@tamhoang3971
@tamhoang3971 Жыл бұрын
can you help me? I use KeilC, DMA is the first, but it dont run continous
@MohamadSayadiFars
@MohamadSayadiFars 2 ай бұрын
Thank you for this tutorial. But I am still wondering about this code HAL_ADC_Start_DMA(&hadc, (uint32_t*)AdcResults, sizeof(AdcResults)/sizeof(AdcResults[0])); I have used DMA but I did not quite understand the sizeof(...)/Sizeof(...) meaning. i would be grateful help me out.
@lookatravieso5036
@lookatravieso5036 29 күн бұрын
Hi, I will try to answer you, it is about what is HAL_ADC_Start_DMA is waiting for and what are you telling with sizeof(). - sizeof(AdcResults): returns size of the array in bytes. If AdcResults is an array of 3 elements of type uint16_t, the size will be 3* sizeof(uint16_t), which is usually 3* 2 = 6 bytes. - sizeof(AdcResults) / sizeof(AdcResults[0]): This returns the number of elements in the array. In this case, it will be 6 / 2 = 3 elements. (Adcresults[0] has 2 bytes as it is type uint16_t) HAL_ADC_Start_DMA is waiting for the number of elements of the array. So if you give it with the first way it may cause malfuctions in your code. I hope it helped you to figure it out.
@MohamadSayadiFars
@MohamadSayadiFars 28 күн бұрын
@@lookatravieso5036 thank you very much. It is very helpful.
@utkarshsethi
@utkarshsethi Жыл бұрын
Hi, do you have a public GitHub?
STM32 PWM basics
18:31
Random Rick
Рет қаралды 19 М.
I’m just a kid 🥹🥰 LeoNata family #shorts
00:12
LeoNata Family
Рет қаралды 19 МЛН
Can You Draw A PERFECTLY Dotted Line?
00:55
Stokes Twins
Рет қаралды 83 МЛН
Tutorial STM32 DAC Timer Triggered DMA
34:08
PR TechTalk
Рет қаралды 2,6 М.
HAL #13: ADC with DMA
10:15
Web learning
Рет қаралды 40 М.
STM32 Multi ADC DMA method
29:42
PR TechTalk
Рет қаралды 4,1 М.
STM32CubeIDE basics - 10 ADC DMA TIM HAL lab
31:32
STMicroelectronics
Рет қаралды 58 М.
STM32 + OLED = Display Anything
18:01
Nick Electronics
Рет қаралды 16 М.
STM32 ADC multiple channels || DMA || True studio || CubeMx
15:47
ControllersTech
Рет қаралды 66 М.
STM32 Tutorial - DMA to GPIO for fast bit patterns (2 MHz) stm32f103rb
9:22
The Problem with Wind Energy
16:47
Real Engineering
Рет қаралды 1,1 МЛН
Optimizing Arduino Code: no setup(), no loop() ⛔
9:27
Wokwi
Рет қаралды 196 М.
SMT32 ADC Interrupts with STM32CubeIDE
9:49
Random Rick
Рет қаралды 11 М.
iPhone 16 с инновационным аккумулятором
0:45
ÉЖИ АКСЁНОВ
Рет қаралды 1 МЛН