PWM Jitter with nRF52DK

Hi everyone,

I am getting started with the nRF52832 and am testing it with the nRF52DK. I just completed the nRF Connect SDK Fundamentals course and now wanted to test the PWM Module. I am getting strong jitters on the PWM signal as seen in the attached image (which is 5 periods away from the trigger).

How come the PWM is so jittery? Does it have to do with the used clock? If so, how can I use a more accurate clock?

I have troubles finding information on how to change the clock with the nRF Connect SDK.

This is the code which generates the shown signal:

#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/drivers/pwm.h>

static const struct pwm_dt_spec pwm0 = PWM_DT_SPEC_GET(DT_ALIAS(pwm_led0));

int main(void)
{
	if (!pwm_is_ready_dt(&pwm0)){
        return 0;
    }
	pwm_set_dt(&pwm0, 200000, 5000);

	while(1){}
	return 0;
}

Thank you for your support.

BR Moritz

Parents Reply Children
Related