cancel
Showing results for 
Search instead for 
Did you mean: 

SPI1 hasn't clock on CM4

SChen.11
Associate III

Hi, I use SPI1 and SPI4 in CM4 context on my custom board. Now, I use SPI_FullDuplex_ComIT_Master_CM4.elf binary to test those SPI controllers. The SPI4 is working, but the SPI1 doesn't working. Below is the log when SPI1 firmware started

root@stm32mp1:~# echo "start" > /sys/class/remoteproc/remoteproc0/state
[   47.494072] remoteproc remoteproc0: powering up m4
[   47.549448] remoteproc remoteproc0: Booting fw image SPI_FullDuplex_ComIT_Master_CM4.elf, size 2009036
[   47.557833] remoteproc remoteproc0: header-less resource table
[   47.564191] remoteproc remoteproc0: not resource table found for this firmware
[   47.571421] remoteproc remoteproc0: header-less resource table
[   47.637048] rproc-srm-core m4@0:m4_system_resources: bound m4@0:m4_system_resources:serial@4000e000 (ops 0xc0a935f8)
[   47.646744] rproc-srm-core m4@0:m4_system_resources: bound m4@0:m4_system_resources:serial@40011000 (ops 0xc0a935f8)
[   47.672140] rproc-srm-core m4@0:m4_system_resources: bound m4@0:m4_system_resources:dac@40017000 (ops 0xc0a935f8)
[   47.683090] rproc-srm-core m4@0:m4_system_resources: bound m4@0:m4_system_resources:timer@44000000 (ops 0xc0a935f8)
[   47.692995] rproc-srm-core m4@0:m4_system_resources: bound m4@0:m4_system_resources:spi@44004000 (ops 0xc0a935f8)
[   47.703386] rproc-srm-core m4@0:m4_system_resources: bound m4@0:m4_system_resources:spi@44005000 (ops 0xc0a935f8)
[   47.714816] rproc-srm-core m4@0:m4_system_resources: bound m4@0:m4_system_resources:can@4400e000 (ops 0xc0a935f8)
[   47.726435] rproc-srm-core m4@0:m4_system_resources: bound m4@0:m4_system_resources:adc@48003000 (ops 0xc0a935f8)
[   47.737277] rproc-srm-core m4@0:m4_system_resources: bound m4@0:m4_system_resources:m4_led (ops 0xc0a935f8)
[   47.746739] remoteproc remoteproc0: remote processor m4 is now up

I just change the macro from SPI4 to SPI1 for test SPI1.

static void MX_SPI4_Init(void)
{
 
  /* SPI4 parameter configuration*/
  hspi4.Instance = SPI1;
 

Did I missing something?

3 REPLIES 3
PatrickF
ST Employee

Hello,

all peripheral clock sources are handled by Linux side, so you need to correctly set SPI1 in device tree. You could use CubeMx to assign SPI1 to M4 and look at the impact in DT.

See also https://wiki.st.com/stm32mpu/wiki/How_to_configure_system_resources#Configuring_clock_and_regulator_system_resources

Regards,

Patrick

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.

Hi Patrick, I had already configure the sp1 for CM4 in kernel dts.

109 &spi1 {
110         status = "disabled";
111 };
112
113 &m4_spi1 {
114         pinctrl-names = "rproc_default";
115         pinctrl-0 = <&spi1_pins_a>;
116         status = "okay";
117 };

And I also configure spi1 and spi5 on DK2 board. It's not working too.

On Linux side, could you please check RCC config in Device tree (especially if correct SPI kernel clock is enabled)

On M4 side, could you check if stm32mp1xx_hal_msp.c is updated for SPI1

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.