cancel
Showing results for 
Search instead for 
Did you mean: 

Hello, I want to enable SPI4 but just get a timeout. My SOM is based on STM32MP157, use Linux 5.10 Main line. I connected a logic analyser and see the pins are set to high a soon linux was booted. I dont see any clock impulses.

Wechmarer
Associate II

My device tree:

spi4_pins_csa: spi4-0 {
		pins {
			pinmux = <STM32_PINMUX('E', 12, AF5)>, /* SPI4_SCK */
					 <STM32_PINMUX('E', 14, AF5)>; /* SPI4_MOSI */
			bias-disable;
			drive-push-pull;
			slew-rate = <1>;
		};
		pins2 {
			pinmux = <STM32_PINMUX('E', 13, AF5)>; /* SPI4_MISO */
		};
	};
 
 
&spi4 {
    pinctrl-names = "default";
    pinctrl-0 = <&spi4_pins_csa>;
    cs-gpios = <GPIO_CO_CS GPIO_ACTIVE_LOW>;
    status = "okay";
 
    spidev@0{
        compatible = "spidev";
        reg = <0>;
        spi-max-frequency = <4000000>;
    };
};

The output:

root@apollo-e2412:~# spidev_test -D /dev/spidev1.0
spi mode: 0x4
bits per word: 8
max speed: 500000 Hz (500 kHz)
[  609.925039] spidev spi1.0: SPI transfer timed out
[  609.928391] spi_master spi1: failed to transfer one message from queue
can't send spi message: Connection timed out
Aborted

2 REPLIES 2
jbester
Associate

Any luck with this?   I'm hitting a similar issue with the SPI busses on STM32MP157 with the mainline and the ST kernel 5.10.x kernel.

TommyTom
Associate II

Hi,

I had a slightly different issue with sdmmc1 where it would not initialise without defining the "sleep" pins. I have had success with SPI5 on an STM32MP135 like this:

&pinctrl {
	spi5_pins_mx: spi5-1 {
		pins1 {
			pinmux = <STM32_PINMUX('G', 10, AF5)>, /* SPI4_SCK */
				<STM32_PINMUX('H', 12, AF5)>; /* SPI4_MOSI */
			bias-disable;
			drive-push-pull;
			slew-rate = <1>;
		};

		pins2 {
			pinmux = <STM32_PINMUX('G', 8, AF5)>; /* SPI4_MISO */
			bias-disable;
		};
	};

	spi5_sleep_pins_mx: spi5-sleep-1 {
		pins {
			pinmux = <STM32_PINMUX('G', 10, ANALOG)>, /* SPI4_SCK */
				<STM32_PINMUX('G', 8, ANALOG)>, /* SPI4_MISO */
				<STM32_PINMUX('H', 12, ANALOG)>; /* SPI4_MOSI */
		};
	};
};

...

&spi5 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&spi5_pins_mx>;
	pinctrl-1 = <&spi5_sleep_pins_mx>;
	cs-gpios= <&gpioe 8 GPIO_ACTIVE_LOW>; //PE8 = CS for WiFi
	status = "okay";
...
};

Maybe this is related to your problem? Good luck.

 

Tom