Skip to main content
Lee3
Associate III
Jan 29, 2019 5:03 PM UTC
Question

Trigger ADC by timer

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.

    4 replies

    S.Ma
    Principal
    Jan 29, 2019 9:57 PM UTC

    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
    Feb 2, 2019 2:44 PM UTC

    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
    Jan 29, 2019 10:32 PM UTC

    > 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
    Feb 2, 2019 2:44 PM UTC

    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.