cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger ADC by timer

Lee3
Associate III

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.

4 REPLIES 4
S.Ma
Principal

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.

> 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
Associate III

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.

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.