Can I run two periferals with different mosi/miso/clk gpios on same SPI?

I have this configuration:

&pinctrl {
    
    // ism330bx
    ism330bx_default: ism330bx_default {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 1, 11)>,
                    <NRF_PSEL(SPIM_MOSI, 1, 12)>,
                    <NRF_PSEL(SPIM_MISO, 1, 13)>;
        };
    };

    ism330bx_sleep: ism330bx_sleep {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 1, 11)>,
                    <NRF_PSEL(SPIM_MOSI, 1, 12)>,
                    <NRF_PSEL(SPIM_MISO, 1, 13)>;
            low-power-enable;
        };
    };

    // lis3mdl
    lis3mdl_default: lis3mdl_default {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 0, 3)>,
                    <NRF_PSEL(SPIM_MOSI, 0, 2)>,
                    <NRF_PSEL(SPIM_MISO, 0, 29)>;
        };
    };

    lis3mdl_sleep: lis3mdl_sleep {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 0, 3)>,
                    <NRF_PSEL(SPIM_MOSI, 0, 2)>,
                    <NRF_PSEL(SPIM_MISO, 0, 29)>;
            low-power-enable;
        };
    };
};

Can I run them on the same SPI, like this?:

#include </home/gbrandwine/dev/augury-ep/drivers/sensor/st/ism330bx/zephyr/include/ism330bx_defs.h> // TODO: Solve this path
&spi1 {
	status = "okay";
	pinctrl-0 = <&ism330bx_default>, <&lis3mdl_default>;
	pinctrl-1 = <&ism330bx_sleep>, <&lis3mdl_sleep>;
	pinctrl-names = "default", "sleep";
	compatible = "nordic,nrf-spim";
	cs-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>,
               <&gpio1 4 GPIO_ACTIVE_LOW>;
	ism330bx@0 {
		compatible = "st,ism330bx";
		reg = <0>;
		accel-range = <ISM330BX_DT_FS_8G>;
      	accel-odr = <ISM330BX_DT_ODR_AT_60Hz>;
      	gyro-range = <ISM330BX_DT_FS_4000DPS>;
      	gyro-odr = <ISM330BX_DT_ODR_AT_60Hz>;

		int1-gpios = <&gpio1 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
		// int2_gpios = <&gpio1 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
		power_resources = <&boost_on>, <&sensors_on>; // boost_on should be enabled before sensors_on
		spi-max-frequency = <8000000>;
		// accel-range = <0>;
	};
	lis3mdl: lis3mdl@1 {
		compatible = "st,augu_lis3mdl";
		reg = <1>;
		irq-gpios = <&gpio0 27 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
		label = "AUGU_LIS3MDL";
		power_resources = <&boost_on>, <&sensors_on>; // boost_on should be enabled before sensors_on
		spi-max-frequency = <8000000>;
	};
};

Thanks you.

Gal

Related