Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How can I modify the MCPWM prescale value without modifying the library? #8258

Unanswered
Prithul0218 asked this question in Q&A
Discussion options

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!

You must be logged in to vote

Replies: 1 comment

Comment options

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.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /