Enable SPIM0 and TWIM1 Drivers in KConfig NCS

Hello,

I am trying to enable the SPIM0 and TWIM1 drivers for my current project. Under the VS Code GUI for KConfig, I see the options, but they are grayed out and cannot be selected. Can someone guide me as to how to enable them? Maybe I have something enabled/disabled that is causing this. Manually adding them in the KConfig only produces compile errors. I am using nRF Connect SDK v2.1.2 and have the nRF52 DK (nRF52832) board for eval purposes.

Thanks,

Adnan

Parents
  • Hi,

    Are you using other peripherals with the same peripheral ID?

    Also, check the status of the peripherals in the devicetree.

    Regards,
    Sigurd Hellesvik

  • Hello,

    I am trying to use a peripheral, camera module, that's why I need access to the drivers. No other peripheral.

    I am modifying the Peripheral_UART example for this. I did add a custom overlay file but that has only GPIOs and ADC mappings. I have not touched any of the IDs.

    Thanks,

    Adnan

  • Hi Adnan,

    Can you post your custom overlay file using Insert->Code?

    You can see the devicetree configuration of the compiled project from build/zephyr/zephyr.dts.
    Can you see the status of the peripherals here?

    Manually adding them in the KConfig only produces compile errors.

    Can you post the errors you get using Insert->Code?

    Regards,
    Sigurd Hellesvik

  • Hello Siguard,

    Thank you for getting back to me on this. Please review the requested info below:

    // To get started, press Ctrl+Space to bring up the completion menu and view the available nodes.
    
    // You can also use the buttons in the sidebar to perform actions on nodes.
    // Actions currently available include:
    
    // * Enabling / disabling the node
    // * Adding the bus to a bus
    // * Removing the node
    // * Connecting ADC channels
    
    // For more help, browse the DeviceTree documentation at https://docs.zephyrproject.org/latest/guides/dts/index.html
    // You can also visit the nRF DeviceTree extension documentation at https://nrfconnect.github.io/vscode-nrf-connect/devicetree/nrfdevicetree.html
    &pinctrl {
    	pwm0_default: pwm0_default {
    		group1 {
    			psels = <NRF_PSEL(PWM_OUT0, 0, 11)>;
    			nordic,invert;
    		};
    	};
    
    	pwm0_sleep: pwm0_sleep {
    		group1 {
    			psels = <NRF_PSEL(PWM_OUT0, 0, 11)>;
    			low-power-enable;
    		};
    	};
    
        pwm1_default: pwm1_default {
    		group1 {
    			psels = <NRF_PSEL(PWM_OUT0, 0, 12)>;
    			nordic,invert;
    		};
    	};
    
    	pwm1_sleep: pwm1_sleep {
    		group1 {
    			psels = <NRF_PSEL(PWM_OUT0, 0, 12)>;
    			low-power-enable;
    		};
    	};
    
        pwm2_default: pwm2_default {
    		group1 {
    			psels = <NRF_PSEL(PWM_OUT0, 0, 13)>;
    			nordic,invert;
    		};
    	};
    
    	pwm2_sleep: pwm2_sleep {
    		group1 {
    			psels = <NRF_PSEL(PWM_OUT0, 0, 13)>;
    			low-power-enable;
    		};
    	};
    };
    
    / {
    	pwmleds {
    		compatible = "pwm-leds";
    		pwm_led0: pwm_led_0 {
    			pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
    		};
            pwm_led1: pwm_led_1 {
    			pwms = <&pwm1 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
    		};
            pwm_led2: pwm_led_2 {
    			pwms = <&pwm2 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
    		};
    	};
    
        aliases {
            pwm-led0 = &pwm_led0;
            pwm-led1 = &pwm_led1;
            pwm-led2 = &pwm_led2;
    		adcctrl = &adc;
        };
    };
    
    &pwm0 {
    	status = "okay";
    	pinctrl-0 = <&pwm0_default>;
    	pinctrl-1 = <&pwm0_sleep>;
    	pinctrl-names = "default", "sleep";
    };
    &pwm1 {
    	status = "okay";
    	pinctrl-0 = <&pwm1_default>;
    	pinctrl-1 = <&pwm1_sleep>;
    	pinctrl-names = "default", "sleep";
    };
    &pwm2 {
    	status = "okay";
    	pinctrl-0 = <&pwm2_default>;
    	pinctrl-1 = <&pwm2_sleep>;
    	pinctrl-names = "default", "sleep";
    };
    
    &adc { /* ADC */
        label = "adc";
        status = "okay";
       };

    zephyr.dts

    I cannot see the peripherals in this file.

    KCONFIG compile issues:

    warning: BT_SMP (defined at C:/TPR-Nordicsemi-
    Sources/ncs/v2.1.2/zephyr/subsys/bluetooth/host/Kconfig:317, subsys/bluetooth\host/Kconfig:317) was
    assigned the value 'n' but got the value 'y'. See
    docs.zephyrproject.org/.../kconfig.html and/or look up BT_SMP in the
    menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values,
    and Kconfig - Tips and Best Practices sections of the manual might be helpful too.


    warning: NRFX_SPIM0 (defined at C:/TPR-Nordicsemi-
    Sources/ncs/v2.1.2/zephyr/modules/hal_nordic\nrfx/Kconfig:193, modules\hal_nordic\nrfx/Kconfig:193)
    was assigned the value 'y' but got the value 'n'. Check these unsatisfied dependencies: n (=n). See
    docs.zephyrproject.org/.../kconfig.html and/or look up NRFX_SPIM0 in the
    menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values,
    and Kconfig - Tips and Best Practices sections of the manual might be helpful too.


    warning: NRFX_TWIM1 (defined at C:/TPR-Nordicsemi-
    Sources/ncs/v2.1.2/zephyr/modules/hal_nordic\nrfx/Kconfig:298, modules\hal_nordic\nrfx/Kconfig:298)
    was assigned the value 'y' but got the value 'n'. Check these unsatisfied dependencies: n (=n). See
    docs.zephyrproject.org/.../kconfig.html and/or look up NRFX_TWIM1 in the
    menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values,
    and Kconfig - Tips and Best Practices sections of the manual might be helpful too.

    -- The C compiler identification is GNU 10.3.0
    -- The CXX compiler identification is GNU 10.3.0
    -- The ASM compiler identification is GNU
    -- Found assembler: C:/TPR-Nordicsemi-Sources/ncs/toolchains/v2.1.2/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
    CMake Warning at C:/TPR-Nordicsemi-Sources/ncs/v2.1.2/zephyr/CMakeLists.txt:1839 (message):
    __ASSERT() statements are globally ENABLED

  • Hi,

    adnankhalid said:
    I cannot see the peripherals in this file.

    If you can not see the peripherals in this zephyr.dts, it means that your devicetree overlay was not included properly.

    How did you include your overlay into your project?

    For later reference: Which developement kit are you using?

    Regards,
    Sigurd Hellesvik

  • Hello Sigurd,

    My apologies, I misunderstood the question. Yes the peripherals (GPIO and ADC) from my custom overlay file are indeed represented in the zephyr.dts file. 

    Further proof of this is that my control code in main is working. I can control the GPIOs and the read from the desired ADC input.

    The kit I am using is the nRF52 DK (nRF52832). I am trying to integrate a camera module and need access to the SPIM and TWIM drivers, hence the original question.

    Please advise.

    Thanks,

    Adnan

  • Hi Adnan,

    Ah, then we know that the devicetree is correct.

    The errors below is that Kconfigs are not set.
    You can check their dependencies of Kconfig options in VS Code using the Kconfig feature:

    Then check the value of the dependencies:

    Does this show you what you are missing with your options?

    Regards,
    Sigurd Hellesvik

Reply Children
Related