Multi-Channel ADC with STM32 using DMA and Interrupt- Multiple Analog Sensors

  Рет қаралды 26,443

BINARYUPDATES

BINARYUPDATES

Күн бұрын

Пікірлер: 46
@lucdrouin2625
@lucdrouin2625 Жыл бұрын
Excellent work, very clear, structured and informative presentation on a popular topic for STM32. Congratulations Sir.
@BINARYUPDATES
@BINARYUPDATES Жыл бұрын
Thanks you! I'm glad you enjoyed this STM32 tutorial. Best wishes!
@danielcarpio4302
@danielcarpio4302 7 ай бұрын
Very nice, I dont need to make the video faster because you speak on a very reasonable speed.
@abelashenafi6291
@abelashenafi6291 11 ай бұрын
Thanks for the superb explanation. I learned quite a lot! But why do we need to reset the MCU every time we need to read the input voltage of each Analog pin? is there anyway where we could read the input voltage without resetting the MCU?
@javierlopez2022
@javierlopez2022 10 ай бұрын
Thanks a lot :)
@unknown.477
@unknown.477 Жыл бұрын
this multiple ADC doesn't work for me. I'm using nucleo G070rb . What may the reason..?
@CAN_MIKE
@CAN_MIKE 11 ай бұрын
Hello, I don't understand why you have to reset the board to obtain a new value from the ADC, in theory the DMA ADC would have to do it
@BINARYUPDATES
@BINARYUPDATES 11 ай бұрын
Hi Mike. you're right to make this multiple ADC with STM32 short I did conversion in while loop. Otherwise to avoid press RESET button I'll have to add few more lines on code. To keep video short I prefer this way of reading multichannel ADC in video lesson.
@abelashenafi6291
@abelashenafi6291 11 ай бұрын
@@BINARYUPDATES Hey man, can you please add the few lines of code to avoid resetting the MCU all the time and see the values change in real-time? This would be really really appreciated. Regardless, you just earned a subscriber. Kudos
@neudyvielma
@neudyvielma 9 ай бұрын
@@abelashenafi6291 To avoid the reset it is only necessary to reset the "convCompleted" variable to zero
@CEOPhiscape
@CEOPhiscape 3 ай бұрын
@@abelashenafi6291 HAL_ADC_Start_DMA add this code inside the while loop. Also its good to use HAL_ADC_Stop_DMA inside the conversion complete callback function
@usmantariq1611
@usmantariq1611 Жыл бұрын
Excellent explained
@BINARYUPDATES
@BINARYUPDATES Жыл бұрын
Thank you Good luck and best wishes!
@romeshpg5041
@romeshpg5041 7 ай бұрын
How did you learn all this? I would also like to know this way. Would you be able to recommend any books or courses?
@gujarisantamanyugmai
@gujarisantamanyugmai 7 ай бұрын
Nice Video Sir!!!
@BINARYUPDATES
@BINARYUPDATES 7 ай бұрын
Thank you so much Santamanyu. Best wishes!
@Qaidi_804
@Qaidi_804 5 ай бұрын
At 3:53 Why did you tick the ADC1,ADC2,ADC3 interrupts? Is it because you are using multiple channels? If I am using a single channel then should I tick it or not?
@JoeBob189
@JoeBob189 9 ай бұрын
at 7:12 you cast rawValues as a uint32_t pointer, however rawValues is a 16 bit array with a size of 2. This means that 32 bits in total are taken up by rawValues. You give your uint32_t casted rawValues a size of 2, which would tell the compiler that you have 64 bits allocated for this buffer. Wouldn't this be a vulnerability as it is *possible* to overwrite an unrelated address? Am I missing something here?
@javierlopez2022
@javierlopez2022 10 ай бұрын
I should use a DMA with a lot more samples (32, 64 ones) to work them after in order to use DMA advantages
@spencerclegg1606
@spencerclegg1606 Жыл бұрын
Why were the channel cycles set to 480 cycles instead of 3?
@BINARYUPDATES
@BINARYUPDATES 11 ай бұрын
The 480 cycle is an optimal and most common choice to make sure we achieve resolution and accuracy while reading ADC value. If we choose 3 cycle then it will be very fast and it'll not allows us to read analog pins to maintain stable output from ADC channel of STM32
@spencerclegg1606
@spencerclegg1606 11 ай бұрын
@@BINARYUPDATES Perfect, thanks. Yeah, I'd assume at some point it will not finish reading the ADC channels before the next cycle begins. So in cases where sample rate isn't critical it makes sense to select the slowest sample rate (480 cycles).
@muralikrishna.3252
@muralikrishna.3252 6 ай бұрын
very intro about dma in stm32....i have implemented in stm32f446re. but i am unable to visualize adc data which is changing in live expression tab.it is freezing at initial value. how to change it? any solution would be appreciable.
@dragon_619
@dragon_619 Жыл бұрын
Brother Im using NUCLEO-L452RE so what I do if i want to make all 16 channels in active mode
@VedantNaik1
@VedantNaik1 5 ай бұрын
I don't think you need a for loop at 11:30 to get values for `lux` and `pot`, also resetting mcu doesn't help much
@bobby4976
@bobby4976 11 ай бұрын
thank you. anyway i am wondering, in line 126 (minute 10:20): why does the code has to iterate it until i < number of conv. ? i can understand if it is only 2 number conversions so that the code only does the iteration once since it is 2-1. say, for example, if we have 3 number of conversions, then the code there will have to iterate twice since it is 3 - 1. So reading adc chanel 0, 1, 2 twice?
@neudyvielma
@neudyvielma 9 ай бұрын
Not only are you right about that, but there is a final line missing: reset the "convCompleted" variable to zero.
@khichadeneeta
@khichadeneeta 9 ай бұрын
sir please make the video on SPI and I2C
@BINARYUPDATES
@BINARYUPDATES 9 ай бұрын
Hi Khichadeneeta, I'll try to find time soon to finish making videos on using I2C and SPI peripheral to interface different sensors with STM32 Microcontroller. Thanks for your patience. Best wishes!
@dileepj3449
@dileepj3449 6 ай бұрын
why we need to reset the board any reason behind it?
@BINARYUPDATES
@BINARYUPDATES 5 ай бұрын
Hi Dileep, this code only read value once from ADC channel. But it keep printing on UART continuously. If you want to see the changed ADC values on serial terminal then you've to modify the program. While making video I needed ADC conversion only once at interrupt so i used same code but you can easily modify. Best wishes!
@itayjc1
@itayjc1 10 ай бұрын
how come you're not resetting the flag after the blocking while loop?
@JoeBob189
@JoeBob189 9 ай бұрын
Because he's only doing one reading from the ADC. If you check his code, he never does another conversion. He is manually resetting the board to force another conversion. No need to reset the flag if it is only used once.
@muhammadabdullah5660
@muhammadabdullah5660 8 ай бұрын
Kindly tell that why we are pressing reset button to see new value, why don't we get new value automatically. I understood everything it was informative video but this Question kindly answer. Anyone can tell me i need the answer i am learning this.
@CEOPhiscape
@CEOPhiscape 3 ай бұрын
HAL_ADC_Start_DMA, the code responsible for taking reading is not inside the while loop. so it only takes the reading once. So maybe adding it inside the loop helps.
@woldecosgrove
@woldecosgrove Жыл бұрын
Nice video, can u share the code and instructions?
@whiteknighte
@whiteknighte Жыл бұрын
Please give me a link to the previous video on the stm32
@BINARYUPDATES
@BINARYUPDATES Жыл бұрын
Hi Whiteknighte, the video of Single channel ADC is in description section. Also, check entire playlist of STM32 Nucleo Board. Thanks!
@MohammedAltowayti
@MohammedAltowayti 10 ай бұрын
I'm using STM32 NUCLEO-F411RE chip... Can you help me write a code to make it capture an image using OV2640 and store it in pc folder?
@OndrejPopp
@OndrejPopp 11 ай бұрын
I haven't seen a schematic, but from the "wiring explanation" I got the impression that you are feeding the ADC input from 5V and not from 3V3. You have to be careful with that, because not every input of the micro controller is 5V tolerant.... And if you use one that is not, it may get damaged due to the 5V... So, actually I just checked on the stm32 forum : 5V tolerance does not apply to analog inputs at all, and you should not go beyond min(VDDA, VREF+) +0.3. VDDA and VREF+ are on the nucleo boards I have, Nucleo-743ZI2, equal to VDD_MCU which is dependent on a jumper setting and is either 3V3 or 1V8.... so be careful with that, and check the board schematic to see what VDDA and VREF+ actually are on your board, most likely 3V3 with the standard jumper setting like on the one I have.
@ahbushnell1
@ahbushnell1 10 ай бұрын
Good job. But slowwww down.
@BINARYUPDATES
@BINARYUPDATES 5 ай бұрын
Thank you! I'll incorporate your suggestions. Best wishes!
@azdinator
@azdinator 5 ай бұрын
This is awful.
@wavemusic6386
@wavemusic6386 Жыл бұрын
I have problem with line while(!convCompleted); this 'while' clause does not guard... [-Wmisleading-indentation] main.c This code working only one time. What can i do?
@BINARYUPDATES
@BINARYUPDATES Жыл бұрын
The code is written to print ADC value only once using Single conversion. So when we press RESET button then only next ADC conversion happen. It's because of the use of interrupt in code. if you make ADC conversion code in while loop then it will print continuously in continuous conversion mode instead of single conversion mode. I hope this may help you. Good luck and best wishes!
@OndrejPopp
@OndrejPopp 11 ай бұрын
Actually, while(!convCompleted); means : "loop until convCompleted becomes true", and there are no additional statements needed, and the semi-colon at the end means an "empty single statement". You can have a single statement after a control structure, such as a while or an if, without the need of curly braces {....} which is called a compound statement, if there is only one or an empty statement following it. So while(cond) stat; a control structure with a single statement, is equivalent to while(cond) {stat;} and while(cond); a control structure with an empty statement is equivalent to while(cond){}. This short form without the curly braces is more convenient to write, but can be ambiguous and a source of very subtle mistakes and that is why the compiler checks for this. For example while(cond) ; {.....} means : a while loop with an empty statement, (like in this code) followed by an "unguarded" compound statement. But maybe there is a typo in the code and what was actually meant was while(cond) {.... }. This can happen because while typing you are used to put a semi-colon at almost every line and so a mistake like this is easily made and very hard to track down. And that is why the compiler warns about this, because it can not know what was actually meant. But the construct here is correct, but writing it like while(!convCompleted){} is more readable and will silence the compiler ⚠️. P.S, because the compiler warns about "misleading identation" maybe if you write it like this, while(!convCompleted) ; So putting the semi-colon on the next line, and indent it, will silence the compiler as well. But you need to try that, most of the time "white space" is ignored so maybe this does not work, but using empty curly braces, so while(cond){} should always work.
1% vs 100% #beatbox #tiktok
01:10
BeatboxJCOP
Рет қаралды 67 МЛН
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН
Support each other🤝
00:31
ISSEI / いっせい
Рет қаралды 81 МЛН
STM32 ADC Complete Guidance: Polling, Interrupt, and DMA Modes.
17:55
How to use ADC in STM32 Microcontroller- Read Analog Sensor Value
17:32
stm32 adc dma with multi channel
5:24
CMTEQ Harware & Firmware
Рет қаралды 182
STM32 ADC #3. How to use ADC Multiple Channels || DMA Normal Mode
12:53
ControllersTech
Рет қаралды 2,3 М.
STM32 ADC MULTI CHANNEL without DMA || HAL || Poll
9:22
ControllersTech
Рет қаралды 48 М.
STM32C0 workshop - 06 ADC, DMA - effective data collection lab
15:41
STMicroelectronics
Рет қаралды 2,5 М.
STM32 ADC multiple channels || DMA || True studio || CubeMx
15:47
ControllersTech
Рет қаралды 71 М.
1% vs 100% #beatbox #tiktok
01:10
BeatboxJCOP
Рет қаралды 67 МЛН