How to enable ECSPI2 on iMX8MN-EVK

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to enable ECSPI2 on iMX8MN-EVK

How to enable ECSPI2 on iMX8MN-EVK

Sometimes we need to use an SPI bus to communicate with sensors or another device.


Unfortunately, by default on iMX8MN-EVK, we have the ECSPI2 disabled on our BSP.

 

We can use that peripheral on Linux enabling it in the device tree.

 

To enable the ECSPI2 on the device tree we have to add the next on imx8mn-evk.dtsi:

 

 

  status = "okay";

 };

 

+&ecspi2 {

+ #address-cells = <1>;

+ #size-cells = <0>;

+ fsl,spi-num-chipselects = <1>;

+ pinctrl-names = "default";

+ pinctrl-0 = <&pinctrl_ecspi2 &pinctrl_ecspi2_cs>;

+ cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;

+ status = "okay";

+

+ spidev0: spi@0 {

+ reg = <0>;

+ compatible = "rohm,dh2228fv";

+ spi-max-frequency = <500000>;

+ };

+};

+

 &fec1 {

  pinctrl-names = "default";

  pinctrl-0 = <&pinctrl_fec1>;

 

On iomux node:

 

 

+ pinctrl_ecspi2: ecspi2grp {

+ fsl,pins = <

+ MX8MN_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK 0x82

+ MX8MN_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI 0x82

+ MX8MN_IOMUXC_ECSPI2_MISO_ECSPI2_MISO 0x82

+ >;

+ };

+

+ pinctrl_ecspi2_cs: ecspi2cs {

+ fsl,pins = <

+ MX8MN_IOMUXC_ECSPI2_SS0_GPIO5_IO13 0x40000

+ >;

+ };

+

  pinctrl_ir_recv: ir-recv {

    fsl,pins = <

      MX8MN_IOMUXC_GPIO1_IO13_GPIO1_IO13 0x4f

 

 after modifying and compiling the device tree you can see the device active like this:

 

Chavira_0-1708970246353.png

 

Connection:

Chavira_1-1708970679367.png

 

Test:

spidev_test -D /dev/spidev1.0 -v
Chavira_0-1708978109966.png

 

 

 

You can use the devsheell of yocto to make the changes:

 

https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/How-to-use-Devshell-to-compile-device-tr...

ラベル(1)
添付
評価なし
バージョン履歴
最終更新日:
‎02-27-2024 11:27 AM
更新者: