STM32CubeIDE basics - 10 ADC DMA TIM HAL lab

  Рет қаралды 58,675

STMicroelectronics

STMicroelectronics

4 жыл бұрын

Learn how to create your STM32 based application using STM32CubeIDE
STM32CubeIDE can be used to create applications for STM32 devices using STM32Cube libraries (HAL and Low Layer versions).
Benefits you will take away
• Understanding how to create Hardware Abstraction Layer (HAL) based examples on STM32 devices
• Understanding how to create Low Layer based examples on STM32
• Understanding how to manage software components and generated projects within STM32CubeIDE tool
Prerequisites
• NUCLEO-G071RB board
• microUSB cable
• PC with MS Windows OS (in version 7 or higher) with preinstalled the following software:
o STM32CubeIDE with STM32G0 Cube library preinstalled (libraries installation instruction present within “Repository management” video)
Complete set of slides:
drive.google.com/file/d/1qEyO...

Пікірлер: 36
@ilyachepurin3871
@ilyachepurin3871 9 ай бұрын
Couple of points for those who may run into some issues with following the exercise: 1. In a newer version of a HAL library call to the function HAL_ADCEx_Calibration_Start() requires another argument of ADC input configuration. For reading the temp sensor I use the following call: HAL_ADCEx_Calibration_Start(&hadc1, ADC_SINGLE_ENDED) 2. The function for starting the DMA requires second argument (pointer to the buffer) to be of the type uint32_t and in the exercise we define ADC_buffer[] as uint16_t. There are two workarounds: casting the value to be 32-bit: HAL_ADC_Start_DMA(&hadc1, (uint32_t*)&ADC_buffer, ADC_BUF_SIZE) Another way is to declare ADC_buffer[] as uint32_t, but then it is necessary to change DMA settings to send data in words and not half-words. 3. The example which is provided in the session stops DMA in HAL_ADC_ConvCpltCallback(). If you want to continue with measurements, you need to either delete the DMA stop call from here or restart DMA after processing data in the while() loop in main.
@facundonehuen_cs
@facundonehuen_cs 2 жыл бұрын
cant believe this is an official st video
@icollided
@icollided 6 ай бұрын
Very helpful video. Thank you.
@JorgeSilva-em8pf
@JorgeSilva-em8pf 4 жыл бұрын
The áudio quality might be better. It is whispering and with some pulsing into the Mic.
@Bianchi77
@Bianchi77 2 жыл бұрын
Nice video, keep it up, thank you :)
@edwardsoto3279
@edwardsoto3279 2 жыл бұрын
Ya lo optimice, quitándole las interrupciones del DMA y poniéndolo en continuo para hacer un muestreo de 1Mhz gracias, unos amos
@wesleydou337
@wesleydou337 10 ай бұрын
Thank you.
@pedrolealdossantos
@pedrolealdossantos 2 жыл бұрын
Hi. Thanks for a great series of tutorials. I've been using a Nucleo L053 for this. So far so good. However on last part of this tutorial, I always end up with an abort error from the HAL_ADC_DMA_Stop function: hdma->ErrorCode = HAL_DMA_ERROR_NO_XFER;. Hence it does not go to pre-processing part . Could you maybe pointing to what I may be doing wrong?
@stmicroelectronics
@stmicroelectronics 2 жыл бұрын
Hi there, thanks for your question - may we point you towards our community.st.com, where you will find a team of people who can answer you directly ?
@gtgarage
@gtgarage 3 жыл бұрын
I've been using NUCLEO-F446RE with this series of videos and it works fine. Some functions are not available but apparently incorporated into other functions. Only issue: At the '10 ADC DMA TIM HAL lab' I find I have no access to the LL_ADC functions as they are all grayed out. Is there some info or settings missing from the video to get these activated in the IDE? Just seems like there's a missing step or two. Can't seem to make it work. The LL .h and .c files are there, just not available.
@antoinenauzet1568
@antoinenauzet1568 3 жыл бұрын
Hello, same problem for me with a L073 MCU. I have check in the sources. and I do not know why, but stm32g0xx_hal_adc.h include stm32g0xx_ll_adc.h, while stm32l0xx_hal_adc.h does not include stm32l0xx_ll_adc.h (must be the same for yours MCU family) In fact, every informations I found is that HAL and LL should not be mixed. So I do not know why it is done (and even possible) in this example. Except to have a "nice example"?!
@gtgarage
@gtgarage 3 жыл бұрын
@@antoinenauzet1568 Yes, there are indications that we shouldn't use HAL and LL drivers together, BUT, it needs to be done to use the Temperature Conversion macro used in this video tutorial. I posted and searched on the ST site and had some help and also found some information. First, the manual for the chip or board has a section on using both drivers together and provides two ways to do it. First, add the USE_FULL_LL_DRIVER symbol to the C preprocessor configuration in CubeIDE. This didn't work for me for some reason. The other is to include the LL .h files in the main.h file. In this example they would be stm32f4xx_ll_adc.h and stm32f4xx_ll_rcc.h . This worked for me and generated the necessary LL files to make the example work. Another suggestion that I found was to go back into CubeMX and activate another ADC but check the box so no code is generated, then rebuild the file. This generated all of the LL driver files, not just the two files shown in the video, and this made all of the LL code accessible to the program. I'm not sure why the suggestions in the manual for the MCU didn't work as presented with the USE_FULL_LL_DRIVER symbol. I just assume that I have something configured incorrectly. No further response on the best way to do it from ST and no response from the presenter of the video.
@antoinenauzet1568
@antoinenauzet1568 3 жыл бұрын
@@gtgarage Indeed, after more research, I also found information about mixed HAL and LL used together. I tried to include the files in my main.h, but as they are not in the project (STM32CubeMX copy only used files in the project), it generate an error. Do you copy them manually?v For me, adding the USE_FULL_LL_DRIVER does not work either, again because the files ll are not included in the project. And I have only one ADC on my Micro, so I cannot use the other solution. Still searching!!
@gtgarage
@gtgarage 3 жыл бұрын
@@antoinenauzet1568 Yes, add the .h files for the LL drivers into the main.h file manually and make sure they are in the /* Private Includes */ section and between the /* USER CODE BEGIN Includes */ tags otherwise the lines will be removed the next time you rebuild the code.
@antoinenauzet1568
@antoinenauzet1568 3 жыл бұрын
@@gtgarage A little more information here: community.st.com/s/question/0D53W00000IpJGNSA3/how-to-have-both-hal-and-ll-driver-files-for-the-same-component?t=1600932250371 No possibility to have automatically HAL and LL for the same driver. You have to do it mannualy.
@smoua4588
@smoua4588 2 жыл бұрын
Does this do any good when setting up ADC and takes 30 minutes to do so.
@icnmamun
@icnmamun 4 жыл бұрын
hello, wondering if anyone can tell what do I need to do if I want to keep reading the temp sensor. thanks
@CircuitNinja
@CircuitNinja 3 жыл бұрын
If you stil need an answer, you can call HAL_ADC_Start_DMA(&hadc1, ADC_Buffer, ADC_BUF_SIZE) at the end of the callback function.
@mohammedbenhadine
@mohammedbenhadine 3 жыл бұрын
@STMicro tmin of the temp sensor is 5us and Tmin(ADC config) = 79.5*0.125 = 9us , the minimal value is 5us to sample temp sensor , we should go faster than that , not slower with 9us !!!
@mohammedbenhadine
@mohammedbenhadine 3 жыл бұрын
@Virtex AlphaThanks
@merveozdas1193
@merveozdas1193 Жыл бұрын
Do we need to make conversion continuous?if not, why?
@merveozdas1193
@merveozdas1193 Жыл бұрын
if I use DMA with Adc , Don't I need to use ADC_GetValye and poll_for_conversion?
@airheadbit1984
@airheadbit1984 3 жыл бұрын
With STM32Cube_FW_G0_V1.4.1 and CubeIDE V1.6.0 the ADC DMA TIM HAL Line ~50 uint16_t causes a warning unless changed to uint32_t. With or without that during the debug session I never hit the break at line 304: void HAL_ADC_ConvCpltCallBack(ADC_HandleTypeDef* hadc) - it reads the ADC but never does the break point. The basics videos need to be redone with the current CubeIDE and professional sound engineers, if the CC doesn't work that is a good indication of sound issues.
@stmicroelectronics
@stmicroelectronics 3 жыл бұрын
Hi there, thanks for your question - may we point you towards our community.st.com, where you will find a team of people who can answer you directly ?
@duythongnguyen5038
@duythongnguyen5038 3 жыл бұрын
The break point is never hit because your function's name is not exactly (case sensitive) the same name as the function in the HAL library (...Callback and not ...CallBack as in your case). The HAL framework defines a __weak function in its library (search the file ...hal_adc.c) and then calls it whenever the ADC conversion is completed. Your work in the main code is to redefine (and thus override) this function to implement the logic of your application, in this case HAL_ADC_Stop_DMA(&hadc1). If you analyze the main function, you can see that it never explicitly call the HAL_ADC_ConvCpltCallback function. The function is still called indirectly (through the interrupt mechanism, I guess). When you write your ...CallBack function it does not override ...Callback function because of case sensitive and the compiler recognizes it as a new function and does not throw error when compiling. However, this function is never called in the main function and that is why you never hit the break.
@marcinmorawski3598
@marcinmorawski3598 2 жыл бұрын
You probably figured it out by yourself by now but I will leave this comment here for other people as there is no explanation in the video. The ADC buffer type really should be uint32_t to not trigger compilation warnings but in order this to work you have to change the configuration of the DMA in ADC1. Particularly the Data Width on Memory side should be changed from Half Word to Word. Then there are no warnings after compilation and the temperature values are measured correctly.
@pranjal3727
@pranjal3727 3 жыл бұрын
I'm confused how to get it done for multichannel adc. Like i only need one conversion per channel and i have 3 channel. So the destination buffer should be size[3] OR the will be a two dimensional array with size[3][1] Can anyone help.
@stmicroelectronics
@stmicroelectronics 3 жыл бұрын
Hi there, thanks for your question - may we point you towards our community.st.com, where you will find a team of people who can answer you directly ?
@kebabsharif9627
@kebabsharif9627 3 жыл бұрын
Hello please Tell the difference between RESET (UG bIt FROM TIMx_EGR) AND UPDATE EVENT because it seems both are the same.Thank you in advance
@stmicroelectronics
@stmicroelectronics 3 жыл бұрын
Hello, Visit our online community to find answers to your technical questions and share ideas with your developers and ST experts : community.st.com
@peterdvorak802
@peterdvorak802 4 жыл бұрын
Nice video. The documentation "10 ADC DMA TIM HAL lab.pdf" is incomplete
@gtgarage
@gtgarage 3 жыл бұрын
would you be referring to the availability of the LL driver macros?
@DeLaCruzer11
@DeLaCruzer11 Жыл бұрын
Cant even see the code. Atleast increase the font size or use the zoom feature of the screen recorder. And the audio is low and wisphering sometimes.
@chazcal
@chazcal 2 ай бұрын
try using AI for your voice next time
STM32CubeIDE basics - 11 USART HAL lab
10:55
STMicroelectronics
Рет қаралды 61 М.
STM32CubeIDE basics - 12 FreeRTOS basic lab
32:39
STMicroelectronics
Рет қаралды 27 М.
Smart Sigma Kid #funny #sigma #comedy
00:25
CRAZY GREAPA
Рет қаралды 8 МЛН
small vs big hoop #tiktok
00:12
Анастасия Тарасова
Рет қаралды 27 МЛН
Жайдарман | Туған күн 2024 | Алматы
2:22:55
Jaidarman OFFICIAL / JCI
Рет қаралды 1,5 МЛН
Haha😂 Power💪 #trending #funny #viral #shorts
00:18
Reaction Station TV
Рет қаралды 15 МЛН
STM32CubeIDE basics - 05 TIM PWM HAL lab
13:37
STMicroelectronics
Рет қаралды 61 М.
STM32C0 workshop - 06 ADC, DMA - effective data collection lab
15:41
STMicroelectronics
Рет қаралды 2,1 М.
STM32 Multi ADC DMA method
29:42
PR TechTalk
Рет қаралды 4,1 М.
stm32 timed multichannel ADC DMA conversions on STM32F030k6
12:06
STM32CubeMX basics: 10.11 STM32Cube HAL labs UART - UART DMA
16:14
STMicroelectronics
Рет қаралды 29 М.
STM32 Guide #4: Generated Code, HAL, and Bare Metal
26:20
Mitch Davis
Рет қаралды 77 М.
STM32 PWM basics
18:31
Random Rick
Рет қаралды 19 М.
Will the battery emit smoke if it rotates rapidly?
0:11
Meaningful Cartoons 183
Рет қаралды 40 МЛН
iPhone 16 с инновационным аккумулятором
0:45
ÉЖИ АКСЁНОВ
Рет қаралды 1 МЛН
GamePad İle Bisiklet Yönetmek #shorts
0:26
Osman Kabadayı
Рет қаралды 134 М.
Simple maintenance. #leddisplay #ledscreen #ledwall #ledmodule #ledinstallation
0:19
LED Screen Factory-EagerLED
Рет қаралды 12 МЛН