STM32F4 Discovery board - Keil 5 IDE with CubeMX: Tutorial 5 ADC TIM Trigger - Updated Nov 2017

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 พ.ย. 2024

ความคิดเห็น • 36

  • @linghaozhou4695
    @linghaozhou4695 5 ปีที่แล้ว +3

    Thank you very much for uploading the video, it is very helpful! I do have a question though - what are the differences between using TIM to setup the real ADC sampling rate, or using continuous ADC mode but set the sampling cycles? If they are the same then which one do you recommend or prefer?
    Thanks!

  • @kaaneren4996
    @kaaneren4996 6 ปีที่แล้ว +5

    Hey! thanks for this perfect tutorial. I have question. You are defining (copying) the callback function in the main.c but never use it in the infinite loop. Is it becouse it's a interrupt service subroutine? hımm. its running in the back and adc value updates itselft automatically in every 100ms (thanks to timer int.) I think i figured it out when i am asking you :) thank you anyway :)

  • @gmmaia11
    @gmmaia11 6 ปีที่แล้ว +1

    Hey again! I am following your previous sugestion and I am using the Timer like you explain in this video. It´s working fine for now, thanks!
    3 questions about this video:
    - How does the timer works? It counts a certain number of clock cycles (in this case 100, right) and the creates an interrupt to make the ADC start converting?
    - Why do you have to copy the HAL_ADC_ConvCpltCallback to the main? And where is this function called?
    - In this example, why do you need to increase the sampling time in the ADC?
    Thank you in advance, and again, great video!

    • @mutexembedded2206
      @mutexembedded2206  6 ปีที่แล้ว +3

      Hi Maia,
      First of all, good to know you're finding the videos helpful.
      For the timer Interrupt working principle, we control the timer using 2 main parameters; 1) Prescalar, 2) Period
      -The prescalar scale the clock down by APB_ClkFreq/ (Prescalar + 1)
      -Period, is just a counter, it counts for 0 to Period
      And when the period ARR counter finishes, it call the period elapsed callback function "HAL_ADC_ConvCpltCallback", which is pre-defined in the HAL library as __weak so that you can re-write it in your application (e.g. main.c).
      So, if APB clock Frequency is 16Mhz.
      -> Prescalar = 2 - 1;
      Timer_Freq = 16/(Prescalar+1) = 16/2 = 8MHz
      -> Period = 100-1;
      Timer Freq = 8M/(Period + 1) = 8M/100 = 80Khz

    • @gmmaia11
      @gmmaia11 6 ปีที่แล้ว

      Also, I came across one problem. Everything inside the while(1) in the main does not accur, and I cannot understand why? Does the program get there at all?

    • @gmmaia11
      @gmmaia11 6 ปีที่แล้ว

      MYaqoobEmbedded sorry to botter you so much, but do you have any ideia why is this happening? Why my program never gets to the infinite while(1) in my main? I did a prigram just like your using Cube MX.
      Thanks again!

  • @rashmiiyer7078
    @rashmiiyer7078 5 ปีที่แล้ว +1

    Thank you for some great stuff. However, I am looking to generate audio using PWM using the STM32F103. I would like to generate 125 kHz PWM using the Timer 1. A buffer from the SDcard will be loaded and then, using the Timer2, would like to trigger the DMA to transfer data from the buffer to the Duty cycle register of the Timer1 at 44.1 kHz. Can you please help me in this?

    • @mutexembedded2206
      @mutexembedded2206  5 ปีที่แล้ว

      Interesting! I have not done this implementation before, but seems feasible to me.

  • @ferdinvivian9336
    @ferdinvivian9336 6 ปีที่แล้ว +1

    Hello sir, I'm learning to program from your videos.. Really very helpful.. Thanks a lot for your work.. Can you please tell me, How to filter the required steps to program...
    For example, in this example you are using ADC.int and ADC.channel for ADC and Timer.Init and Timer.master For Timer..
    How are you using only these 2 functions.. Which manual you are using sir.
    Or you are using CubeMx 1st and decoding the required steps(FUNCTIONS) from cubeMx for programming using CMSIS

    • @mutexembedded2206
      @mutexembedded2206  6 ปีที่แล้ว

      Ferdin Vivian
      Hi,
      Not entirely sure if I got ur question, but my set up is using HAL library + CubeMX

    • @ferdinvivian9336
      @ferdinvivian9336 6 ปีที่แล้ว

      Sir, My question is, Under Timer Config function some features for Timer has been enabled manually in 2nd method using CMSIS.. How do you know to enable those features sir..
      for example: TIMER.Init, Timer.clocksource, Timer.Mastermode .. Why cant you enable any one.. How do you know if you enable all 3 then only we will get our required output sir..

  • @hussienkazan2590
    @hussienkazan2590 6 ปีที่แล้ว

    THANKS FOR THE VIDEOS, WHAT IS THE LED ROLL HERE?

  • @AshokRajpilli
    @AshokRajpilli 5 ปีที่แล้ว

    Hi @MYaqoobEmbeed, What is the need of setting sampling time to 28 cycles when you are configuring ADC with Timer?

  • @babotvoj
    @babotvoj 4 ปีที่แล้ว +1

    is ti possible to use timer 6, because there is no timer 6 out event option to be selected

    • @mutexembedded2206
      @mutexembedded2206  4 ปีที่แล้ว

      Yes you can use other timers for ADC, you can find those in CubeMX as options

  • @serkansonel1242
    @serkansonel1242 5 ปีที่แล้ว

    Hey! Thank you for tutorial. I just want to ask can we use input capture as a trigger ? Because in video you are saying we can use output compare with no out and basic time elaps for trigger. I confused there, can i use input capture too ?

  • @kenwallace6493
    @kenwallace6493 4 ปีที่แล้ว

    I can't help but think how useful these videos would be if direct register writes were used instead of HAL. Yes, an intimate relationship with the device spec and reference manual are required but it's better, in my opinion than second-guessing hundreds of HAL functions and wondering exactly what's going on.

    • @mutexembedded2206
      @mutexembedded2206  4 ปีที่แล้ว

      Hi Ken,
      Agree to many extent, especially for Students

  • @googlable
    @googlable 5 ปีที่แล้ว

    Thanks, great video!
    I have a problem though, that changing the Counter Period affects only the first callback time... After that it becomes 100-200 ms. I'm using DMA though not an interrupt, and my ADC has 3 channels. Can you assist?

  • @sagarchavanr
    @sagarchavanr 6 ปีที่แล้ว

    Hello Sir, Thanks for the wonderful tutorial. I have been following your tutorial from last month and it really helpful for me.
    As I am working on STM32F334 Nucleo board I am facing some problems while implementing same steps using STM32CubeMX.
    In my project, I am using PA0(Analog In), PC13 (GPIO EXTI to start A to D conversion), TIM2 (to get adc values after every 1ms delay), PB5 (GPIO EXTI to stop A to D conversion and Display sum of collected analog values) and USART2 (in asynchronous mode)
    Sir, Delay between PC13(Start ADC) and PB5(Stop ADC) is 5ms.
    But I must get 5 analog values after every 5ms. But I am not getting the values.
    Please guide me regarding that.
    As such tutorial is not available I am facing difficulties in it.
    I can send you my code files to you.
    Please help...

  • @totomanrecai
    @totomanrecai 6 ปีที่แล้ว +1

    Is there any diffrence between IN0 and IN1 in ADC1?

    • @mutexembedded2206
      @mutexembedded2206  6 ปีที่แล้ว

      Furkan Smg
      Basically, IN0 is channel 0
      IN1 is channel 1.. but both can be part of ADC1

  • @tailordhaval
    @tailordhaval 4 ปีที่แล้ว

    Hello Sir. Very nice tutorial. In my application, I call timer subroutine at every 1ms and during that time I have to take the ADC sample. Then how I can do these.

  • @baptistecadenel9496
    @baptistecadenel9496 5 ปีที่แล้ว

    Hi, I'm trying to use a PWM as a trigger of my adc but it's doesn't work at all.. Can you help me pls ?
    Thanks a lot ! Your video are very helpful !

  • @rohitpatil4785
    @rohitpatil4785 6 ปีที่แล้ว

    Hello bro, thanks for this tutorial, I have try to read this adc value using UART. So it is possible for this timer trigger using adc tutorial.let me know thanks .

  • @imranekibria8374
    @imranekibria8374 4 ปีที่แล้ว

    Asalam o Alikum. I am trying to configure timer triggered dual regular simultaneous adc with dma double buffer as part of my university project. Will you be willing to provide me some guidance?

  • @eamonhannon1103
    @eamonhannon1103 3 ปีที่แล้ว

    Really good !

  • @David-nk7pv
    @David-nk7pv 5 ปีที่แล้ว

    Hi, great tutorial but I don't understand why you defined the function HAL_ADC_ConvCpltCallback but then it's never called in Main? can anyone explain

    • @David-nk7pv
      @David-nk7pv 5 ปีที่แล้ว

      @Ananda V T Padmanabhan Thank you :)

  • @pranken90
    @pranken90 3 ปีที่แล้ว

    이 아자씨 개 유익함

  • @mohamadali6174
    @mohamadali6174 5 ปีที่แล้ว

    Great