KSCAN sample build fail

Hello,

I am using nrf5340dk board to test KSCAN sample.I add overlay file in my kscan application and modify code below:

//const struct device *const kscan_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_keyboard_scan));
const struct device *const kscan_dev = DEVICE_DT_GET(DT_NODELABEL(kscan0));

Here is my overlay file "nrf5340dk_nrf5340_cpuapp.overlay":

/ {
    chosen {
        kscan = &kscan0;
    };

    kscan0: kscan_0 {
        compatible = "kscan-gpio-matrix";
        label = "KSCAN";
        diode-direction = "col2row";
        col-gpios
            = <&gpio1 4 GPIO_ACTIVE_HIGH>
            , <&gpio1 5 GPIO_ACTIVE_HIGH>
            , <&gpio1 6 GPIO_ACTIVE_HIGH>
            ;

        row-gpios
            = <&gpio0 12 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
            , <&gpio0 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
            , <&gpio0 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
            ;
    };
    aliases {
        kscan0 = &kscan0;
    };
};

When building,it occurs error:

c:/nordic/toolchains/v2.2.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: app/libapp.a(main.c.obj): in function `block_matrix_callback':
C:\NORDIC\nrf5340_test_1212\kscan\src\main.c:153: undefined reference to `__device_dts_ord_10'
c:/nordic/toolchains/v2.2.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: app/libapp.a(main.c.obj): in function `main':
C:\NORDIC\nrf5340_test_1212\kscan\src\main.c:169: undefined reference to `__device_dts_ord_10'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'c:\NORDIC\toolchains\v2.2.0\opt\bin\cmake.EXE' --build 'c:\NORDIC\nrf5340_test_1212\kscan\build'

It seems that there is something wrong with "DEVICE_DT_GET(DT_NODELABEL(kscan0))".

I checked my zephyr.dts,kscan0 is declared in it.

Is there anything else that needs to be modified?

The nRF connect SDK version I used is v2.2.0.

Parents Reply Children
Related