Hello,
I use nRF52840 in a project in which I read a potentiometer and set PWM output from 0 to 100%.
Setting [0 .. 100%) is OK,but when I try set exactly 100% duty cycle, I see at the oscilloscope 0%.
I use following function to set PWM DC:
void ol_set_output(void) { pwm_set_pulse_dt(get_pwmmotor_device(), ol_DC_movingsetting); }
ol_DC_movingsetting is the pulse width. The period is set in the device tree of the project this way
pwmmotor { compatible = "pwm-leds"; pwm_motor0: pwm_motor_0 { pwms = <&pwm0 0 PWM_USEC(64) PWM_POLARITY_NORMAL>; }; };
So the period is 64000 nanoseconds = 15.625 kHz.
When I set pulse to 64000, I receive duty cycle 0 (the PWM output stays low all the time).
When I set the pulse to 63999 nanoseconds, I see a glitch 1->0->1.
Here is my question: How to remove this 1->0->1 transition at the end of the period.
Regards,
Ivan