ADC in STM32 || Single Channel || Keil

  Рет қаралды 34,522

ControllersTech

ControllersTech

Күн бұрын

Purchase the Products shown in this video from :: controllerstec...
________________________________________________________________________________________
To download the code, GOTO controllerstec...
Check out more VIDEOS on ADC with STM32 • STM32 ADC
________________________________________________________________________________________
****** SUPPORT US BY DONATING*****
paypal.me/cont...
******Join the Membership******
/ @controllerstech
Join the Discord Server / discord
Join the Telegram Group t.me/controlle...
Follow me on Instagram / controllerstech
For more info, visit www.controller...

Пікірлер: 61
@noweare1
@noweare1 4 жыл бұрын
I did not know that the dma actually causes an interrupt. I thought only adc_start_it would cause the interrupt. I also thought a "word" is 32 bits and 1/2 word is 16 bits so that it would be more efficient for storage. I have more trouble with multiple channels using continuous conversion mode. Might be that my sample time is too low. Thanks for your tutorials, they are awesome. I do like the hal low level drivers better as the reference manual describes how things work with respect to the registers. The Low Level drivers are kind of self documenting functions for manipulating the registers. Sometimes with the HAL drivers it takes a bit more studying to find out what the function does.
@gavinhuang424
@gavinhuang424 5 жыл бұрын
No need HAL_ADCEx_Calibration_Start() ?
@krzysztofkabaa3522
@krzysztofkabaa3522 Жыл бұрын
Thanks Dude, grate work! Almost everything working. Interrupt, and Pollforconversion methods work great. I only can't figure out why DMA method won't work in my system. I watched Your video five times, everything looks fine, but on screen still have "0". I use Nucleo F303RE, so there is a few hardware difrents. Do You have some idea, what could i did wrong?
@sunita31415
@sunita31415 4 ай бұрын
Enable DMA Continuous Requests.
@toan3931
@toan3931 3 жыл бұрын
Great tuturior. Sir, can you explain some information about calibration, plus_side and minus_side. Thank you so much.
@electrolabs337
@electrolabs337 5 жыл бұрын
I love your videos... thank you for your time and effort.
@ControllersTech
@ControllersTech 5 жыл бұрын
👍
@prashantwaiba2290
@prashantwaiba2290 Жыл бұрын
Can you make a video on differential ADC mode?
@junnanpan7409
@junnanpan7409 3 жыл бұрын
excellent video! thx! I have a question. how do we konw, that the interrupt get triggered on conversion? The HAL_ADC_Start_IT function was not place in the while-loop. that means adc_started only once, wenn the program ran.
@ControllersTech
@ControllersTech 3 жыл бұрын
HAL uses callbacks for all the interrupts. So whenever a interrupt is triggered, it will serve the interrupt, and call the callback in the end. This is where we write our code. The purpose of the interrupt is that it will be called only once and then it will automatically trigger, whenever the data is available. In some peripherals, like uart, HAL disables the interrupt after serving it once, but that is not the case with ADC. So we can just call it once and it will keep triggering whenever the conversion is complete.
@EmbSysDev
@EmbSysDev 4 жыл бұрын
Excellent videos !! Thank you very much!!
@miguelangelyepesvalencia9424
@miguelangelyepesvalencia9424 3 жыл бұрын
Excelent video. Hey how you make to set se font color on sublime text?
@orph4nsx
@orph4nsx 2 жыл бұрын
Best channel for STM32
@bennguyen1313
@bennguyen1313 4 жыл бұрын
For the HAL_ADC_Start / HAL_ADC_PollForConversion, does the '100' refer to the a timeout.. in cycles/microseconds? I assume the timeout should be based on the ADC clock and the conversion time setting? Regarding the interrupt method (HAL_ADC_Start_IT() and HAL_ADC_Start_DMA()), if the interrupt/callback happens immediately after ADC conversion, is it possible the DMA has not yet transferred the data to the memory?
@ControllersTech
@ControllersTech 4 жыл бұрын
100 refers to the time in milliseconds Once the interrupt happens, the ISR takes care of the rest. That means it transfers the value to the variable and sets the conversion complete interrupt bit. When we read the value inside the conversion complete function, that bit ( conversion complete bit) gets cleared.
@martinlintzgy1361
@martinlintzgy1361 3 жыл бұрын
why use a 32 bit variable to store a 12 bit result? Sureley, a half word (16 bit) would be a better fit?
@ControllersTech
@ControllersTech 3 жыл бұрын
Yeah it is.. 32 bit is the argument of that function, so i did..
@MsSuperasdfghjkl
@MsSuperasdfghjkl Жыл бұрын
Hi. Found this informative. But can someone help me. I want to read 1024 values from same adc using dma mode. Can i just pass a buffer of size 1024 and set dma read size to 1024? Will that do or i shud do the same as this and memcpy to my buffer. This might slow down for my application.
@ControllersTech
@ControllersTech Жыл бұрын
You can do the first case…
@MsSuperasdfghjkl
@MsSuperasdfghjkl Жыл бұрын
@@ControllersTech thank you for the reply. Will try!
@ibrahimshasirajithin9150
@ibrahimshasirajithin9150 2 жыл бұрын
Hey this is Very nice. And my kindly req. pls avoid the background Music.. 😀
@ControllersTech
@ControllersTech 2 жыл бұрын
It's not there in the new videos
@EmbSysDev
@EmbSysDev 4 жыл бұрын
I have one issue with the ADC. The maximum value i am getting is 4024 counts instead of 4095.All voltage are equal to 3.3V,which I verified. Is there any calibration , needed before using ADC ?
@ControllersTech
@ControllersTech 4 жыл бұрын
I don't know. If u have any other sensor, check with that. Or better check with potentiometer. I get proper values myself.
@EmbSysDev
@EmbSysDev 4 жыл бұрын
@@ControllersTech I am using a potentiometer for the trial. Will revert if I get the problem.Thanks!
@EmbSysDev
@EmbSysDev 4 жыл бұрын
Ok calling HAL_ADCEx_Calibration_Start(&hadc1); Solved the problem of the maximum counts.
@ahmedahmed-yg5fl
@ahmedahmed-yg5fl Жыл бұрын
I can't read voltage less than 80mv the adc value 0x0000 at 50mv 😢
@ControllersTech
@ControllersTech Жыл бұрын
Whats the range of voltages you are reading ? And whats the ADC resolution ?
@ahmedahmed-yg5fl
@ahmedahmed-yg5fl Жыл бұрын
@@ControllersTech i use stm32f103 with 12bit adc . My adc read 60mv to 3v but i want to read from 1mv to 3v
@truongquangbaokhanh2910
@truongquangbaokhanh2910 Жыл бұрын
the Temperature on STM32 board so suck right. whatever. Thank u so much
@k1t5un31
@k1t5un31 4 жыл бұрын
Thank you very much great videos
@andresceballos2709
@andresceballos2709 3 жыл бұрын
hello great video I have a question How can I use the ADC's calibration functions? * HAL_ADCEx_Calibration_Start (); * HAL_ADCEx_Calibration_SetValue (); * HAL_ADCEx_Calibration_GetValue ();
@voidzs8882
@voidzs8882 3 жыл бұрын
i just here for listen song because idk songs name lol
@pusatberk4193
@pusatberk4193 5 жыл бұрын
thanks I m wait usb HID
@ControllersTech
@ControllersTech 5 жыл бұрын
Will work on that soon..
@pusatberk4193
@pusatberk4193 5 жыл бұрын
@@ControllersTech Thank you so much
@babotvoj
@babotvoj 4 жыл бұрын
Hallo, when I put the potentiometer in the middle and measure it with the multimeter it has 1,6V. When I connect the adc to the potentiometer it drops to 0.1V. Do you maybe know what's the problem?
@АндрійБогдан-д8ь
@АндрійБогдан-д8ь 11 ай бұрын
Hello! If I have all the ADC channels connected to pins, how exactly should I determine in the function which channel to read data from? I will be grateful for the answer!
@ControllersTech
@ControllersTech 11 ай бұрын
If ypu are using multiple channels, you can't read single channel officially. I have made a video on how to do it though. The video title is " read multiple adc channels without DMA"
@АндрійБогдан-д8ь
@АндрійБогдан-д8ь 11 ай бұрын
@@ControllersTech Aw, thank you very much! The video really helped.
@Just_Vishal
@Just_Vishal 2 жыл бұрын
can you explain how code work and dma call function and get adc value ?
@blasalvadorwii
@blasalvadorwii 3 жыл бұрын
Excellent ! Thanks
@dajianghe
@dajianghe 3 жыл бұрын
Nice tutorial. Have you done OPAMP + ADC for G4 before?
@GlorytoourGod_Jehovah
@GlorytoourGod_Jehovah Жыл бұрын
Sir, your way of explanation is great. sir, can you please explain how to use more than one input(2,3,4..) in single adc channel thank you in advance
@ControllersTech
@ControllersTech Жыл бұрын
What you mean more than 1 input ? If you have multiple devices, use multiple channels.
@briant4326
@briant4326 Жыл бұрын
I've been going through some of you videos step by step and really appreciate your work. Quick question: I've been able to work with the stm32cubeide on my windows pc but on my linux I can't get the ide debugger to connect with my nucleo board. any advice? I can just keep working on windows for now but would be really nice if i could be my linux to handshake with my nucleo board. thanks
@ControllersTech
@ControllersTech Жыл бұрын
I don’t know. I used windows, linux and now mac. I never faced any issues with debugger so far.
@briant4326
@briant4326 Жыл бұрын
Thanks for replying. I got it to work. I had to use the "serial scan" feature in the debug config option in the ide. I sort of don't know what serial number it is refering too. maybe the serial number of the uC on my nucleo board? anyways thanks for the great tutorials again. @@ControllersTech
@kiausiniukova2842
@kiausiniukova2842 2 жыл бұрын
Any ideas how to improve accuracy on adc ? I use timer interrupts to run and stop adc to get 1 value of a battery. I get +-0.2 (sometimes even 0.4 ) Volts error which is not suitable for me.
@ControllersTech
@ControllersTech 2 жыл бұрын
depends on a lot of things. like the power supply, other components, soldering, wires, etc.. ST have a big PDF on this. google it
@mikejones-vd3fg
@mikejones-vd3fg Жыл бұрын
One way to reduce error is to take an average. So instead of one voltage reading, you make a "for loop" that does it 100 times, each time adding to a running total, then dividing that total by how many your loop went around gives you an average. Then those random off results get minimized in the average.
@FunSpark-Horizon
@FunSpark-Horizon 3 жыл бұрын
I have a question. why did you defined a 32bit variable (adc_val)? since our data is 16 bit (word), we did not need 32 bit variable right?
@ControllersTech
@ControllersTech 3 жыл бұрын
No we don't. We can use 16 bit variable..
@FunSpark-Horizon
@FunSpark-Horizon 3 жыл бұрын
@@ControllersTech thank you very much
@egar1956
@egar1956 3 жыл бұрын
Hi, in ADC_DMA example, I've tried to put some code in WHILE loop( gpio toggle w/delay) but it didn't work . I had to configure ADC without INTERRUPT and restart ADC with DMA inside the while every time. Thanks for yours videos and blog
@ControllersTech
@ControllersTech 3 жыл бұрын
Reduce the ADC clock, it will work
@egar1956
@egar1956 3 жыл бұрын
@@ControllersTech First of all, I'm very glad for your soon reply. I'm working on NUCLEOF091 and stm32cubeide. The posibilities of settings for the ADC clock are: 14MHZ internal or APB1_clk /4. I've got results when the APB1 clock was reduced or when I increased the Sampling time. My conclusion is to make slower the ADC for this feature. Thanks again. PD:I chose 239.3 cycles of sampling time and APB1 CLOCK can stay at 48 MHz (maximum speed for this micro)
@ControllersTech
@ControllersTech 3 жыл бұрын
Basically what happens is when you are sampling at higher rates, the dma interrupts get triggered at higher rates too. So the control always remain in those interrupt handlers. Most of these adc devices Don't need high sample frequency anyway
@egar1956
@egar1956 3 жыл бұрын
@@ControllersTech understood
@YauheniyLoika
@YauheniyLoika Жыл бұрын
Hello. Thank you. I Use board NUCLEO-F446RE. Continuousconversion mode is enable (hadc1.Init.ContinuousConvMode = ENABLE;) . But using Interrupt or DMA I get only one conversion and then no interrupts. Therfore I added in HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc) start the ADC again.(in your code it's comment// HAL_ADC_Start_IT(&hadc1);) and it works. This is strange ))
@sunita31415
@sunita31415 4 ай бұрын
+1
How to use Keypad with STM32 || Keil || HAL || CubeMx
12:53
ControllersTech
Рет қаралды 25 М.
STM32 ADC multiple channels || DMA || True studio || CubeMx
15:47
ControllersTech
Рет қаралды 68 М.
LIFEHACK😳 Rate our backpacks 1-10 😜🔥🎒
00:13
Diana Belitskay
Рет қаралды 3,9 МЛН
规则,在门里生存,出来~死亡
00:33
落魄的王子
Рет қаралды 15 МЛН
Крутой фокус + секрет! #shorts
00:10
Роман Magic
Рет қаралды 19 МЛН
БЕЛКА СЬЕЛА КОТЕНКА?#cat
00:13
Лайки Like
Рет қаралды 2,2 МЛН
STM32 ADC Conversion Time/Frequency Calculation || Internal Temp Sensor
19:28
HAL #13: ADC with DMA
10:15
Web learning
Рет қаралды 41 М.
ADC Single Channel using Polling Method - Potentiometer
10:59
Vidura Embedded
Рет қаралды 4,1 М.
#5. STM32F4 ADC using Registers || Multi Channel Polling
18:11
ControllersTech
Рет қаралды 18 М.
My thoughts on framework after daily driving it for 2 years
16:34
Louis Rossmann
Рет қаралды 708 М.
STM32 BlackPill with a Cortex-M4 CPU made in Europe, not in China
9:46
16. STM32CubeIDE Potentiometer ADC with STM32F103C8T6
5:48
MicroPeta by Nizar Mohideen
Рет қаралды 35 М.
STM32CubeMX ADC with Interrupts
15:02
ENGRTUTOR
Рет қаралды 10 М.
LIFEHACK😳 Rate our backpacks 1-10 😜🔥🎒
00:13
Diana Belitskay
Рет қаралды 3,9 МЛН