Set up a Pancake Motor with a nRF5340 and getting an error on device_is_ready

I am trying to get a pancake motor working with a nRF5340 using Zephyr in VSC. I have an intermediary board.

I keep getting this error:

 <wrn> vibration_manager: Vibration motor control not supported

I have these settings in the overlay:

    vib_pwr: vib-pwr-ctrl {
        compatible = "regulator-fixed";
        regulator-name = "vib-pwr-ctrl";
        enable-gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>;
    };

    pwmleds {
        compatible = "pwm-leds";
        vibrator_pwm: pwm_led_0 {
            pwms = <&pwm0 0 PWM_MSEC(20) 0>;
        };
    };

And have these two lines in the program:

static const struct pwm_dt_spec vib_motor = PWM_DT_SPEC_GET_OR(DT_ALIAS(vibrator_pwm), {});
static const struct gpio_dt_spec enable_gpio = GPIO_DT_SPEC_GET_OR(DT_NODELABEL(vib_pwr), enable_gpios, {});

Here is the init code:

void vibration_manager_init(void)
{
    LOG_DBG("Initializing vibration manager");

    int rc;
    
    if (!device_is_ready(enable_gpio.port)) {
        LOG_WRN("Vibration motor enable/disable not supported");
        return -ENODEV;
    }


    if (!device_is_ready(vib_motor.dev)) {
        LOG_WRN("Vibration motor control not supported");
        return -ENODEV;
    }



    rc = gpio_pin_configure_dt(&enable_gpio, GPIO_OUTPUT_LOW);
    if (rc != 0) {
        printk("Failed init vibration motor enable pin\n");
    }

    vibration_motor_set_on(false);

    vib_motor_enabled = true;

    return 0;
}

I have this in the prj.conf

# vibration motor and pwm
CONFIG_PWM=y

I read this post but it didn't help. I also read Haptics — Zephyr Project Documentation but don't know if it is implemented in the Nordic version yet.

Parents Reply Children
No Data
Related