cancel
Showing results for 
Search instead for 
Did you mean: 

PWM and ADC conflict

Nakata
Associate II

Hello, I'm new to STM32, I bought a Nucleo board with a STM32F334R8T6
I want to generate a PWM of 10kHz and read some data in ADC channel, unfortunetely, there some conflicts between this two and I can not generate a PWM with more than 5kHz.
I need some help about the configuration of the timer and ADC, there is some tutorial or document that explain each parameter that need to be configurated?
I saw something about DMA, which one is better to use this?

6 REPLIES 6
TDK
Guru

There shouldn't be any conflicts to generating a 10 kHz wave and using the ADC. Perhaps if you share your code or the symptoms that you are seeing, and/or the desired behavior, we can resolve the issue.

A PWM signal can be generated that is completed independent of CPU resources. It shouldn't be causing any conflicts.

If you feel a post has answered your question, please click "Accept as Solution".

My crystal cube here says, that the PWM is generated in software, by toggling a GPIO output pin in timer interrupt.

JW

How should I generate the PWM signal?

Using the PWM mode of some of the Compare/Capture channels of timer - see "PWM mode" subchapter of timer chapter in Reference Manual.

JW

TDK
Guru

Find some CubeMX examples which configure a timer channel to output a PWM signal.

Here is one:

STM32CubeF3/Projects/STM32F302R8-Nucleo/Examples/TIM/TIM_PWMOutput at 7d3d394a3ac57b85acd09e3fd351ce5de3db6f8b · STMicroelectronics/STM32CubeF3 (github.com)

If you feel a post has answered your question, please click "Accept as Solution".
Nakata
Associate II

Hello, I want to know what is the most efficient way to read two channels of an ADC in a pre determined frequency like 10kHz