Skip to main content
oeliks
Associate III
Dec 28, 2019 7:40 PM UTC
Question

ADC triggers only in rising edge PWM

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!​

This topic has been closed for replies.

1 reply

oeliks
oeliksAuthor
Associate III
Dec 28, 2019 9:08 PM UTC

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.​