Skip to main content
Associate
August 30, 2023
Question

STM32MP157 SPI2 dosent transmit any data

  • August 30, 2023
  • 1 reply
  • 2284 views

Hello,

I've tried sent data using STM32MP157 customer board. SPI2 from M4 side using. So if I use standalone M4 data is transmitted. If I try sent data from M4 while Linux is runnig at A7, CTSIZE and TXTF bits at SR register are set and no any data is transmitted.  Linux not use SPI2 in device tree. Could anyone help me solve this issues, please?

Thanks,

Alex.

This topic has been closed for replies.

1 reply

PatrickF
Technical Moderator
August 30, 2023

Hi @alex_vm ,

maybe you miss to tell Linux that SPI2 is used by Cortex-M4 and that Linux should enable the peripheral kernel clock path (which should also not be CLK_SPI2S23_DISABLED).

You should have something like in your device tree:

rcc {
	st,clksrc=<
		...
		CLK_SPI2S23_...
};
...
&spi2 {
	status = "disabled";
};
...
&m4_spi2 {
	status = "okay";
};


See https://wiki.st.com/stm32mpu/wiki/How_to_assign_an_internal_peripheral_to_an_execution_context#Linux_kernel

and https://wiki.st.com/stm32mpu/wiki/STM32MP15_clock_tree

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.NEW ! Sidekick STM32 AI agent, see here
alex_vmAuthor
Associate
September 2, 2023

Hello Patrick,

Thanks for your support.

In my device tree I have:

stm32mp157-m4-srm.dtsi

&m4_rproc {
	m4_system_resources {

	.....
		m4_spi2: spi@4000b000 {
			compatible = "rproc-srm-dev";
			reg = <0x4000b000 0x400>;
			clocks = <&rcc SPI2_K>;
			status = "disabled";
		};
	.....

stm32mp157-m4-srm-pinctrl.dtsi

	m4_spi2_pins_a: m4-spi2-0 {
		pins {
			pinmux = <STM32_PINMUX('I', 1, RSVD)>, /* SPI2_SCK */
				 <STM32_PINMUX('C', 3, RSVD)>, /* SPI2_MOSI */
				 <STM32_PINMUX('I', 2, RSVD)>; /* SPI2_MISO */
		};
	};

stm32mp157d-atk.dtsi

&spi2 {
 status = "disabled";
};

&m4_spi2 {
 pinctrl-names = "default";
 pinctrl-0 = <&m4_spi2_pins_a>;
 status = "okay";
};

but the spi2 still does not  work.

 

root@ATK-MP157:~# cat /sys/kernel/debug/clk/clk_summary
 enable prepare protect duty
 clock count count count rate accuracy phase cycle
---------------------------------------------------------------------------------------------
 ck_hse 2 3 0 24000000 0 0 50000
 usbphy_k 1 1 0 24000000 0 0 50000
 ck_per 0 0 0 24000000 0 0 50000
 adc12_k 0 0 0 24000000 0 0 50000
 pll4 0 0 0 594000000 0 0 50000
 pll4_r 0 0 0 74250000 0 0 50000
 fdcan_k 0 0 0 74250000 0 0 50000
 pll4_q 0 0 0 74250000 0 0 50000
 ltdc_px 0 0 0 74250000 0 0 50000
 dsi_px 0 0 0 74250000 0 0 50000
 pll4_p 0 0 0 99000000 0 0 50000
 spdif_k 0 0 0 99000000 0 0 50000
 sdmmc3_k 0 0 0 99000000 0 0 50000
 sdmmc2_k 0 0 0 99000000 0 0 50000
 sdmmc1_k 0 0 0 99000000 0 0 50000
 pll3 1 1 0 417755859 0 0 50000
 pll3_r 0 0 0 11290699 0 0 50000
 pll3_q 0 0 0 24573875 0 0 50000
	 ......
 spi2_k 0 0 0 24573875 0 0 50000
	 ......

 

As I understand from clk_summary spi2 still not clocked?