nrf5340dk build error with CONFIG_QDEC_NRFX and CONFIG_SENSOR enabled

Hello,

I am using an nrf5340dk and I am trying to create a qdec sample using as reference the wheel module.

I have added set the CONFIG_SENSOR and CONFIG_QDEC_NRFX to y and also added an .overlay file in /boards directory of my project folder (following the instructions here https://docs.zephyrproject.org/latest/build/dts/howtos.html#set-devicetree-overlays

The overlay file includes the following:

&qdec {
status = "okay";
a-pin = <3>;
b-pin = <28>;
enable-pin = <30>;
led-pin = <0xFFFFFFFF>;
led-pre = <0>;
steps = <24>;
};

However when I build the project using the SES, I get the following error:

'DT_N_S_soc_S_peripheral_50000000_S_qdec_33000_P_steps' undeclared (first use in this function); did you mean 'DT_N_S_soc_S_peripheral_50000000_S_qdec_33000_P_status'?

It looks like I am doing something wrong with the device tree configuration.

Parents Reply
  • Hello,

    thank you for the feedback.

    I tried updating the overlay file like the following:

    encoder0: &qdec0 {
    status = "okay";
    a-pin = <3>;
    b-pin = <28>;
    enable-pin = <30>;
    led-pin = <0xFFFFFFFF>;
    led-pre = <0>;
    steps = <24>;
    };

    encoder1: &qdec1 {
    status = "okay";
    a2-pin = <4>;
    b2-pin = <29>;
    enable-pin = <31>;
    led2-pin = <0xFFFFFFFF>;
    led2-pre = <1>;
    steps = <24>;
    };

    and then update my code to call for a device binding with the qdec1 device (labelled as encoder1), but it failed (no device found).

    I also tried using an overlay file with only the qdec1 configuration and update d my code accordingly but this also failed.

    Any ideas about what could be the issue?

    Also you referenced the qdec peripherals. Where can I read about the chip peripherals ?

Children
Related