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

PWM

I am trying to do multiple PWM in my DK board , but it cant work. 

I made simple code for it .

&pwm0 {
	ch0-pin = < 13 >;
    ch1-pin = < 14 >;
   };

This is my overlay file , but it works for just pin 13, means ch0 .

int main(void)
{
   const struct device *pwm;

   pwm = device_get_binding("PWM_0");
   if (!pwm) {
		printk("Error\n");
		return;
	}

    while(1)
    {
      pwm_pin_set_usec(pwm,14,1000,50,0);
      pwm_pin_set_usec(pwm,14,1000,50,1);
      k_msleep(10);
    }
   
}

this is my main code , main.c

What can i do for running two PWM at same time .

Parents Reply Children
Related