I am running a PWM pin on 15 using this DT Overlay:
pwmnmos {
compatible = "pwm-leds";
status = "okay";
pwm_nmos0: pwm_nmos_0{
pwms = <&pwm2 15>;
};
};
Is the compatible line correct?
My GPIO lines look like this :
gpiocustom {
compatible = "gpio-keys";
gpiocus0: gpiocus_0 {
gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;
label = "Custom gpio 16";
};
gpiocus1: gpiocus_1 {
gpios = <&gpio0 30 GPIO_ACTIVE_LOW>;
label = "Custom gpio 30";
};
nmos_out2: nmos_2{
gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
label = "NMOS_2_output p0.14";
};
};
I can get the NMOS outputs to work like this:
if (!device_is_ready(spec->port)) {
printk("Error: %s device is not ready\n", spec->port->name);
return;
}
else printk(" %s device is ready\n", spec->port->name);
ret = gpio_pin_configure(nmosdev, NMOS2PIN, GPIO_OUTPUT_ACTIVE | NMOS2FLAGS);
if (ret != 0) {
printk("Error %d: failed to configure pin %d (NMOS '%s')\n",
ret, spec->pin, nmos2.gpio_pin_name);
return;
}
printk("Configured pin %d (NMOS '%s')\n",
spec->pin, nmos2.gpio_pin_name);
gpio_pin_set(nmosdev, NMOS2PIN,1); // leds on
gpio_pin_set(dev_cust_gpio, CUST_IO_PIN, 1);
But the LED goes out after this code:
pwm = DEVICE_DT_GET(PWM_CTLR);
if (!device_is_ready(pwm)) {
while (1)
{
printk("Error: PWM device %s is not ready\n", pwm->name);
k_sleep(K_SECONDS(1U));
}
}
ret = pwm_pin_set_usec(pwm, PWM_CHANNEL,
period,pulsewidth, PWM_FLAGS);
Another NMOS output shows the PWM output but the GPIO'd LED goes out.
Any bright ideas as to why PWM fouls up another NMOS pin?