Re: [Zephyr-users] Buggy PWM driver for nRF52 <ashish.shukla@...>

Hi Vinayak,

fade_led sample runs as expected. We are trying to generate PWM on two channels. Adding 

pwm_pin_set_usec(pwm_dev, PWM_CHANNEL0,PERIOD, pulse_width);
pwm_pin_set_usec(pwm_dev, PWM_CHANNEL1,PERIOD, pulse_width);

Creates unexpected behavior. 

Warm regards,
Ashish Shukla
Jr. Embedded Engineer
Research & Development

Please consider the environment before printing this e-mail or its attachments.

Disclaimer: The information contained herein (including any accompanying documents) is confidential and is intended solely for the addressee(s). If you have erroneously received this message, please immediately delete it and notify the sender. Also, if you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this message or any accompanying document is strictly prohibited and is unlawful. The organization is not responsible for any damage caused by a virus or alteration of the e-mail by a third party or otherwise. The contents of this message may not necessarily represent the views or policies of Corvi

On Thu, Feb 8, 2018 at 1:37 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@...> wrote:

Hi Vikrant,


I have run the upstream fade_led sample on nrf52840-PDK, I see no regression, the brightness changes every second (up and then down so on).

I advice you to debug your implementation as I have no visibility to your design.






From: Vikrant More [mailto:vikrant8051@...]
Sent: Thursday, February 08, 2018 8:55 AM
To: Chettimada, Vinayak Kariappa <>
Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52


Hi Vinayak,

I'm working nRF52840-PDK board.


On Thu, Feb 8, 2018 at 1:21 PM, Chettimada, Vinayak Kariappa <> wrote:

Hi Vikrant,


Please try the PWM without the BT Controller included. There could be some PWM regression due to changes in controller implementation.

That said the nrf5_sw  driver is software variant designed for older nRF51 SoCs. For newer nRF52x series h/w PWM’s should be used.


Nrf5_sw will work provided careful mitigation of used PPI and timers between the driver and BT controller use.


Which SoC are you using?





From: [] On Behalf Of Vikrant More
Sent: Thursday, February 08, 2018 5:04 AM
To: Marti Bolivar <marti@...>
Cc:;; Felipe Neves <ryukokki.felipe@...>
Subject: Re: [Zephyr-devel] [Zephyr-users] Buggy PWM driver for nRF52


Hi Marti,

>>Are you using the latest master?



On Thu, Feb 8, 2018 at 1:23 AM, Marti Bolivar <marti@...> wrote:

Hi Vikrant,


Are you using the latest master?


Three improvements to nRF PWM went in fairly recently:


3f1dbfda1 pwm: nrf5_sw: don't disable timer if another channel is still active

ab399a1cf pwm: nrf5_sw: do not use 'inversed' polarity by default

cec073c35 pwm: nrf5_sw: add support for SYS_LOG





On Wed, Feb 7, 2018 at 1:59 PM, Vikrant More <vikrant8051@...> wrote:

I took reference of $zephy/samples/samples/fade_led project


& add following parameters in my prj.conf


Could you please inform me, what I should do besides this ??
Thank You !!


On Feb 7, 2018 11:36 PM, "Felipe Neves" <ryukokki.felipe@...> wrote:

Hi Vikrant,

Did you configure what pins are associated to pwm duty_cycles on the menuconfig?





2018-02-07 10:15 GMT-02:00 Vikrant More <vikrant8051@...>:

Hello World !!

I've added following lines in my project main ()

    pwm_dev = device_get_binding(PWM_DRIVER);

    if (!pwm_dev)
        printk("Cannot find %s!\n", PWM_DRIVER);

        if(pwm_pin_set_usec(pwm_dev, PWM_CHANNEL0, PERIOD, pulse_width0))
            printk("pwm pin set fails\n");

        if(pwm_pin_set_usec(pwm_dev, PWM_CHANNEL1, PERIOD, pulse_width1))
            printk("pwm pin set fails\n");


And using bluetooth updating value of pulse_width0 & pulse_width1. Those two are defined as global variables.

pulse_width0 --> LED_1 on nrf52840_PDK
pulse_width1 --> LED_2 on nrf52840_PDK

I'm able to update value of both these variables using Bluetooth.

I used printk to check it. My logic is perfect.

But if I vary pulse_width0 then it affects intensity of LED2
& if I vary pulse_width1 then it affects intensity of LED1.

Why ? Is anyone found this BUG ?

Zephyr-users mailing list


Felipe S. Neves 

Embedded software & systems engineer

Skype: fneves1989

Zephyr-users mailing list




Zephyr-users mailing list

Join { to automatically receive all group messages.