Hi,
I am trying to get the PWM120 to work on nRF54H20 using SDK 3.1.0
As the starting point I am using the dimming PWM example which is working and I can get proper output. I have substituted the pwm130 with pwm120 and changed the pins to P6.6 as this is defined as the output of PWM120 ch 0 as per datasheet.
here is the snippet from .DTS that I am using
&pwm120 { status = "okay"; pinctrl-0 = <&pwm120_default>; pinctrl-1 = <&pwm120_sleep>; pinctrl-names = "default", "sleep"; memory-regions = <&cpuapp_dma_region>;};
pwmleds {
compatible = "pwm-leds";
pwm_led2: pwm_led_2 {
pwms = <&pwm130 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
alt_clk: alt_clk {
pwms = <&pwm120 0 PWM_USEC(10) PWM_POLARITY_NORMAL>;
};
};
and the pin control dtsi
/omit-if-no-ref/ pwm120_default: pwm120_default { group1 { psels = <NRF_PSEL(PWM_OUT0, 6, 6)>; }; };
/omit-if-no-ref/ pwm120_sleep: pwm120_sleep { group1 { psels = <NRF_PSEL(PWM_OUT0, 6, 6)>; low-power-enable; }; };
In the main function I am calling the following
if (!pwm_is_ready_dt(&pwm_alt_clk)) { printk("Error: PWM device %s is not ready\n", pwm_alt_clk.dev->name); return 0; } period_ns = 200; ret = pwm_set_dt(&pwm_alt_clk, period_ns, period_ns / 2U); if (ret) { printk("Error %d: failed to set pulse width\n", ret); return 0; }