cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO-F446ZE TIM1 and ADC trigger conversion - need assistance

Dev-Axe
Associate II

Hi,

I am working on a project to control BLDC motor so I configured the TIM1 as shown below:

DevAxe_0-1721125967002.png

I have selected the TGRO trigger event selection to be "Update Event". I have confusion now because when the counter mode is "Center Aligned Mode 3" the update event will be occured twice 1 for underflow(counting down) and 1 for overflow (counting up) in this scenario which event will trigger the ADC?

ADC:

I have configured the ADC as shown below:

DevAxe_1-1721126135533.png

in the external trigger I have set "Timer 1 Capture Compare 1 Event" now this where the confusion is. What this trigger source means that every time there is update event on timer 1 it will trigger?. also I want more explanation regarding all these trigger events with a diagram would be great:

DevAxe_2-1721126235504.png

My objective is to trigger the adc at the start of PWM cycle and when the ADC conversion is finished generate an interrupt to run my FOC code in a bare metal configuration. 

I am using ST controller for the first time so please help me get this up and running. 

if there is any example then please let me know I can follow it or an application note. 

 

 

Also I want the ADC to single scan of all the channels not contineous conversion.

4 REPLIES 4
KnarfB
Principal III

Hi,

Figure 143. "Center-aligned PWM waveforms" in Reference Manual RM0390 Rev 6 is your friend. Choose an OCxREF for TRGO. You can use CH4 for adjusting the sampling point. Choose rising or falling edge (or both) in ADC trigger.

hth

KnarfB

Dev-Axe
Associate II

Hi KnarfB,

Thank you very much for your help. 

does the channel 4 of Tim 1 can trigger ADC? as I dont see as an option please see below 

DevAxe_0-1721129112972.png

also OC1REF refers to channel 1 and OC2REF refers to channel 2 If i am correct. 

DevAxe_1-1721129303046.png

please check the above diagram if it is correct.

 

is there an example associated to this type of configuration?

 

Thanks,

You're right, TIM1 can't. However, for TIM2, TIM3, TIM8 you can select OC4REF.

Hi KnarfB,

That make sense, and I will sychronize Tim2 and Tim1. I will give it a try and see how it works out.

Thanks,