AnsweredAssumed Answered

using SPI2 with imx6ullevk user space

Question asked by fabio mario poiatti on Jan 15, 2020
Latest reply on Jan 21, 2020 by fabio mario poiatti

I would like to use SPI2 connected to accelerometer LSM6DSL.

 

I modified the DTS file including

 

&ecspi2 {
fsl,spi-num-chipselects = <1>;
cs-gpios = <&gpio4 22 0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi2_1 &pinctrl_ecspi2_cs_1>;
status = "okay";

spidev2@0x00 {
compatible = "spidev";
spi-max-frequency = <5000000>;
reg = <0>;
};
};

 

pinctrl_ecspi2_cs_1: ecspi2_cs_grp-1 {
fsl,pins = <
MX6UL_PAD_CSI_DATA01__GPIO4_IO22 0x10b0
>;
};

pinctrl_ecspi2_1: ecspi2grp-1 {
fsl,pins = <
MX6UL_PAD_CSI_DATA02__ECSPI2_MOSI 0x100b1
MX6UL_PAD_CSI_DATA03__ECSPI2_MISO 0x100b1
MX6UL_PAD_CSI_DATA00__ECSPI2_SCLK 0x100b1
>;
};

 

 

I see /dev/spidev1.0 .... but how can I try to communicate with the accelerometer?

Can I read and write on SPI like an USB or UART etc. with some command in user space like

 

cat < /dev/spidev1.0 

 

?

Outcomes