ADC in STM32 || Single Channel || Keil

  Рет қаралды 33,172

ControllersTech

ControllersTech

5 жыл бұрын

Purchase the Products shown in this video from :: controllerstech.store
________________________________________________________________________________________
To download the code, 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

Пікірлер: 61
@EmbSysDev
@EmbSysDev 4 жыл бұрын
Excellent videos !! Thank you very much!!
@electrolabs337
@electrolabs337 5 жыл бұрын
I love your videos... thank you for your time and effort.
@ControllersTech
@ControllersTech 5 жыл бұрын
👍
@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.
@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?
@toan3931
@toan3931 2 жыл бұрын
Great tuturior. Sir, can you explain some information about calibration, plus_side and minus_side. Thank you so much.
@dajianghe
@dajianghe 2 жыл бұрын
Nice tutorial. Have you done OPAMP + ADC for G4 before?
@gavinhuang424
@gavinhuang424 5 жыл бұрын
No need HAL_ADCEx_Calibration_Start() ?
@k1t5un31
@k1t5un31 4 жыл бұрын
Thank you very much great videos
@junnanpan7409
@junnanpan7409 2 жыл бұрын
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 2 жыл бұрын
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.
@miguelangelyepesvalencia9424
@miguelangelyepesvalencia9424 3 жыл бұрын
Excelent video. Hey how you make to set se font color on sublime text?
@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.
@orph4nsx
@orph4nsx 2 жыл бұрын
Best channel for STM32
@Just_Vishal
@Just_Vishal Жыл бұрын
can you explain how code work and dma call function and get adc value ?
@blasalvadorwii
@blasalvadorwii 3 жыл бұрын
Excellent ! Thanks
@prashantwaiba2290
@prashantwaiba2290 Жыл бұрын
Can you make a video on differential ADC mode?
@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..
@briant4326
@briant4326 10 ай бұрын
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 10 ай бұрын
I don’t know. I used windows, linux and now mac. I never faced any issues with debugger so far.
@briant4326
@briant4326 10 ай бұрын
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
@Adventuresbiblestories
@Adventuresbiblestories Жыл бұрын
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.
@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 2 ай бұрын
Enable DMA Continuous Requests.
@truongquangbaokhanh2910
@truongquangbaokhanh2910 11 ай бұрын
the Temperature on STM32 board so suck right. whatever. Thank u so much
@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
@user-kh7cy4se3v
@user-kh7cy4se3v 8 ай бұрын
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 8 ай бұрын
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"
@user-kh7cy4se3v
@user-kh7cy4se3v 8 ай бұрын
@@ControllersTech Aw, thank you very much! The video really helped.
@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 10 ай бұрын
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.
@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.
@MsSuperasdfghjkl
@MsSuperasdfghjkl 11 ай бұрын
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 11 ай бұрын
You can do the first case…
@MsSuperasdfghjkl
@MsSuperasdfghjkl 11 ай бұрын
@@ControllersTech thank you for the reply. Will try!
@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
@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
@ahmedahmed-yg5fl
@ahmedahmed-yg5fl 11 ай бұрын
I can't read voltage less than 80mv the adc value 0x0000 at 50mv 😢
@ControllersTech
@ControllersTech 11 ай бұрын
Whats the range of voltages you are reading ? And whats the ADC resolution ?
@ahmedahmed-yg5fl
@ahmedahmed-yg5fl 11 ай бұрын
@@ControllersTech i use stm32f103 with 12bit adc . My adc read 60mv to 3v but i want to read from 1mv to 3v
@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
@user-qg1do3ey8n
@user-qg1do3ey8n Жыл бұрын
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 2 ай бұрын
+1
How to use Keypad with STM32 || Keil || HAL || CubeMx
12:53
ControllersTech
Рет қаралды 24 М.
STM32 ADC Conversion Time/Frequency Calculation || Internal Temp Sensor
19:28
Osman Kalyoncu Sonu Üzücü Saddest Videos Dream Engine 170 #shorts
00:27
Incredible magic 🤯✨
00:53
America's Got Talent
Рет қаралды 46 МЛН
When You Get Ran Over By A Car...
00:15
Jojo Sim
Рет қаралды 18 МЛН
stm32 timed multichannel ADC DMA conversions on STM32F030k6
12:06
STM32 ADC multiple channels || DMA || True studio || CubeMx
15:47
ControllersTech
Рет қаралды 67 М.
CubeMX and AC6 - STM32 TIMER, INTERRUPT, blinking LED
4:40
chiptron
Рет қаралды 56 М.
Set up multiple ADCs on STM32 microcontrollers using DMA
8:43
Random Rick
Рет қаралды 35 М.
STM32CubeMX ADC with Interrupts
15:02
ENGRTUTOR
Рет қаралды 10 М.
STM32 Guide #1: Your first STM32 dev board
12:12
Mitch Davis
Рет қаралды 198 М.
ADC Multiple Channel using STM32(Interrupt Method)
15:40
Vidura Embedded
Рет қаралды 8 М.
Stm32 ADC Pt:1 OverView
20:17
Eddie Amaya
Рет қаралды 30 М.
Main filter..
0:15
CikoYt
Рет қаралды 16 МЛН
Choose a phone for your mom
0:20
ChooseGift
Рет қаралды 6 МЛН
Опыт использования Мини ПК от TECNO
1:00
Андронет
Рет қаралды 648 М.
Хотела заскамить на Айфон!😱📱(@gertieinar)
0:21
Взрывная История
Рет қаралды 5 МЛН