cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 SPI Connection Timeout using spidev

_Vanshika
Associate II

I’m working on an STM32MP257FAK3 custom board using Yocto/OpenSTLinux and trying to get SPI1 working as 3 wire SPI via the spidev interface. My device tree configures SPI1 pins and enables spidev@0 at 1MHz, 10MHz and 500KHz. (see DTS fragment below). /dev/spidev0.0 appears on boot.

&spi1 {
pinctrl-names = "default";
pinctrl-0 = <&spi1_pins_a>;
cs-gpios = <&gpiob 11 (GPIO_ACTIVE_LOW)>;
status = "okay";
/delete-property/ power-domains;
/delete-property/ dmas;
/delete-property/ dma-names;
 
gh7005@0 {
compatible = "rohm,dh2228fv"; /* generic spi device for testing */
reg = <0>; /* chip select 0 */
spi-max-frequency = <1000000>; //1Mhz
spi-3wire; /* GH7005 uses 3-wire SPI */
};
};
spi1_pins_a: spi1-0 {
pins {
pinmux = <STM32_PINMUX('D', 9, AF2)>, //Mosi
<STM32_PINMUX('H', 10, AF2)>; //SCK
drive-push-pull;
bias-disable;
slew-rate = <1>;
};
};

After booting, I am getting Spi connection time out error for all cases.(500KHz, 1MHz and 10MHz).

./spidev_test -D /dev/spidev0.0 -s 1000000 -p "\xAA\x55"
spi mode: 0x0
bits per word: 8
max speed: 1000000 Hz (1000 kHz)
can't send spi message: Connection timed out
Aborted (core dumped)


Why is this error coming and how can I resolve it?
1 REPLY 1
PatrickF
ST Employee

HI @_Vanshika 

have you looked at this page ?

https://wiki.st.com/stm32mpu/wiki/How_to_use_SPI_from_Linux_userland_with_spidev

maybe name the child as listed in the example.

Regards.

 

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Tip of the day: Try Sidekick STM32 AI agent, see here