I'm wondering what should be the PWM driver behaviour for 0% and 100% duty cycle.
If enabled, should we have a channel notification for every cycle, or no notification at all?
Thanks
PWM behaviour for 0% and 100% Topic is solved
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: PWM behaviour for 0% and 100%
It should give a channel notification because the channel is active.
Giovanni
Giovanni
Re: PWM behaviour for 0% and 100%
Hello, I got the PWM channel working on three channels in a 103RB, but when I use this:
pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 7500));
for percentage values of 12% (value set at 1200) or below this value, the duty cycle rises up to 60% an continue increasing as I set lower percentage values. in this way, the duty cycle does not get zero or even get close of it with a 0 percentage value.
I tried to get more information by comparing the program with the sample programs, but actually those does not cover such low percentage values.
also I cheked that the higher the PWM frequency, the bigger is this behavior,
I appreciate you could give me a solution or opinion about it.
pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 7500));
for percentage values of 12% (value set at 1200) or below this value, the duty cycle rises up to 60% an continue increasing as I set lower percentage values. in this way, the duty cycle does not get zero or even get close of it with a 0 percentage value.
I tried to get more information by comparing the program with the sample programs, but actually those does not cover such low percentage values.
also I cheked that the higher the PWM frequency, the bigger is this behavior,
I appreciate you could give me a solution or opinion about it.
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: PWM behaviour for 0% and 100%
thank you for answering, here they are:
static PWMConfig pwmcfg = {
200000,
10,
pwmpcb,
{
{PWM_OUTPUT_ACTIVE_HIGH, pwmc1cb},
{PWM_OUTPUT_ACTIVE_HIGH, pwmc1cb1},
{PWM_OUTPUT_ACTIVE_HIGH, pwmc1cb2},
{PWM_OUTPUT_DISABLED, NULL}
},
0,
0,
};
I tried to solve it by modifying the first two parameters (20000, 1)but then the PWM did not work at all
static PWMConfig pwmcfg = {
200000,
10,
pwmpcb,
{
{PWM_OUTPUT_ACTIVE_HIGH, pwmc1cb},
{PWM_OUTPUT_ACTIVE_HIGH, pwmc1cb1},
{PWM_OUTPUT_ACTIVE_HIGH, pwmc1cb2},
{PWM_OUTPUT_DISABLED, NULL}
},
0,
0,
};
I tried to solve it by modifying the first two parameters (20000, 1)but then the PWM did not work at all
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: PWM behaviour for 0% and 100%
That "10" means that your PWM has only 10 discrete duty cycle settings because the counter goes from 0 to 9 then it is reset.
You need to define the input clock and the period value accordingly to your requirements.
Giovanni
You need to define the input clock and the period value accordingly to your requirements.
Giovanni
Re: PWM behaviour for 0% and 100%
I tried some usefull frequency combinations for my application, in some I got this effect reduced, but none of them achieved a zero duty cycle; anyway, I think I will cut off this last sampling segment by software and set the zero value in the output
thank you very much, the best
thank you very much, the best
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: PWM behaviour for 0% and 100%
Try setting the duty cycle at 0 without using the macro, do you get a continuous level? 0% and 100% should have no fronts.
Giovanni
Giovanni
Re: PWM behaviour for 0% and 100%
yes, I will set to zero that part in that way, thank you for your suggestion.
also yes, by using the macro in some setting configurations, the level of this effect is continuous , overall, in the low frequency configurations
also yes, by using the macro in some setting configurations, the level of this effect is continuous , overall, in the low frequency configurations