Skip to main content
Visitor II
September 1, 2023
Question

adc_sampling

  • September 1, 2023
  • 1 reply
  • 1229 views

I have generated an pwm of 1khz from timer now I  want to read adc reading  for once for each cycle of pwm after 50 microsecond of rising edge how to do if anyone have code please send in stm 32 .

    This topic has been closed for replies.

    1 reply

    ST Employee
    September 1, 2023

    Hello Ishu,

    First of all on which STM32 MCU do you wish to implement that?
    You have a great video explaining the ADC and DMA here and a wiki here. This should help you.

    Regards,
    Stassen

    ishuAuthor
    Visitor II
    September 4, 2023

    I AM USING NUCLEO-G491RE  MY SYSTEM CLOCK 96MHZ I HAVE USED ADC INTERNAL TRIGEERING TO ADC .I HAVE CONFIG AN TIMER3 FOR 400US THAT WILL TRIGGER ADC INTERNALLY  ON RISING EDGE  AND ADC IN INTRRUPT MODE . I HAVE USED TIMER2 FOR PWM GENERATION . BY THIS SHLOUD GET ADC VALUE ON RISIING EDGE ONLY BUT I AM GETTING VALUE ON RISING AND FALLING EDGE BOTH.CODE2.PNGCODE1.PNGTIMER3.PNGTIMER 2.PNGADC.PNG

    ST Employee
    September 5, 2023

    Hello Ishu,

    You should be triggering only on rising edge for your ADC trigger if i understand well your question like below:

    StassenC_0-1693902440550.png

    or else it will trigger on both rising and falling edge.

    Regards,
    Stassen