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 Reply
  • Hello,

    So I added the following to the overlay file:

    &spi0 {

        compatible = "nordic,nrf-spim";
        status = "okay";
        sck-pin = <23>;
        mosi-pin = <25>;
        miso-pin = <24>;
        cs-gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
    };
    &spi1 {
        status = "disabled";
    };

    &i2c0 {
        status = "disabled";
    };

    &i2c1 {
        compatible = "nordic,nrf-twim";
        status = "okay";
    };
    I added the following to the prj.conf:
    #Enable SPI and I2C
    CONFIG_SPI=y
    CONFIG_I2C=y
    CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58=y
    The following to the KCONFIG:
    config CONFIG_SPI_NRFX
        bool "Enable SPI NRFX"
        default y
        select CONFIG_SPI

    config CONFIG_I2C_NRFX
        bool "Enable SPI NRFX"
        default y
        select CONFIG_I2C
    Now I seem to have access to the SPIM and TWIM drivers!
    Please advise if this is the right approach?
    Now I am trying to find the equivalent in NCS for the following:
    Get image data over the SPI/TWI and send it over BLE to device
    Any help/sample code to get this done would be most helpful.
    Thanks!
Children
Related