STM32F4 Discovery board - Keil 5 IDE with CubeMX: Tutorial 18 Timers - Input Capture

  Рет қаралды 25,951

Mutex Embedded

Mutex Embedded

Күн бұрын

Пікірлер: 49
@bernardmercier5984
@bernardmercier5984 4 жыл бұрын
Hello, by far the best tutorials on STM32 peripherals! Thank you so much.
@mutexembedded2206
@mutexembedded2206 4 жыл бұрын
Cheers Bernard
@sameenashaikh_29
@sameenashaikh_29 7 жыл бұрын
Hi, Finally a new video from you! Happy about it! Was waiting for this
@cosmoalien12345
@cosmoalien12345 4 жыл бұрын
Thanks , your videos have helped in many projects
@sayo9394
@sayo9394 6 жыл бұрын
Great tutorial, the non-cube part of it was extremely useful, thank you. It would be great if we can access the code itself, maybe a github repo
@mutexembedded2206
@mutexembedded2206 6 жыл бұрын
Simon Ayoub I completely forgot to attach the src code here, I said I will do that in the video, thanks for the reminder Simon!
@alexdex9439
@alexdex9439 3 жыл бұрын
How can I perform input capture from the output of a comparator?
@halukcakir5279
@halukcakir5279 3 жыл бұрын
When i compile, i am getting a error error: Description Resource Path Location Type invalid type argument of '->' (have 'TIM_HandleTypeDef' {aka 'struct '}) stm32g4xx_hal_tim.h /12_Input_Capture_G474_02/Drivers/STM32G4xx_HAL_Driver/Inc line 1551 C/C++ Problem Can you help me?
@youngolutosin1658
@youngolutosin1658 5 жыл бұрын
Thank you so much Yaqoob your video has really helped me alot and has improved the time it takes me to implement my project. I am working on an algorithm and wanted to test if the heart rate algorithm is efficient and accurate. I decided to use an analog heart pulse sensor, convert the value using 8 bits and the digital value will be fed to the a digital pin with timer input compare. Everytime there is a rising edge, the time will be logged and this will be viewed on oscilloscope and how many beats in one minute will be calculated. Kindly help me look into this approach or how can I implement this? Thank you.
@thanhthonguyen6171
@thanhthonguyen6171 5 жыл бұрын
hi, bro. I want to know maximum of the input frequency can be measured. I will use STM32F4 to measure input signal with frequency of about 30Mhz. Can it be measured? thank you!!!
@mutexembedded2206
@mutexembedded2206 5 жыл бұрын
Hi, Potentially.. I have not tried it yet. Give it a try yourself following all guidelines.
@thanhthonguyen6171
@thanhthonguyen6171 5 жыл бұрын
thank bro! I will come back when I find the results, cheer!!!
@serdarbatkan1414
@serdarbatkan1414 3 жыл бұрын
Hello, How can we read( decode) PPm signal ?
@abdulkhan-rd8lu
@abdulkhan-rd8lu 6 жыл бұрын
great video thanks for sharing, i got a question can we use hrtim(high resolution timer) for input capture and get psec resolution???????
@mutexembedded2206
@mutexembedded2206 6 жыл бұрын
Hi Abdul, I don't know I am afraid, I haven't tried it with HRTIM before. I will be interested to know if you had a success with this.
@abdulkhan-rd8lu
@abdulkhan-rd8lu 6 жыл бұрын
Hi MR.MYaqoob' thanks for the reply the datasheet says resolution in p sec but i was only able to capture the input events twice the speed of timer a.b,c with HRTIM but not psec any help would be appreciated by the way i m using discover stm32f334c8
@arifkhan-xs5nk
@arifkhan-xs5nk 4 жыл бұрын
can we display the value of countval on the lcd display
@mutexembedded2206
@mutexembedded2206 4 жыл бұрын
Yes, you can
@ThinkElectronicCircuits
@ThinkElectronicCircuits 6 жыл бұрын
Is it possible to measure the duration for which the pulse is High by Timer input capture?
@mutexembedded2206
@mutexembedded2206 6 жыл бұрын
Hi, Yes, you can do that. Need to start counter at rising edge and stop at falling, if you know when the pulse will start, it is easy such as with Ultrasonic module. Hope this helps.
@MO_Ventures710
@MO_Ventures710 6 жыл бұрын
HI Yaqoob..I want to interface tcs3200 color sensor with STM32f746zg..Since the tcs3200 outputs a frequency based on the amount of light received i need some way to measure time. There is one output, which I connected to the input of as Input Capture.i am having some problems as i just started working on controllers.can you give me some hint or any kind of help to do this..thanks
@mutexembedded2206
@mutexembedded2206 6 жыл бұрын
Asim A Qayyum Hi Asim, You first need to know the frequency range of the output of your sensor (e.g. 1Khz to 50 khz) .. then configure an IC timer to calculate the time between two consecutive rising edge or falling edges,, and make the timer period long enough (e.g. 5 seconds), so that you start the IC timer for few seconds and get some measurement and stop the timer before the end of the 5 seconds to avoid overlap. Hope this helps
@MO_Ventures710
@MO_Ventures710 6 жыл бұрын
Hi Yaqoob. In CubeMx i set PF6(s0) PF7(s1) PF8(s2) PF9(s3) and TIM2 ch1 input capture as (out) of the sensor.frequncy for timer 2 i selected is 84Mhz with prescalar 83 which will bring it to 1mhz(i am not sure whether i should do this or not)I also enabled tim2 globle interrupt in nvic window.next i activated timer6 to measure time of 5s(timer f=84mhz,prescalar=41999 and counterperiod = 9999)..I have doubt about how to use these two timers inside the while loop, which HAL library functions to use here and how to use. CubeMX is the source code generator and IDE is Kiel5. following is my setting for output frequency scaling and filtertype outside the main function.if i am wrong please correct me. void TCSFREQ() { HAL_GPIO_WritePin(GPIOF, s0_Pin,GPIO_PIN_SET); HAL_GPIO_WritePin(GPIOF, s1_Pin,GPIO_PIN_RESET); } void TCSRED() { HAL_GPIO_WritePin(GPIOF, s2_Pin,GPIO_PIN_RESET); HAL_GPIO_WritePin(GPIOF, s3_Pin,GPIO_PIN_RESET); } void TCSBLUE() { HAL_GPIO_WritePin(GPIOF, s2_Pin,GPIO_PIN_RESET); HAL_GPIO_WritePin(GPIOF, s3_Pin,GPIO_PIN_SET); } void GREEN() { HAL_GPIO_WritePin(GPIOF, s2_Pin,GPIO_PIN_SET); HAL_GPIO_WritePin(GPIOF, s3_Pin,GPIO_PIN_SET); } void TCSCLEAR() { HAL_GPIO_WritePin(GPIOF, s2_Pin,GPIO_PIN_SET); HAL_GPIO_WritePin(GPIOF, s3_Pin,GPIO_PIN_RESET); }
@mutexembedded2206
@mutexembedded2206 6 жыл бұрын
Asim A Qayyum Hi Asim, If you are just trying to measure time period of the light sensor signal,, then one timer as IC will do the job. As I explained earlier, You need to set an input capture just like in my video above but with different prescalar and period.
@rohitpatil4785
@rohitpatil4785 6 жыл бұрын
Hello sir, I will try without cubemx Input capture code,but its showing following two errors, do you know why it happen? Please help me for this, .\Frequency Reading Wiithout Cube.axf: Error: L6218E: Undefined symbol HAL_DMA_Abort (referred from stm32f4xx_hal_tim.o). .\Frequency Reading Wiithout Cube.axf: Error: L6218E: Undefined symbol HAL_DMA_Start_IT (referred from stm32f4xx_hal_tim.o). Thanks
@rohitpatil4785
@rohitpatil4785 6 жыл бұрын
Could you please send me your project file?
@pablogonzalezvizuete140
@pablogonzalezvizuete140 6 жыл бұрын
Hi Mohamed. Thank you for your videos in general, I'm learning to program microcontrolers with them! Very instructive that you include with and without Cube. I'm trying the code without Cube and I don't know why the program doesn't enter HAL_TIM_IC_CaptureCallback. Could you please send the link for your code? Thanks!
@mutexembedded2206
@mutexembedded2206 6 жыл бұрын
Pablo González Vizuete Hi Pablo, Good to know that you're finding them helpful.. Yes, will do. I will attach the main.c shortly. Good luck
@mutexembedded2206
@mutexembedded2206 6 жыл бұрын
Just updated it,, now you should be able to see the main.c file down in the description. Cheers
@pablogonzalezvizuete140
@pablogonzalezvizuete140 6 жыл бұрын
Thank you! I finally found out my error (a letter missing in my code in the name of SysTick_Handler :)) Cheers
@vikrantthakur7482
@vikrantthakur7482 5 жыл бұрын
My system hangs completely when I use an input capture button method using STM Discovery whenever a high signal is given,it completely hangs
@mutexembedded2206
@mutexembedded2206 5 жыл бұрын
Hi, Do you have a HAL_Delay inside the TIM_IC callback function ?
@vikrantthakur7482
@vikrantthakur7482 5 жыл бұрын
@@mutexembedded2206 No actually, I just found out by mistake I commented out interrupt handler. Now it's working fine thanks for your video and help Yaqoob. I am trying to read the duration of the digital pulse produced by my heartbeat sensor(in place of the button).
@mutexembedded2206
@mutexembedded2206 5 жыл бұрын
@@vikrantthakur7482 Great
@youngolutosin1658
@youngolutosin1658 5 жыл бұрын
@@vikrantthakur7482 I wanted to achieve the same thing too: here is my approach, the output of my digital sensor will be connected to digital input with input compare enabled and using rising edge and logging the time for every rising edge just like the case of button but here the rising edge will be generated by the digital sensor when there is heart pulse. I will log this using oscilloscope and will calculate low how many beats I have in 60 seconds. Kindly share how you implemented yours mine was just a thought approach. I have not implemented it yet. Thank you Yaqoob and Thakur.
@IPridek
@IPridek 4 жыл бұрын
How i can start learning these parts of the MCU , some reference or book? Thanks
@paulopecegueiro1694
@paulopecegueiro1694 4 жыл бұрын
Mastering STM32 is a good one to start
@michaelcollins399
@michaelcollins399 6 жыл бұрын
So how exactly does the prescaler value correlate with the actual time passed? thanks
@mutexembedded2206
@mutexembedded2206 6 жыл бұрын
Michael Collins Hi, Prescalar will scale CNT clock speed say to 1KHz (i.e. T = 1ms). Thus each Input Capture Counter correspond to 1ms. So for 230 IC value = 230ms between start and Rising edge detection.
@michaelcollins399
@michaelcollins399 6 жыл бұрын
How will changing the prescaler value to 16000, scale the CNT clock speed to 1kHz? Thanks for the swift reply and I really enjoy your very well made videos.
@mutexembedded2206
@mutexembedded2206 6 жыл бұрын
Michael Collins Because TIM2 is driven by APB1 Clock whose frequency is 16MHz.
@amitchautmal
@amitchautmal 4 жыл бұрын
Sir please demonstrate timer in one pulse mode . Using stm32f103 .thanks
@javib8970
@javib8970 5 жыл бұрын
for anyone having problems wih the HAL macros this works: void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim) { /* Prevent unused argument(s) compilation warning */ UNUSED(htim); /* NOTE : This function Should not be modified, when the callback is needed, the __HAL_TIM_IC_CaptureCallback could be implemented in the user file */ if(htim->Instance == TIM2){ inputCaptureVal = htim2.Instance->CNT; htim2.Instance->CNT=0; } }
@VarunKumar-gx7sd
@VarunKumar-gx7sd 5 жыл бұрын
Hi Do you have direct register access code for basic timer interrupt??
@VarunKumar-gx7sd
@VarunKumar-gx7sd 5 жыл бұрын
As I am new to the board want to learn from base
@bkn6362
@bkn6362 3 жыл бұрын
Writing directly into the library functions is just a no-no.
@vladik8843
@vladik8843 3 жыл бұрын
Be careful when using __HAL_TIM_GET_COUNTER(). ITs expecting &htim not htim.
@aye685
@aye685 6 жыл бұрын
Hello , How can I count the pulse numbers of PWM signal ?
@mutexembedded2206
@mutexembedded2206 6 жыл бұрын
Hi mate, Use ETR TIM input mode, I haven't made a tutorial on this yet. Will be good one for coming tutorials. Wish I have spare time.
Ouch.. 🤕⚽️
00:25
Celine Dept
Рет қаралды 18 МЛН
Who’s the Real Dad Doll Squid? Can You Guess in 60 Seconds? | Roblox 3D
00:34
Don't look down on anyone#devil  #lilith  #funny  #shorts
00:12
Devil Lilith
Рет қаралды 47 МЛН
龟兔赛跑:好可爱的小乌龟#short #angel #clown
01:00
Super Beauty team
Рет қаралды 67 МЛН
Principles of Beautiful Figures for Research Papers
1:01:14
ChuScience
Рет қаралды 65 М.
Ouch.. 🤕⚽️
00:25
Celine Dept
Рет қаралды 18 МЛН