STM32 Nucleo - Keil 5 IDE with CubeMX: Tutorial 3 - ADC Single mode multi-channel

  Рет қаралды 57,508

Mutex Embedded

Mutex Embedded

6 жыл бұрын

Пікірлер: 64
@MclarenF1rocket
@MclarenF1rocket 4 жыл бұрын
My past experience has been in electronics design, but my current role involves writing firmware for STM32 MCUs - your videos have been incredibly helpful, thank you!!
@MclarenF1rocket
@MclarenF1rocket 4 жыл бұрын
super helpful - got my ADC up and running in no time, thanks !!
@justintaylor2482
@justintaylor2482 4 жыл бұрын
Thank you Sir for some really great building blocks!!!
@anannyaguha9487
@anannyaguha9487 6 жыл бұрын
I am so happy that I learnt a lot from it. Thank You so very much
@artsrunmargaryan2920
@artsrunmargaryan2920 5 жыл бұрын
When you are working with cubemx, after changing something in cube and regenerating the project don't forget to delete sConfig declaration from MX_ADC1_Init function. Because even it keeps your global variable but also generating it in MX_ADC1_Init scope. So you'll have 2.
@MrVouligny
@MrVouligny 2 жыл бұрын
thank you soooo much for this comment!
@silsilah-naqshband
@silsilah-naqshband 6 жыл бұрын
Very nice explanation. Please keep it up. And thank you so much for sharing your knowledge. It really helps a lot.
@mutexembedded2206
@mutexembedded2206 6 жыл бұрын
Abdul Rehman Thanks Abdul
@fxasusnotebook
@fxasusnotebook 4 жыл бұрын
Thanks so much Mr. Muhammad you save my life by this video
@Graham1904
@Graham1904 4 жыл бұрын
Audio on max, headfones on loud and it is still quiet compared to other KZfaq videos. Great what you can hear
@mc3359
@mc3359 4 жыл бұрын
At 3:17, the term "sampling time" is misleading. This is actually referring to sample & hold (S&H) time of ADC's front-end . S&H time allows the S&H circuit to charge up the internal capacitor (usually in few pf) as much as possible to minimize amplitude error. The time required is usually 10x to 20x of RC time constant, where R is the external source impedance and C is the internal S&H capacitance. Whereas the ADC Clock cycles are referring to number of cycles required for the ADC logic to convert the analog value of capacitor to digital value. For SAC (successive approximation converter) it is at least 1 cycle per bit. So, sampling time and ADC cycles are two different concepts.
@mutexembedded2206
@mutexembedded2206 4 жыл бұрын
Hi, You are correct
@rahulmoorkoth2395
@rahulmoorkoth2395 6 жыл бұрын
Good job. keep doing!
@fabioalmeida4700
@fabioalmeida4700 2 жыл бұрын
Hello, great video. Congrats.
@malikjavadov366
@malikjavadov366 Жыл бұрын
this video is so crytal clear!
@jonasmenondarosa2730
@jonasmenondarosa2730 5 жыл бұрын
Thank you very much, you help me a lot.
@RanCohenDrummer
@RanCohenDrummer 2 жыл бұрын
Thank you!!
@ElectricMilesLLC
@ElectricMilesLLC 4 жыл бұрын
YOU JUST EARNED YOURSELF ANOTHER SUBSCRIBER. HAHA, IM STIL IN CAPS FROM TYPING ALL OF THE HAL_ FUNCTIONS.
@mutexembedded2206
@mutexembedded2206 4 жыл бұрын
Hi! Enjoy :)
@joshuaplank883
@joshuaplank883 2 ай бұрын
thanks this series has been really helpful! do you have any idea how to 'watch' variables in the new version?
@alihafiz4695
@alihafiz4695 5 жыл бұрын
thanks for this video
@haiderattar857
@haiderattar857 3 жыл бұрын
Thanks for this video. However, I believe the Joystick you used is a 5vdc. The STM32 is 3.3v. Won't this cause a damage? Have you used a voltage divider?
@mekbots7607
@mekbots7607 3 жыл бұрын
I did same ,first Chanel is ok ,when I add second Chanel,both Chanel get same data with first Chanel pot
@dajianghe
@dajianghe 2 жыл бұрын
STM G4 chip has OPAMP. Have you done any intro of combining OPAMP with ADC?
@shujaulhind3877
@shujaulhind3877 6 жыл бұрын
YOUR VIDEOS ARE QUITE AWESOME I LEARNED A LOT. CAN U PLEASE TELL ME WHICH PINS TO CONNECT TO JOYSTICK AND IF JOYSTICK IS NOT AVAILABLE WHAT ELSE CAN I USE IN ITS PLACE
@mutexembedded2206
@mutexembedded2206 6 жыл бұрын
Hi, You can use a Potentiometer (Variable resistor)
@ZA-fo2rn
@ZA-fo2rn 4 жыл бұрын
how did u choose the adc clock ?
@KBera
@KBera 6 жыл бұрын
Why 28 cycles for 8 bit resolution?
@lukaspetrikas6320
@lukaspetrikas6320 2 жыл бұрын
This same method does not seem to work on STM32L701
@sinha....
@sinha.... 10 ай бұрын
I am getting "target is not responding, retrying " i am using stm32cubeide and my board is stm32l152c
@monroekass
@monroekass 6 жыл бұрын
The values that are reading from the ADC channels, where are they coming from?
@mutexembedded2206
@mutexembedded2206 6 жыл бұрын
Hi mate, Thumb Joystick Analog Input (X and Y), Mentioned that at 00:30
@artemmishenko2450
@artemmishenko2450 5 жыл бұрын
What pins do you use on the board for x and y?
@electronicsguy8609
@electronicsguy8609 3 жыл бұрын
i dont quite know which pins of the joystick is connected to which pins of the stm32 board :/
@m-jt7cd
@m-jt7cd 3 ай бұрын
Hey, if you dont mind, id have a question concerning this topic. Currently i am working on a project using stm32 and an ADS131 ADC (TexasInst). After developing and designing a pcb for this project i have to code the communication between ADC and MCU. I have basic C knowledge and very very basic (barely no xd) knowledge in programming MCUs. if you generate code from cubeMX, many files (main.c, stmxy.c, main.h, etc.) are created. It is pretty hard for me to see through this. I have some specific expectations for the communication (e.g. 10Hz, i want a timestamp (if possible?)). So, maybe you have any suggestions or help for me to get the software done.
@ashwin372
@ashwin372 5 жыл бұрын
can you give source code too only the main block...thanks for the tutorials
@AkbarRajaei
@AkbarRajaei 5 жыл бұрын
excellent. please change the title name as ADC Single mode_Multiple channel
@mutexembedded2206
@mutexembedded2206 5 жыл бұрын
Will do :)
@AkbarRajaei
@AkbarRajaei 5 жыл бұрын
@@mutexembedded2206 :-D
@Varsha_Art_craft_world
@Varsha_Art_craft_world 5 жыл бұрын
how to connect external hx701b adc with stm32f2 nucleo board...plzz tell me
@artsrunmargaryan2920
@artsrunmargaryan2920 5 жыл бұрын
When you are using hx7** you don't need to activate stm32 ADC. but you'll need configure two GPIO-s something like this github.com/freakone/HX711
@vishaalvishaal2118
@vishaalvishaal2118 2 жыл бұрын
Hello, I want 6 channels to configure can I do in single conversion mode?? and am using rtos one task will take acd0,adc1 and other task adc2,adc3 and other task for adc4,adc5 as i am using rtos, task switching takes place so can I configure randomly any channel and get the value of adc??
@sugiyartosugiyarto1587
@sugiyartosugiyarto1587 Жыл бұрын
Sir make vidio. Input adc potensio.output pwm duty cycle..thanks
@R_M_20246
@R_M_20246 2 жыл бұрын
How would you convert the adc value to volts ? Having a hard time connecting a TMP36 sensor to a F4 board...
@mutexembedded2206
@mutexembedded2206 2 жыл бұрын
Hi Rayon, For 12bits adc, Volts = (value/4095) * 3.3V
@R_M_20246
@R_M_20246 2 жыл бұрын
@@mutexembedded2206 thanks for your quick response..Do you have any tutorial on interfacing the TMP36 temperature sensor?
@mutexembedded2206
@mutexembedded2206 2 жыл бұрын
@@R_M_20246 I don't. Shouldn't be hard
@AkbarRajaei
@AkbarRajaei 5 жыл бұрын
I did exactly like u, for 2 channel but in my case for ADC_CHANNEL_TEMPSENSOR and another one for a potentiometer. Configs for swapping between channels is like u but, it stays on the second channel. But actually, I use the STM32F072VB. does it matter ?
@mutexembedded2206
@mutexembedded2206 5 жыл бұрын
Hi Sayed, Do you still encounter the problem? Should not matter, but the only difference is that the F072 has 1 ADC,but still 16 channels.
@AkbarRajaei
@AkbarRajaei 5 жыл бұрын
@@mutexembedded2206 hi dude, thanks for the response. Unfortunately yes. This is my code sConfig.Channel = ADC_CHANNEL_16; HAL_ADC_ConfigChannel(&hadc, &sConfig); HAL_ADC_Start(&hadc); if (HAL_ADC_PollForConversion(&hadc, 5) == HAL_OK){ V1 = HAL_ADC_GetValue(&hadc); } sConfig.Channel = ADC_CHANNEL_10; HAL_ADC_ConfigChannel(&hadc, &sConfig); HAL_ADC_Start(&hadc); if (HAL_ADC_PollForConversion(&hadc, 5) == HAL_OK){ V2 = HAL_ADC_GetValue(&hadc); } HAL_Delay(50);
@AkbarRajaei
@AkbarRajaei 5 жыл бұрын
@@mutexembedded2206 and the configs /* ADC init function */ static void MX_ADC_Init(void) { __HAL_RCC_ADC1_CLK_ENABLE(); /**Configure the global features of the ADC (Clock, Resolution, Data Alignment and number of conversion) */ hadc.Instance = ADC1; hadc.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1; hadc.Init.Resolution = ADC_RESOLUTION_12B; hadc.Init.DataAlign = ADC_DATAALIGN_RIGHT; hadc.Init.ScanConvMode = ADC_SCAN_DIRECTION_FORWARD; hadc.Init.EOCSelection = ADC_EOC_SINGLE_CONV; hadc.Init.LowPowerAutoWait = DISABLE; hadc.Init.LowPowerAutoPowerOff = DISABLE; hadc.Init.ContinuousConvMode = DISABLE; hadc.Init.DiscontinuousConvMode = DISABLE; hadc.Init.ExternalTrigConv = ADC_SOFTWARE_START; hadc.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE; hadc.Init.DMAContinuousRequests = DISABLE; hadc.Init.Overrun = ADC_OVR_DATA_PRESERVED; if (HAL_ADC_Init(&hadc) != HAL_OK) { _Error_Handler(__FILE__, __LINE__); } /**Configure for the selected ADC regular channel to be converted. */ sConfig.Channel = ADC_CHANNEL_10; sConfig.Rank = ADC_RANK_CHANNEL_NUMBER; sConfig.SamplingTime = ADC_SAMPLETIME_239CYCLES_5; //ADC_SAMPLETIME_1CYCLE_5; if (HAL_ADC_ConfigChannel(&hadc, &sConfig) != HAL_OK) { _Error_Handler(__FILE__, __LINE__); } /**Configure for the selected ADC regular channel to be converted. */ sConfig.Channel = ADC_CHANNEL_TEMPSENSOR; if (HAL_ADC_ConfigChannel(&hadc, &sConfig) != HAL_OK) { _Error_Handler(__FILE__, __LINE__); } }
@AkbarRajaei
@AkbarRajaei 5 жыл бұрын
@@mutexembedded2206 actually, at the beginning when I execute it, it works correctly, I have two different and correct data for both channels. But the second time, when I want to read the new data, both channels have the previous data which are actually the data of channel number 2. So for me, it means that it is still on channel 2 !!!! Is it clear? Did u get what I mean?
@GD_902
@GD_902 4 жыл бұрын
Hello MYaqoob, first of all thank you very much for this detailed tutorial. I am using a STM32 Nucleo F446RE and a joystick module to test the ADC functionality. The code works fine for me with no warnings or errors. However I have a doubt which I hope you could clarify. While debugging, I've added both adcVal0 & adcVal1 to watch windows 1 & 2 respectively. Now when I operate the thumb of the joystick both windows display the same values in whichever direction the thumb is moved. But in your case while you were demonstrating I observed that values were not the same. Why do both my Watch Windows show the same values? Thanks once again & awaiting your reply. Gautam
@mutexembedded2206
@mutexembedded2206 4 жыл бұрын
Hi Gautam, Could be channel number or GPIO setting of the other ADC input. There is a much easier way to do this too. You can to the sequencer and get two values from 2 different channels convert sequentially
@GD_902
@GD_902 4 жыл бұрын
@@mutexembedded2206 So I must use one adc channel for the x axis and another adc channel for the y axis? And then convert the values?
@mutexembedded2206
@mutexembedded2206 4 жыл бұрын
@@GD_902 yes. If you would look at my video on ADC Multi channel ADC
@GD_902
@GD_902 4 жыл бұрын
@@mutexembedded2206 Okay I will go through that tutorial. I'm going through your tutorials one by one and thank you for your prompt reply. I shall definitely follow up on this topic once I implement your suggestions. Best regards Gautam Dhargalkar
@mutexembedded2206
@mutexembedded2206 4 жыл бұрын
Enjoy
@kalamabidin922
@kalamabidin922 Жыл бұрын
please help how to solve this STMicroelectronics ST-LINK GDB server. Version 7.0.0 Copyright (c) 2022, STMicroelectronics. All rights reserved. Starting server with the following options: Persistent Mode : Disabled Logging Level : 1 Listen Port Number : 61234 Status Refresh Delay : 15s Verbose Mode : Disabled SWD Debug : Enabled InitWhile : Enabled Target no device found Error in initializing ST-LINK device. Reason: No device found on target.
@kalamabidin922
@kalamabidin922 Жыл бұрын
STMicroelectronics ST-LINK GDB server. Version 7.0.0 Copyright (c) 2022, STMicroelectronics. All rights reserved. Starting server with the following options: Persistent Mode : Disabled Logging Level : 1 Listen Port Number : 61234 Status Refresh Delay : 15s Verbose Mode : Disabled SWD Debug : Enabled InitWhile : Enabled Target no device found Error in initializing ST-LINK device. Reason: No device found on target.
STM32 Nucleo - Keil 5 IDE with CubeMX: Tutorial 4 - ADC Multi mode
12:05
STM32-Nucleo - Keil 5 IDE with CubeMX: Tutorial 9 - FreeRTOS
13:58
Mutex Embedded
Рет қаралды 46 М.
Who has won ?? 😀 #shortvideo #lizzyisaeva
00:24
Lizzy Isaeva
Рет қаралды 61 МЛН
WHO LAUGHS LAST LAUGHS BEST 😎 #comedy
00:18
HaHaWhat
Рет қаралды 20 МЛН
Smart Sigma Kid #funny #sigma #comedy
00:25
CRAZY GREAPA
Рет қаралды 23 МЛН
STM32 ADC MULTI CHANNEL without DMA || HAL || Poll
9:22
ControllersTech
Рет қаралды 43 М.
Using I2C for any device on STM32 with HAL | VIDEO 26
37:51
Matej Blagšič
Рет қаралды 74 М.
STM32 Nucleo - Keil 5 IDE with CubeMX: Tutorial 6 - SPI Interface
10:56
HAL #13: ADC with DMA
10:15
Web learning
Рет қаралды 40 М.
STM32 Nucleo - Keil 5 IDE with CubeMX: Tutorial 7 - I2C interface
10:26
DAC in STM32 || Sine wave || HAL || CubeIDE
16:07
ControllersTech
Рет қаралды 64 М.
ADC in STM32 || Single Channel || Keil
16:08
ControllersTech
Рет қаралды 33 М.
STM32CubeIDE basics - 10 ADC DMA TIM HAL lab
31:32
STMicroelectronics
Рет қаралды 58 М.
Как правильно выключать звук на телефоне?
0:17
Люди.Идеи, общественная организация
Рет қаралды 1 МЛН
Опыт использования Мини ПК от TECNO
1:00
Андронет
Рет қаралды 783 М.