ADC in STM32 || Single Channel || Keil

  Рет қаралды 35,701

ControllersTech

ControllersTech

Күн бұрын

Пікірлер: 61
@gavinhuang424
@gavinhuang424 5 жыл бұрын
No need HAL_ADCEx_Calibration_Start() ?
@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.
@truongquangbaokhanh2910
@truongquangbaokhanh2910 Жыл бұрын
the Temperature on STM32 board so suck right. whatever. Thank u so much
@prashantwaiba2290
@prashantwaiba2290 Жыл бұрын
Can you make a video on differential ADC mode?
@АндрійБогдан-д8ь
@АндрійБогдан-д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 Жыл бұрын
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ь Жыл бұрын
@@ControllersTech Aw, thank you very much! The video really helped.
@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 7 ай бұрын
Enable DMA Continuous Requests.
@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.
@miguelangelyepesvalencia9424
@miguelangelyepesvalencia9424 3 жыл бұрын
Excelent video. Hey how you make to set se font color on sublime text?
@martinlintzgy1361
@martinlintzgy1361 4 жыл бұрын
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 4 жыл бұрын
Yeah it is.. 32 bit is the argument of that function, so i did..
@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?
@dajianghe
@dajianghe 3 жыл бұрын
Nice tutorial. Have you done OPAMP + ADC for G4 before?
@Just_Vishal
@Just_Vishal 2 жыл бұрын
can you explain how code work and dma call function and get adc value ?
@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
@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.
@electrolabs337
@electrolabs337 5 жыл бұрын
I love your videos... thank you for your time and effort.
@ControllersTech
@ControllersTech 5 жыл бұрын
👍
@toan3931
@toan3931 3 жыл бұрын
Great tuturior. Sir, can you explain some information about calibration, plus_side and minus_side. Thank you so much.
@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
@orph4nsx
@orph4nsx 3 жыл бұрын
Best channel for STM32
@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
@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!
@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
@EmbSysDev
@EmbSysDev 5 жыл бұрын
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 5 жыл бұрын
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 5 жыл бұрын
@@ControllersTech I am using a potentiometer for the trial. Will revert if I get the problem.Thanks!
@EmbSysDev
@EmbSysDev 5 жыл бұрын
Ok calling HAL_ADCEx_Calibration_Start(&hadc1); Solved the problem of the maximum counts.
@kiausiniukova2842
@kiausiniukova2842 3 жыл бұрын
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 3 жыл бұрын
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.
@GlorytoourGod_Jehovah
@GlorytoourGod_Jehovah 2 жыл бұрын
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 2 жыл бұрын
What you mean more than 1 input ? If you have multiple devices, use multiple channels.
@EmbSysDev
@EmbSysDev 5 жыл бұрын
Excellent videos !! Thank you very much!!
@ibrahimshasirajithin9150
@ibrahimshasirajithin9150 3 жыл бұрын
Hey this is Very nice. And my kindly req. pls avoid the background Music.. 😀
@ControllersTech
@ControllersTech 3 жыл бұрын
It's not there in the new videos
@k1t5un31
@k1t5un31 4 жыл бұрын
Thank you very much great videos
@blasalvadorwii
@blasalvadorwii 3 жыл бұрын
Excellent ! Thanks
@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
@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 7 ай бұрын
+1
How to use Keypad with STM32 || Keil || HAL || CubeMx
12:53
ControllersTech
Рет қаралды 26 М.
STM32 ADC multiple channels || DMA || True studio || CubeMx
15:47
ControllersTech
Рет қаралды 71 М.
Жездуха 41-серия
36:26
Million Show
Рет қаралды 5 МЛН
STM32 ADC Conversion Time/Frequency Calculation || Internal Temp Sensor
19:28
Joystick module with STM32 || ADC || Multi Channel || HAL
8:36
ControllersTech
Рет қаралды 24 М.
DAC in STM32 || Sine wave || HAL || CubeIDE
16:07
ControllersTech
Рет қаралды 68 М.
How to use ADC in STM32 Microcontroller- Read Analog Sensor Value
17:32
Getting Started with the Black Pill Arduino STM32F4
5:25
Caleb Marting
Рет қаралды 73 М.
HAL #13: ADC with DMA
10:15
Web learning
Рет қаралды 42 М.
HAL: #2 How to - GPIO Interrupt
4:35
Web learning
Рет қаралды 63 М.