-
Notifications
You must be signed in to change notification settings - Fork 7.7k
How can I modify the MCPWM prescale value without modifying the library? #8258
-
Hi everyone,
I'm currently working on a buck-boost converter that requires 100kHz complementary PWM frequencies with at least 8-10 bits of resolution. I'm using the MCPWM in Arduino to generate the PWM signals, but I'm encountering some issues with the PWM frequency and resolution.
I've noticed that the library sets the MCPWM clock prescaler to a fixed value (MCPWM_CLK_PRESCL) when initializing the PWM signal. However, I need to achieve a higher PWM frequency output while maintaining a good PWM resolution, and I believe that modifying the prescale value could help me achieve that.
My question is, how can I modify the MCPWM prescale value without modifying the library? I've searched online for a solution for hours, but I haven't found any clear answers. Here is my code and at 50kHz, it works pretty well but at 100kHz, I only get 3 bit resolution. I am using mcpwm_timer_set_resolution
but no luck. https://pastebin.com/eaPyH5F5
Any help or guidance would be greatly appreciated. Thank you in advance!
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
Here's my code: https://pastebin.com/eaPyH5F5
Somebody mentioned here and in multiple other forums that modifying the prescaler values in the mcpwm.c
can help you achieve higher resolutions.
Beta Was this translation helpful? Give feedback.