Buggy PWM driver for nRF52


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);
        return;
    }

   
    while(1)
    {
   
        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");
        }

        k_sleep(100);
    }


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 ?


Felipe Neves
 

Hi Vikrant,

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


Best

Felipe


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);
        return;
    }

   
    while(1)
    {
   
        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");
        }

        k_sleep(100);
    }


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
Zephyr-users@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users




--
Felipe S. Neves 
Embedded software & systems engineer
Skype: fneves1989
+55 11 96610 – 0855 


Vikrant More <vikrant8051@...>
 

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

& add following parameters in my prj.conf

CONFIG_STDOUT_CONSOLE=y
CONFIG_PRINTK=y
CONFIG_PWM=y
CONFIG_SYS_LOG=y
CONFIG_SYS_LOG_PWM_LEVEL=4

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?


Best

Felipe


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);
        return;
    }

   
    while(1)
    {
   
        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");
        }

        k_sleep(100);
    }


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
Zephyr-users@...ct.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users




--
Felipe S. Neves 
Embedded software & systems engineer
Skype: fneves1989
+55 11 96610 – 0855 


Marti Bolivar
 

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

Thanks,
Marti

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

CONFIG_STDOUT_CONSOLE=y
CONFIG_PRINTK=y
CONFIG_PWM=y
CONFIG_SYS_LOG=y
CONFIG_SYS_LOG_PWM_LEVEL=4

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?


Best

Felipe


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);
        return;
    }

   
    while(1)
    {
   
        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");
        }

        k_sleep(100);
    }


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
Zephyr-users@...ct.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users




--
Felipe S. Neves 
Embedded software & systems engineer
Skype: fneves1989

_______________________________________________
Zephyr-users mailing list
Zephyr-users@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users



Vikrant More <vikrant8051@...>
 

Hi Marti,

>>Are you using the latest master?
Yes

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

Thanks,
Marti

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

CONFIG_STDOUT_CONSOLE=y
CONFIG_PRINTK=y
CONFIG_PWM=y
CONFIG_SYS_LOG=y
CONFIG_SYS_LOG_PWM_LEVEL=4

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?


Best

Felipe


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);
        return;
    }

   
    while(1)
    {
   
        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");
        }

        k_sleep(100);
    }


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
Zephyr-users@...ct.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users




--
Felipe S. Neves 
Embedded software & systems engineer
Skype: fneves1989

_______________________________________________
Zephyr-users mailing list
Zephyr-users@...ct.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users