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 Oivind,

    I will wait for the release of the QDEC1 before moving on with this then.

    In the meantime, I tested QDEC0 using a DC motor with a built-in encoder.

    I connected the pinA of the encoder to P0.03 and pinB of the encoder to P0.28 as per the board configuration.

    However, it looks like for almost every positive rotation of 1 step (360/24steps = 15) I get an instant counter measurement of -1 step. However the motor is steadily rotating one side.

    Before digging deeper and seeing what is actually the output of the encoder (I will need an oscilloscope for this), I was thinking if I can read something to better understand how is the sensor value calculated in case the channel is SENSOR_CHAN_ROTATION. I know this is mainly zephyr stuff but any input is welcome.

    Last, I was checking about qdec malfunctioning in the nordic dev zone and found out this:

    Does this mean that there is some issue with the qdec0 ?

    One last question:

    I noticed that I got only single step rotations (15degrees-1step). In case I was polling the channel slower and I was not facing this issue with 1 step clockwise and 1 step counter-clockwise rotations, Should I be able to get multi-step rotation responses (Nx360/number_of_steps) taking into consideration how the nrfx_qdec driver is working (accumulating the valid rotations and resetting upon read request) ?

Children
Related