This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

clock_control_on returns -EPERM on ncs 1.4.0

Hi,

When upgrading a project from ncs 1.3.0 to 1.4.0, the clock_control_on() call behaves different; It always returns -EPERM. Did the API change?

The call is used as follows:

static int clock_init(void)
{
    int err;
    const struct device *clock;

    clock = device_get_binding(DT_INST_LABEL(0));
    if (!clock) {
        printk("Unable to find clock device binding\n");
        return -ENODEV;
    }

    err = clock_control_on(clock, CLOCK_CONTROL_NRF_SUBSYS_HF);
    if (err) {
        printk("Unable to turn on the clock: %d", err);
    }

    return err;
}

Thanks,

-Bastiaan

Parents
  • Hi,

     

    Could you try adding this define?

    #define DT_DRV_COMPAT nordic_nrf_clock

     

    The whole snippet should then be something like this:

    #include <drivers/clock_control.h>
    #include <drivers/clock_control/nrf_clock_control.h>
    
    #define DT_DRV_COMPAT nordic_nrf_clock
    
    static int clock_init(void)
    {
        int err;
        const struct device *clock;
    
        clock = device_get_binding(DT_INST_LABEL(0));
        if (!clock) {
            printk("Unable to find clock device binding\n");
            return -ENODEV;
        }
    
        err = clock_control_on(clock, CLOCK_CONTROL_NRF_SUBSYS_HF);
        if (err) {
            printk("Unable to turn on the clock: %d", err);
        }
    
        return err;
    }

     

    Kind regards,

    Håkon

Reply
  • Hi,

     

    Could you try adding this define?

    #define DT_DRV_COMPAT nordic_nrf_clock

     

    The whole snippet should then be something like this:

    #include <drivers/clock_control.h>
    #include <drivers/clock_control/nrf_clock_control.h>
    
    #define DT_DRV_COMPAT nordic_nrf_clock
    
    static int clock_init(void)
    {
        int err;
        const struct device *clock;
    
        clock = device_get_binding(DT_INST_LABEL(0));
        if (!clock) {
            printk("Unable to find clock device binding\n");
            return -ENODEV;
        }
    
        err = clock_control_on(clock, CLOCK_CONTROL_NRF_SUBSYS_HF);
        if (err) {
            printk("Unable to turn on the clock: %d", err);
        }
    
        return err;
    }

     

    Kind regards,

    Håkon

Children
Related