Skip to main content
Lee3
Associate III
January 29, 2019
Question

Trigger ADC by timer

  • January 29, 2019
  • 2 replies
  • 1196 views

I'm having some difficulty getting this to work. This post is a very good description of the my confusion: https://community.st.com/s/question/0D50X00009XkghxSAB/triggering-adc-sampling-by-timer-events

However the conclusion is not helpful. TRGO update event triggering seems to work, but I'm interested in the CH* triggers. For example, I'd like to trigger the injected measurements off TIM8_CH4 event but I can't understand the documentation on what a CH4 event is. Is it a compare match? Is it an input capture? Either way I can't seem to get the ADC to trigger off it.

    This topic has been closed for replies.

    2 replies

    S.Ma
    Principal
    January 29, 2019

    I use the timer output compare pin (channel) which I connect with jumper wire to the ADC trigger pin.

    This way, it is possible to monitor with a scope what is going on. The timer create the ADC sampling frequency and the DMA will cyclically fill a rolling RAM array with the converted values when using a normal channel. Probably once this is working, it can be "optimized" by using internal signals.

    Lee3
    Lee3Author
    Associate III
    February 2, 2019

    This was very helpful and the debugging method I took. First I used an actual output from TIM8_CH4 and connected to EXTI line 15 for injected measurement triggers. I was then able to work back to a working non wired option.

    waclawek.jan
    Super User
    January 29, 2019

    > I can't understand the documentation on what a CH4 event is. Is it a compare match? Is it an input capture?

    Probably transition on the TIM8_CH4 output, enabled by both TIM8_CCER.CC4E and in case of TIM8 also TIM8_BDTR.MOE; but not necessarily brought out to pin through GPIO AF.

    Yes, the documentation is, ehm, substandard in this regard.

    JW

    Lee3
    Lee3Author
    Associate III
    February 2, 2019

    This was exactly correct. In my case I think it was the CCxE I was missing. So the trigger signal is OCx, which is the signal just prior to actual output. The GPIO can be disabled.