cancel
Showing results for 
Search instead for 
Did you mean: 

ADC triggers only in rising edge PWM

oeliks
Senior

Hi! ADC triggers only on rising edge of PWM signal. I want to trigger it at both rising/falling​ edge. When ADC=continous conversions, I can see some samples are 3V some 0V. But its random. So I changed continous conversions=disable.

Using HAL.​

Pwm triggers ADC then its transferred to array.​

TIM3:

Clock 72 MHz

Counting UP​

Prescaler 36-1

Period 10-1

Pulse 5

TRGO update event​

Pwm=200khz

​ADC:

Continous mode:disable​

Trigger: TIM3 update event​

I cant see in cubemx or in code trigger at rising or falling edge.​

Is there a simple register bit​ to set or Hal configuration to enable this?

Will try to do it myself, but any help is needed!

Thank You for your help!​

1 REPLY 1
oeliks
Senior

Ok, so center aligned mode of TIM3 seem to work.

​clock 72mhz

Prescaler = 18-1

Period=​10-1

Pulse=5

WithI pulse=0 there is no pwm generated.

How to proper set/calculate th​is values? To get 200khz 50% duty pwm?

On high pulse adc gives 3,28V so its ok, but on low pulse it gives 0,02V.​

Reading datasheets & searching web. Didnt find much. Pleas help.​