STM32 ADC multiple channels || DMA || True studio || CubeMx

  Рет қаралды 67,014

ControllersTech

ControllersTech

5 жыл бұрын

Purchase the Products shown in this video from :: controllerstech.store
________________________________________________________________________________________
To download code and for more details GOTO
controllerstech.com/stm32-adc...
Check out more VIDEOS on ADC with STM32 • STM32 ADC
________________________________________________________________________________________
****** SUPPORT US BY DONATING*****
paypal.me/controllertech
******Join the Membership******
/ @controllerstech
Join the Discord Server / discord
Join the Telegram Group t.me/controllerstechdiscuss
Follow me on Instagram / controllerstech
For more info, visit www.controllerstech.com

Пікірлер: 75
@eyeTelevision
@eyeTelevision 4 жыл бұрын
Important Note: There is now also a DMA Continuous Requests setting that needs to be set to Enabled (ADC -> Parameter Settings -> ADC_Settings) to trigger updates. Discovered this the hard way
@kennygomez3291
@kennygomez3291 4 жыл бұрын
Thank you so much,
@kennygomez3291
@kennygomez3291 4 жыл бұрын
Thank you so much,
@memo9768
@memo9768 4 жыл бұрын
Yes, it won't read continuously without this!!
@jurica238814
@jurica238814 3 жыл бұрын
Thank you man! =)
@bamai3797
@bamai3797 3 жыл бұрын
Thank you so much,
@markday3145
@markday3145 3 жыл бұрын
Isn't the word size 32 bits? I think you could (and should) have picked half-word for the DMA size.
@kymcainday6677
@kymcainday6677 3 жыл бұрын
hahahahaha.. my goodness , that music. my 2 year old niece approached me when she heard it.. haha
@thibauthocquette8559
@thibauthocquette8559 4 жыл бұрын
The music is wonderful
@maks223
@maks223 4 жыл бұрын
thank you for your tutorial! :)
@tienleminh8129
@tienleminh8129 2 жыл бұрын
How many ADC channels in STM32F103C8 we can use in oversampling mode simultaneously? I use 6 channels at the same time, but when I tried to get the value from the last channel, it got the value from the first channel
@bennguyen1313
@bennguyen1313 4 жыл бұрын
Regarding the selection of WORD in the DMA data-width.. since the resolution of the ADC is 12-bits, why wouldn't t HALF-WORD (16-bit) be enough? I assume the DMA will place one conversion into a separate memory address? Also I've seen some STM32s have up to 3 ADCs.. and multiple DMAs (DMA1, DMA2, BDMA, and MDMA).. any idea if it's theoretically possible to cycle not just between channels of the same ADC, but across ADCs as well? Using either one DMA controller, or multiple DMAs linked together?
@ControllersTech
@ControllersTech 4 жыл бұрын
Yes you are right Half word would do the 12 bit resolution requirements.. It's not possible to cycle between different ADCs using same dma but you can start them and read the value at any point. Because the conversion will anyway be happening in the background.
@klave8511
@klave8511 5 жыл бұрын
Any comments on why I would read the ADC using DMA? Would it slow the by cpu by stealing cycles or is it on its own bus? This might be useful if I wanted some inline filtering except you’d have to run your moving average or other filter synchronously with the DMA which defeats the object. Reading the ADC this way uses more power which might not be desireable. How is the DMA timing, will it be at exact time intervals? With only a 12 bits ADC, is there a need to use 32 bit words or would 16 bit unsigned ints be better?
@ControllersTech
@ControllersTech 5 жыл бұрын
We need to use DMA cause this seems to be only option with the new cubemx DMA is the hardware mechanism that allows peripheral components to transfer their I/O data directly to and from main memory without the need for the system processor to be involved in the transfer. To use 12 bit ADC, we have to use 32 bit to store value 16bits won't work..
@pusatberk4193
@pusatberk4193 5 жыл бұрын
Again thanks !
@HUY-hd5hf
@HUY-hd5hf 7 ай бұрын
why can't i use the variable value[2] in while(1), when i put " a = value[2 ];", a returns nothing
@sushmakdh6513
@sushmakdh6513 2 жыл бұрын
sir, is it possible for you to upload a video on external ADC like MCP3424?
@mr.engineer3040
@mr.engineer3040 3 жыл бұрын
Just a Half-Word is needed for data width
@antoniorivera6556
@antoniorivera6556 4 жыл бұрын
Can I use Interrupts for the conversion??? I mean, use the ConvCpltCallback() and inside manage the data channels?
@ControllersTech
@ControllersTech 4 жыл бұрын
You can. But try not to do it. ISR should be as short as possible. Better set a flag inside the callback, and using that flag, process the data in the while loop
@OKOK-em4gb
@OKOK-em4gb 3 жыл бұрын
Thank you.
@AlifLearn-org
@AlifLearn-org 5 жыл бұрын
hi, for me i want to put many IN in ADC1"potentiometer", it is necessary to put temperature sensor, if yes why?? thanx.
@ControllersTech
@ControllersTech 5 жыл бұрын
It's not necessary at all. I just used it to demonstrate multiple channel working
@AlifLearn-org
@AlifLearn-org 5 жыл бұрын
@@ControllersTech thank you soo much. from morocco you do well 🤗🤗🤗 good luck
@mkmwila
@mkmwila 3 жыл бұрын
Why did you select WORD instead of Half Word for a data width of 12 Bits? Wouldn't half-word be enough (16 Bits)?
@ControllersTech
@ControllersTech 3 жыл бұрын
Read other comments
@noweare1
@noweare1 3 жыл бұрын
When using interrupts and have a sequence of 3 channels to convert the interrupt routine is only enterered once. I would of thought it would be entered 3 times, once per EOC. ADC_EOC_SINGLE_CONV is assigned to EOCSelection. The 3 channels appear in the ADC channel selection register. This seems like a bug to me.
@ControllersTech
@ControllersTech 3 жыл бұрын
multiple channels can be only used with DMA.
@noweare1
@noweare1 3 жыл бұрын
@@ControllersTech I can get two channels reliably using interrupts and continous conversions but DMA is the way to go.
@rahuljathar9429
@rahuljathar9429 3 жыл бұрын
Which programmer are you using. I have st-link V2. But it is not detecting properly
@ControllersTech
@ControllersTech 3 жыл бұрын
I am also using V2. It sometimes creates problem for me too, but it works fine most of the times.
@do-vitas7079
@do-vitas7079 3 жыл бұрын
like! from Russia!
@SandeepKumar-jj7zi
@SandeepKumar-jj7zi 2 жыл бұрын
India here!
@JackJack-xj8ei
@JackJack-xj8ei Жыл бұрын
Those 17.1µs is the MAXIMUM sampling time, so it should be faster than that.
@aptakamrath2206
@aptakamrath2206 3 жыл бұрын
Supppse I want data acquisition at adc1 ch1 at first and getting certain disirable data I just want to stop data acquisition at adc 1 ch1 and switch to adc1 ch2 only ,how can I manage to do that? Please help regards 🙏
@ControllersTech
@ControllersTech 3 жыл бұрын
With default cubemx setup it will be kinda impossible... But you can do it by modifying the generated code. It's alot to do.. so if u really want it, contact me on telegram..
@jakubstejskal6806
@jakubstejskal6806 4 жыл бұрын
Hi. I want read 3 channel with DMA (setting prescaler to fill +- 3x1000 samples per sec) and separately read temperature and Vbat from internal sensors without DMA. Is that posibble? Using DMA for all those channels is memory wasting in my opinion. I have read few tutorials but did not help. Thank you.
@ControllersTech
@ControllersTech 4 жыл бұрын
No it's not possible. If you want to work with multiple channels means, you have to use DMA. It's not optional anymore..
@jakubstejskal6806
@jakubstejskal6806 4 жыл бұрын
​@@ControllersTech Thank for answer, but it really sucks. I guess only way to do it is create two ADC configs and switch between them..
@MrHaggyy
@MrHaggyy 2 жыл бұрын
Some STMs have multiple ADCs like the 446RE. You could configure one for your 3 channels and one for Vbat and temp. 1kHz is not too fast might be worth to fetch data in a cyclic interrupt. You could read ch 1..3 every time and the 10th time you read VBat and Vtemp as well.
@jakubstejskal6806
@jakubstejskal6806 2 жыл бұрын
@@MrHaggyy thanks. Yeah that looks like a solution but for my purpose i have found something like injected mode in which i can read single data after DMA fill buffer. It requires some delay and calibrating but do the job as well.
@soheildolatabadi4722
@soheildolatabadi4722 5 жыл бұрын
hi. thank you for your videos. I really enjoyed. could you please show us how to use debug session in Atollic? its environment is much better that Keil. so I want to switch to this IDE. thanks
@ControllersTech
@ControllersTech 5 жыл бұрын
Sure will do a little debugging in next video
@soheildolatabadi4722
@soheildolatabadi4722 5 жыл бұрын
@@ControllersTech thank you very much. please if it's possible also talk about live expression with st-link. it is so complicated.
@ArpanMukhopadhyay93
@ArpanMukhopadhyay93 5 жыл бұрын
Atollic is deprecated. Use STM32CubeIDE instead. ST has declared Atollic as NRND.
@noweare1
@noweare1 3 жыл бұрын
@@ArpanMukhopadhyay93 NotRecommendedForNewDevices
@woldecosgrove
@woldecosgrove 4 ай бұрын
Hi i try to duplicate this tutorial on a H7A3 Nucleo board, none of the 3 value are getting any data? Is this gona do with the TCM D-cache ? Could you please do a separate video tutorial pn ADC DMA on H7 series?
@ControllersTech
@ControllersTech 4 ай бұрын
I can't do that. Otherwise there are a lot of videos using DMA and I can't possibly make them again with H7 series. That is why I made a separate video series for cortex M7. It has videos for the MPU configuration. Do watch them otherwise it will be very hard for you to work with these MCUs.
@woldecosgrove
@woldecosgrove 4 ай бұрын
@@ControllersTech where can i find this "separate video series for cortex M7"
@ControllersTech
@ControllersTech 4 ай бұрын
Open the channel page and look in the playlist.
@marcosemenzato1934
@marcosemenzato1934 3 жыл бұрын
Hi, I cannot understand why you write "VSENSE = VSENSE * variable;" while in the datasheet is wrote ("5. Read the resulting Vsense data in the ADC data register", so I was expecting VSENSE = variable. In addition i cannot understand why you initialize VSENSE = 3.3 / 4096 but in the function you always modify this value and, at the next call to getTemperature, VSENSE is totally different from the value initialized. Please help me to understand this. Thanks
@ControllersTech
@ControllersTech 3 жыл бұрын
Vsense is the voltage across athe adc device ( resistor). The reference voltage it have is 3.3 v, and 4096 is the resolution. 3.3 / 4096 gives the voltage per lsb of the adc value. Now to get the actual voltage across the resistor, we need to multiply it by the adc value.
@marcosemenzato1934
@marcosemenzato1934 3 жыл бұрын
@@ControllersTech ok I got it.. but so why you overwrite the value of VSENSE at each call? It should be a kind of constant. For example at the first call of the function VSENSE = 3.3 / 4096 * variable... But at the second call VSENSE = (3.3 /4096 * variable) * variable and so on. This is confusing me 😅
@ControllersTech
@ControllersTech 3 жыл бұрын
I kept the name vsense for the constant because that's what it is. And it will always be vsense * variable, since it's not static, so it can't retain values between different calls. You can give some other nale to the constant if it's confusing you
@marcosemenzato1934
@marcosemenzato1934 3 жыл бұрын
@@ControllersTech ok great.. By the way I thought VSENSE is a global variable so I thought everyone could potentially change the value.. evidently I was wrong
@TeraHertze
@TeraHertze Жыл бұрын
i just copy what you write ... but in my case while(1) never be run until i commented hal_adc_start_dma ! whats the problem!
@ControllersTech
@ControllersTech Жыл бұрын
Thats because the dma triggers an interrupt when the conversion is complete. If your adc clock is very high, the conversion will take very less time and therefore the interrupt will also trigger at very high rate. The callback is called at very often and therefore the control doesn't reach the while loop. You can reduce the adc clock to slow down the interrupt rate.
@TeraHertze
@TeraHertze Жыл бұрын
@@ControllersTech actually i don't need very high frequency , but i need to use at least 10 I/O as adc pin in my application while i using adc the pollforConv code waste the time and my system should be have real time calculations as much as possible. this issue can be solve by using DMA? i must mention that i also use 8 channel PWM output.
@BudiKustamtomo
@BudiKustamtomo 4 жыл бұрын
how to change resolution bit data adc with stmcubemx 5.1
@ControllersTech
@ControllersTech 4 жыл бұрын
You can't. They have fixed it at 12bit now. That's we have to use unfortunately.
@BudiKustamtomo
@BudiKustamtomo 4 жыл бұрын
@@ControllersTech but previous version stmcube it can do change resolution adc. Example 8 bit.
@ControllersTech
@ControllersTech 4 жыл бұрын
Yes it was there in the previous versions. Now they have removed the option.
@BudiKustamtomo
@BudiKustamtomo 4 жыл бұрын
@@ControllersTech thanks mr
@foxy7283
@foxy7283 3 жыл бұрын
Where to download lcd-i2c.h and lcd-i2c.c please help
@ControllersTech
@ControllersTech 3 жыл бұрын
Link is in the description..
@widcoshop
@widcoshop 3 жыл бұрын
hi how are you?how i can show adc stm32 in android app by wifi?im android developer and arm
@ControllersTech
@ControllersTech 3 жыл бұрын
Use web server. Check webserver video
@widcoshop
@widcoshop 3 жыл бұрын
@@ControllersTech thanks but i want controll with android not web server..how can do it?
@ControllersTech
@ControllersTech 3 жыл бұрын
You said u want to use wifi.. then u need the webserver, or else use bluetooth or something
@widcoshop
@widcoshop 3 жыл бұрын
@@ControllersTech hii thanks your right.if biuld an anroid app to control stm32 can you help me?
ADC in STM32 || Single Channel || Keil
16:08
ControllersTech
Рет қаралды 33 М.
Can You Draw A PERFECTLY Dotted Line?
00:55
Stokes Twins
Рет қаралды 91 МЛН
Alat Seru Penolong untuk Mimpi Indah Bayi!
00:31
Let's GLOW! Indonesian
Рет қаралды 14 МЛН
ИРИНА КАЙРАТОВНА - АЙДАХАР (БЕКА) [MV]
02:51
ГОСТ ENTERTAINMENT
Рет қаралды 10 МЛН
THEY WANTED TO TAKE ALL HIS GOODIES 🍫🥤🍟😂
00:17
OKUNJATA
Рет қаралды 15 МЛН
STM32CubeIDE basics - 10 ADC DMA TIM HAL lab
31:32
STMicroelectronics
Рет қаралды 58 М.
Joystick module with STM32 || ADC || Multi Channel || HAL
8:36
ControllersTech
Рет қаралды 22 М.
stm32 timed multichannel ADC DMA conversions on STM32F030k6
12:06
HAL #13: ADC with DMA
10:15
Web learning
Рет қаралды 40 М.
Set up multiple ADCs on STM32 microcontrollers using DMA
8:43
Random Rick
Рет қаралды 35 М.
Transmit data using UART in STM32 || Poll || Interrupt || DMA
20:34
ControllersTech
Рет қаралды 72 М.
STM32 Multi ADC DMA method
29:42
PR TechTalk
Рет қаралды 4,1 М.
Best mobile of all time💥🗿 [Troll Face]
0:24
Special SHNTY 2.0
Рет қаралды 2,5 МЛН
Main filter..
0:15
CikoYt
Рет қаралды 14 МЛН
Что не так с яблоком Apple? #apple #macbook
0:38
Не шарю!
Рет қаралды 452 М.
Хотела заскамить на Айфон!😱📱(@gertieinar)
0:21
Взрывная История
Рет қаралды 5 МЛН