nrf52840dk how to add two pwm in device tree

hi 

board : nrf52840dk

sdk : nrf connect sdk v2.6.1

example: matter light bulb

problem:

I want to add another set of PWM to the sample code. How should I configure the device tree?

Below is my configuration but it is not working

{
	aliases {
		pwm-led1 = &pwm_led1;
		pwm-led2 = &pwm_led2;
	};

	pwmleds {
		pwm_led1: pwm_led_1 {
			pwms = <&pwm0 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
		};
		pwm_led2: pwm_led_2 {
			pwms = <&pwm1 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
		};		
	};

};

&pwm0 {
	pinctrl-0 = <&pwm0_default_alt>;
	pinctrl-1 = <&pwm0_sleep_alt>;
	pinctrl-names = "default", "sleep";
};

&pwm1 {
	pinctrl-0 = <&pwm1_default_alt>;
	pinctrl-1 = <&pwm1_sleep_alt>;
	pinctrl-names = "default", "sleep";
};


&pinctrl {
	pwm0_default_alt: pwm0_default_alt {
		group1 {
			psels = <NRF_PSEL(PWM_OUT1, 0, 14)>;
			nordic,invert;
		};
	};

	pwm0_sleep_alt: pwm0_sleep_alt {
		group1 {
			psels = <NRF_PSEL(PWM_OUT1, 0, 14)>;
			low-power-enable;
		};
	};

	pwm1_default_alt: pwm1_default_alt {
		group1 {
			psels = <NRF_PSEL(PWM_OUT1, 0, 15)>;
			nordic,invert;
		};
	};

	pwm1_sleep_alt: pwm1_sleep_alt {
		group1 {
			psels = <NRF_PSEL(PWM_OUT1, 0, 15)>;
			low-power-enable;
		};
	};	

};

Top Replies

Related