Hello guys ,
I am trying to generate 10Mhz PWM signal using the LEDC.
Unfortunately whenever the frequency is above 8 Mhz , i don't get a consistent signal at all (the frequency fluctuates & same for Duty cycle)
Here is a sample for 12Mhz 50% duty cycle
Code is pretty straightforward :https://pastebin.com/VMr19BGm
What could be the issue and ty for your help in advance.
High frequency PWM
-
- Posts: 9746
- Joined: Thu Nov 26, 2015 4:08 am
Re: High frequency PWM
It's because the LEDC is configured to use the APB clock which is 80MHz, and that doesn't divide cleanly into 12MHz (80/12=6.66, and iirc that number has to be a multiple of 2 to 'fit'). In order to get the frequency as close as possible, the LEDC uses dithering, meaning it'll introduce longer and shorter pulses to generally get the frequency as close as possible to 12MHz.
-
- Posts: 2
- Joined: Fri Feb 10, 2023 8:23 am
Re: High frequency PWM
Thanks for the reply.
I tried with 10Mhz still the same problem.
I think the problem comes from my logic analyzer, I m using one of those cheap salae clones from Aliexpress .
They don"t support high frequencies and anything north of 8Mhz it produces junk.
I tried with 10Mhz still the same problem.
I think the problem comes from my logic analyzer, I m using one of those cheap salae clones from Aliexpress .
They don"t support high frequencies and anything north of 8Mhz it produces junk.
-
- Posts: 9746
- Joined: Thu Nov 26, 2015 4:08 am
Re: High frequency PWM
Those things top out at 24MHz sample rate, so they'll only be able to measure *something* up to a frequency of 12MHz, and they will be able to properly tell you the shape of the waveform only up to a few MHz at best, so yeah, sounds like that might be your issue.
Who is online
Users browsing this forum: No registered users and 72 guests