I am looking for ways to diagnose a problem with a vibration motor NFP-3C-03208B using Zephyr on a custom nrf5340 boardh. I have working on a nordic dk but is not working on a custom board. The device appears to be ready but not working or erroring when using. It appears to be initializing:
static const struct pwm_dt_spec vib_motor = PWM_DT_SPEC_GET(DT_ALIAS(vibrator_pwm));
and is ready:
if (!device_is_ready(vib_motor.dev)) {
LOG_ERR("Vibration motor control not supported");
return -ENODEV;
} else {
LOG_DBG("Vibration Motor is ready");
if (vib_motor.dev->name) {
LOG_DBG("Vibration Motor name: %s", vib_motor.dev->name);
} else {
LOG_DBG("Vibration Motor name is NULL");
}
}
as seen from the rtt log:
00> [00:00:00.684,783] <dbg> vibration_manager: vibration_manager_init: Vibration Motor is ready
00> [00:00:00.684,814] <dbg> vibration_manager: vibration_manager_init: Vibration Motor name: pwm@22000
but when I test it, nothing happens. It's the same code as I use on the dk which is working with the same motor:
ret = pwm_set_pulse_dt(&vib_motor, pulse_width);
if (ret < 0) {
LOG_ERR("Failed to set pulse width: %i", ret);
return;
}
The dtsi has this:
&pinctrl {
...
pwm1_default: pwm1_default {
group1 {
psels = <NRF_PSEL(PWM_OUT1, 0, 18)>;
};
};
pwm1_sleep: pwm1_sleep {
group1 {
psels = <NRF_PSEL(PWM_OUT1, 0, 18)>;
low-power-enable;
};
};
};
The dts:
/ {
...
pwmleds {
compatible = "pwm-leds";
vibrator_pwm: pwm_led_1 {
pwms = <&pwm1 0 20000 PWM_POLARITY_NORMAL>;
label = "Vibration Motor";
};
};
};
&pwm1 {
status = "okay";
pinctrl-0 = <&pwm1_default>;
pinctrl-1 = <&pwm1_sleep>;
pinctrl-names = "default", "sleep";
};
And the overlay has:
aliases {
vibrator-pwm = &vibrator_pwm;
};
Any ideas on how I should diagnose further would be a great help.