Skip to main content
Lukasz Przenioslo
Associate III
March 21, 2016
Question

trigger adc after counter is reached

  • March 21, 2016
  • 26 replies
  • 3709 views
Posted on March 21, 2016 at 23:50

Hello there,

I was wondering either in STM32F4 it is possible, to get a similar functionality to C2000 one, that can trigger an ADC conversion after certain counter valueon a timer is reached, like here:

https://www.dropbox.com/s/d6lonep1m3i5x4d/Zrzut%20ekranu%202016-03-21%2023.48.06.png?dl=0

(point CA, middle).

In stm34f4 I am using center aligned pwm mode. I can trigger ADC each time timer starts counting up/down or both. But I need to trigger the adc when the counter is halfway down or up. Is there a way to do this?

I would appreciate all help.

#timer #adc #synchronization
This topic has been closed for replies.

26 replies

Walid FTITI_O
Visitor II
March 23, 2016
Posted on March 23, 2016 at 18:43

Hi Bremen, 

In fact those are the capture/compare events (occurs when there is a match between CCRx and counter value) and I am talking about the update event ( which occurs on the counter overflow). So if you take a look to the table of ADC external trigger , you find both ( TIMx_CHx_envent and TIMx-TRGO event ). The second will serve your need.

Please, try to apply the recommendations already mentioned and come back if it is not OK for you.

-Hannibal-

Lukasz Przenioslo
Associate III
March 23, 2016
Posted on March 23, 2016 at 18:48

Ok, I get it now. Ill try it tommorow and post back. Thank you very much.

Lukasz Przenioslo
Associate III
March 24, 2016
Posted on March 24, 2016 at 08:27

I am trying to make the configuration now. I am trying to enable TIM1 trgo to trigger and injected channel conversion, but It doesnt seem to work (injected channel conversion interrupt is not triggered). Are there any other considerations taht has to be taken when using injected channel?

Walid FTITI_O
Visitor II
March 24, 2016
Posted on March 24, 2016 at 15:14

Hi Bremen,

Please, try to share your code (Timer configuration , ADC configuration ..clock ..) to figure out what you have missed.

-Hannibal-

Lukasz Przenioslo
Associate III
March 25, 2016
Posted on March 25, 2016 at 08:02

I think I got it now, I had some config errors and now its ok. Thank you very much for help guys, your help is priceless.

Walid FTITI_O
Visitor II
March 25, 2016
Posted on March 25, 2016 at 11:29

Hi Bremen,

It's nice to hear that. Keep up the good work.

-Hannibal-