2025-08-12 8:54 AM
I’m working on an STM32MP135 (STM32MP13‑DISCO) using Yocto/OpenSTLinux 5.15 and trying to get SPI5 working via the spidev interface. My device tree configures SPI5 pins and enables spidev@0 at 500 kHz (see DTS fragment below). /dev/spidev0.0 appears on boot.
For testing, I have physically connected MOSI to MISO for loopback, and CS (PH11) is connected to the peripheral and can be pulled low. I run the loopback command:
./spidev_test -D /dev/spidev0.0 -s 500000 -v
However, the transfer fails with:
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
[ 494.413391] spidev spi0.0: SPI transfer timed out
[ 494.416807] spi_master spi0: failed to transfer one message from queue
can't send spi message: Connection timed out
Aborted (core dumped)
I have confirmed:
Device tree compiles without errors.
/dev/spidev0.0 exists and matches my DT config.
Avoided “-l” (SPI_LOOP) mode, which is unsupported by STM32.
Still timed out in a simple loopback.
My device tree for Spidev is gevin below
&pinctrl {
spi5_pins_b: spi5-pins-b {
pins {
pinmux = <STM32_PINMUX('H', 7, AF5)>, /* SPI5_SCK */
<STM32_PINMUX('A', 8, AF5)>, /* SPI5_MISO */
<STM32_PINMUX('H', 3, AF5)>; /* SPI5_MOSI */
bias-disable;
drive-push-pull;
slew-rate = <1>;
};
};
spi5_sleep_pins_b: spi5-sleep-pins-b {
pins {
pinmux = <STM32_PINMUX('H', 7, ANALOG)>,
<STM32_PINMUX('A', 8, ANALOG)>,
<STM32_PINMUX('H', 3, ANALOG)>;
};
};
};
&spi5 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&spi5_pins_b>;
pinctrl-1 = <&spi5_sleep_pins_b>;
cs-gpios = <&gpioh 11 GPIO_ACTIVE_LOW>;
status = "okay";
spidev@0 {
compatible = "rohm,dh2228fv";
reg = <0>;
spi-max-frequency = <500000>;
status = "okay";
};
};
how to solve this issue? any Solutions ?