2023-08-30 02:22 AM
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.
2023-08-30 03:35 AM
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";
};
and https://wiki.st.com/stm32mpu/wiki/STM32MP15_clock_tree
Regards.
2023-09-02 03:20 AM - edited 2023-09-02 03:21 AM
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?