This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

PWM jitter when setting duty cycle to .2 .4 .6 .8

I'm tryinng to minimize jitter on my LED when I switch between .2 .4 .6 .8 I'm using a nrf51822 for my testing. The jitter is so bad that it has a strobe effect.

I reviewed mention of some issues with this. I am attaching the code I'm using to control led2.

I'm sure that i have to change .period (frequency to 100khz to minimize the jitter) is there a code example out there that presents this implementation. The generic PWM in the libraries is definitely not that great for the nrf51822. I checked out the examples on a previous post and they ended up being about the nrf52. I was thing of generating a variable with a PWM algorythm with

   led.period_ms(10);    // Set the period to 10mS = 100Hz
        This would be me 100khz or or does it

Current changes to nrf51822 is done through remote bluetooth device for pwm

attached is the code any suggestions would be appreciated. ble_uart_pwm

Parents
  • Mbed has its own sdk. It may be based on one of nordics SDKs, but at least the pwmout library is written specially for mbed and not based on the SDK PWM library. Here is the source code for the pwmout library which is different from the one used in our SDK. I would use the SDK instead of mbed. You can also switch to nrf52. The nrf52 does not have problem with jittering as it has a hardware PWM peripheral.

Reply
  • Mbed has its own sdk. It may be based on one of nordics SDKs, but at least the pwmout library is written specially for mbed and not based on the SDK PWM library. Here is the source code for the pwmout library which is different from the one used in our SDK. I would use the SDK instead of mbed. You can also switch to nrf52. The nrf52 does not have problem with jittering as it has a hardware PWM peripheral.

Children
No Data
Related