Skip to main content
Associate
July 25, 2024
Question

PWM and ADC conflict

  • July 25, 2024
  • 5 replies
  • 1756 views

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?

5 replies

TDK
July 25, 2024

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""."
waclawek.jan
Super User
July 25, 2024

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

JW

NakataAuthor
Associate
July 26, 2024

How should I generate the PWM signal?

waclawek.jan
Super User
July 26, 2024

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
July 26, 2024
"If you feel a post has answered your question, please click ""Accept as Solution""."
NakataAuthor
Associate
July 30, 2024

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