cancel
Showing results for 
Search instead for 
Did you mean: 

TIM1 to trigger ADC conversion

Dario Laezza
Associate II
Posted on May 21, 2017 at 17:55

Hi to everyone, I apologize for the umpteenth discussion on this topic.

I have some questions about Timer in general to which I did not found good answers:

1- I would like to use TIM1_CH1 to start ADC conversion but from the reference manual of Nucleo 401RE I do not understand how it is linked to the ADC or what procedure I have to use for evoke an event on this channel. 

2- I have understood that the Timer can output a PWM signal if used in PWM mode. Do I need to pick up this signal from a PWM pin and send it back to the external trigger of the ADC to start the peripheral? Or can I use it through the internal connections?

Thank you so much to everyone, 

Dario Laezza

#trigger #f401re #tim1_ch1 #timx-trigger #adc #tim1
4 REPLIES 4
RomainR.
ST Employee
Posted on May 21, 2017 at 21:05

Hello Dario,

STM32F401 Ref Manual Chapter 11.6 give the internal signals which do the job.

For ADC regular channels, TIM1_CH1, CH2 and CH3. 

Timer generate an internal event at each overflow.

You need to configure your ADC handle structure to get event from TIM1 Ch1 Event for External Trigger.  

0690X0000060744QAA.png

Let me know.

Best regards.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Posted on May 22, 2017 at 10:31

Hi romain, thank you for your answer. I tried to set the ADC the way you suggested to get an external trigger for starting conversion before starting this discussion, in particular I set the EXTEN for rising edge and I leave EXTSEL to 0000 to catch the event on CH1. But I have noticed that the ADC does not work, is there something else to configure in the ADC to get the event?

Best regards

Dario Laezza

Posted on May 22, 2017 at 10:41

It not supposed to work that way.

Check the second column in the table, it says 'internal signal from on-chip timers'. No need to break it out and feed it back in.

Triggering the ADC by external events is suited for action-triggered sampling with non-uniform, asynchronous timing.

Triggering by a timer is intended for equidistant sampling, which is good for most cases.

Posted on May 22, 2017 at 14:50

Dario,

Output Compare event betweenTIM1 Ch1 and ADC1 is fully internal. No

Take a look at sources fileattached (tested on NucleoF446RE) as an example of ADC IN0 (PA0) triggered with TIM1 OC1 event at1ms rate.

It should works on STM32F401RE.

Best regards

________________

Attachments :

main.c.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hyaa&d=%2Fa%2F0X0000000bAZ%2FUjIZzPMx6wXAsPLspJIUDCWlhMCl3UfvQE1aO0W4vF8&asPdf=false

stm32f4xx_hal_msp.c.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyMs&d=%2Fa%2F0X0000000bAa%2FK0SrkHMhmyOIFgvq9vp9rDKN4bd4nIgAdQVNiSklGrQ&asPdf=false

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.