verdin-iMX8mp spi-slave

Our customer wants to use SPI-slave.
I tried spi-slave with this device tree overlays.
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/*

  • Copyright 2020-2021 Toradex
    */

/dts-v1/;
/plugin/;

/ {
compatible = “toradex,verdin-imx8mp”;
};
&ecspi1 {
#address-cells = <0>;
#size-cells = <0>;
spi-slave;
status = “okay”;
/delete-property/cs-gpios;
pinctrl-0 = <&pinctrl_ecspi1>;
slave {
compatible = “rohm,dh2228fv”;
reg = <0>;
spi-max-frequency = <10000000>;
status = “okay”;
};
};

slave
spidev_test -v -D /dev/spidev1.0 -p 8765 -C
spi mode: 0x4
bits per word: 8
max speed: 500000 Hz (500 KHz)
TX | 38 37 36 35 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ |8765|
RX | 30 30 30 30 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ |0000|

master
spidev_test -D /dev/spidev1.0 -v -p 0001000200030004
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
TX | 30 30 30 31 30 30 30 32 30 30 30 33 30 30 30 34 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ |0001000200030004|
RX | 00 00 00 00 00 00 00 00 36 00 00 00 35 00 00 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ |…6…5…|

Data is sent, but the data received by the master is incorrect.
When the master sends 4 bytes, the slave can finally send 1 byte.

Best regards.

Greetings @developer0916,

Your issue here seems like the same issue another customer experienced in this thread: SPI slave mode for imx6ULL CoM

The customer in this other thread is using the IMX6ULL but this SoC uses the same ECSPI driver/framework as the IMX8M Plus. As seen in this thread the customer experienced the same phenomenon as you are here:

data sent from the slave is being received at the master, but, the data is spaced out with empty bits and takes 4 times the data to be sent from the master to receive the data from slave.

In the marked solution the customer consulted an NXP application note (AN13633) that helped them get slave-mode working properly.

Best Regards,
Jeremias

Thank you for your information.

Best regards.

Glad I could help.