Тёмный
No video :(

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

Mutex Embedded
Подписаться 22 тыс.
Просмотров 58 тыс.
50% 1

Опубликовано:

 

22 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 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 !!
@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!
@Graham1904
@Graham1904 4 года назад
Audio on max, headfones on loud and it is still quiet compared to other RU-vid videos. Great what you can hear
@fxasusnotebook
@fxasusnotebook 4 года назад
Thanks so much Mr. Muhammad you save my life by this video
@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
@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
@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
@malikjavadov366
@malikjavadov366 Год назад
this video is so crytal clear!
@joshuaplank883
@joshuaplank883 4 месяца назад
thanks this series has been really helpful! do you have any idea how to 'watch' variables in the new version?
@fabioalmeida4700
@fabioalmeida4700 2 года назад
Hello, great video. Congrats.
@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 :)
@m-jt7cd
@m-jt7cd 5 месяцев назад
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.
@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?
@rahulmoorkoth2395
@rahulmoorkoth2395 6 лет назад
Good job. keep doing!
@sinha....
@sinha.... 11 месяцев назад
I am getting "target is not responding, retrying " i am using stm32cubeide and my board is stm32l152c
@jonasmenondarosa2730
@jonasmenondarosa2730 5 лет назад
Thank you very much, you help me a lot.
@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
@lukaspetrikas6320
@lukaspetrikas6320 2 года назад
This same method does not seem to work on STM32L701
@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??
@electronicsguy8609
@electronicsguy8609 3 года назад
i dont quite know which pins of the joystick is connected to which pins of the stm32 board :/
@sugiyartosugiyarto1587
@sugiyartosugiyarto1587 Год назад
Sir make vidio. Input adc potensio.output pwm duty cycle..thanks
@R_M_20246
@R_M_20246 3 года назад
How would you convert the adc value to volts ? Having a hard time connecting a TMP36 sensor to a F4 board...
@mutexembedded2206
@mutexembedded2206 3 года назад
Hi Rayon, For 12bits adc, Volts = (value/4095) * 3.3V
@R_M_20246
@R_M_20246 3 года назад
@@mutexembedded2206 thanks for your quick response..Do you have any tutorial on interfacing the TMP36 temperature sensor?
@mutexembedded2206
@mutexembedded2206 3 года назад
@@R_M_20246 I don't. Shouldn't be hard
@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)
@alihafiz4695
@alihafiz4695 5 лет назад
thanks for this video
@KBera
@KBera 6 лет назад
Why 28 cycles for 8 bit resolution?
@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
@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?
@ZA-fo2rn
@ZA-fo2rn 4 года назад
how did u choose the adc clock ?
@ashwin372
@ashwin372 5 лет назад
can you give source code too only the main block...thanks for the tutorials
@ForceTranq
@ForceTranq 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?
@Karishma23-x1m
@Karishma23-x1m 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
@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.
Далее
HAL #12: ADC with IT
11:31
Просмотров 17 тыс.
Using I2C for any device on STM32 with HAL | VIDEO 26
37:51
DAC in STM32 || Sine wave || HAL || CubeIDE
16:07
Просмотров 65 тыс.
Stm32 ADC Pt:1 OverView
20:17
Просмотров 30 тыс.
HAL #13: ADC with DMA
10:15
Просмотров 41 тыс.