Regarding the issue of peripheral support for NCS

I need to use 9160 to drive the Lis2dw12 accelerometer for ST. I found some settings related to this accelerometer in NCS, but I couldn't use it after adding it in IIC, and I couldn't enable the relevant options in KConfig GUI. Is this caused by NCS cutting out the driver for Zephyri's ST chip? If I need to drive this accelerometer, can I only simulate IIC using GPIO? Because I really can't find a way to drive IIC (or directly use the accelerometer through NCS configuration) with hardware

Parents
  • I have found the method to enable hardware IIC and read specified chip data in NCS. For example, when I use the Lis2dw12 chip, there is a driver for this chip in NCS, and the complete functions are encapsulated. In theory, driving this chip with NCS is very simple. Just set the IIC pin in the device tree and add this device, and then use the functions in sensor. h to read the acceleration data of this chip.
    like this

    &i2c2 {
        clock-frequency = <I2C_BITRATE_FAST>;
        pinctrl-0 = <&i2c2_default>;
        pinctrl-1 = <&i2c2_sleep>;
        pinctrl-names = "default", "sleep";
    	lis2dw12: lis2dw12@19 {
    		compatible = "st,lis2dw12";
    		reg = <0x19>;
    	};
    };
    
    &pinctrl {
        i2c2_default: i2c2_default {
    
            group1 {
                psels = <NRF_PSEL(TWIM_SCL, 0, 11)>, <NRF_PSEL(TWIM_SDA, 0, 10)>;
                bias-pull-up;
            };
        };
    
        i2c2_sleep: i2c2_sleep {
    
            group1 {
                psels = <NRF_PSEL(TWIM_SCL, 0, 11)>, <NRF_PSEL(TWIM_SDA, 0, 10)>;
            };
        };
    };

    Modify the method of obtaining devices in the main function

    // const struct device *const sensor = DEVICE_DT_GET_ANY(DT_NODELABEL(lis2dw12));
    	const struct device *const sensor = DEVICE_DT_GET(DT_NODELABEL(lis2dw12));

    Then we can obtain acceleration data. I used the example of lis2dh for testing.

Reply Children
No Data
Related