BUG: Cannot enable pwm1, pwm2 or pwm3 on nrf52840 DK

The nrf52840 defines 4 pwms. Attempting to enable pwm1, pwm2 or pwm3 using pinctrl through a device overlay results in build errors suggesting there is something wrong with the macros. Attempting to enable these without pinctrl results in other errors saying the pinctrl MUST be used. Note that the nrf52840 DK board config file is turning on PINCTRL by default.

To reproduce this error, start with the zephyr blinky example.

Add CONFIG_PWM=y to the prj.conf file, then add this app.overlay file:

----

&pinctrl {
test_pwm_default: test_pwm_default {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 0, 14)>;
};
};
};

&pwm1 {
status = "okay";
pinctrl-0 = <&test_pwm_default>;
//ch0-pin = <14>;
};

----

Build with BOARD=nrf52840dk_nrf52840

This will result in the following error:

error: 'PINCTRL_STATE_DT_N_S_soc_S_pwm_40021000_PINCTRL_IDX_0_UPPER_TOKEN' undeclared here (not in a function); did you mean 'DT_N_S_soc_S_pwm_4001c000_PINCTRL_IDX_0_UPPER_TOKEN'?

Note that changing &pwm1 to &pwm0 makes the error go away. Changing &pwm1 to &pwm2 results in the exact same error. Adding both a &pwm0 and &pwm1 block results in the exact same error.

Commenting out the pinctrl-0 line and uncommenting the ch0-pin line results in this error among others:

error: static assertion failed: "/soc/pwm@40021000 has legacy *-pin properties defined although PINCTRL is enabled"

Parents Reply Children
No Data
Related