cancel
Showing results for 
Search instead for 
Did you mean: 

Error activating spi module in Yocto Linux project

thp9
Associate II

Hello,

I have a Yocto Project with st-stm32mp1 layer, using Poky distribution along with customized CubeMX machine that I created using st-stm32mp1-addons layers

I need to use the spi5 module, so I activated it through CubeMX for the "A7NS" runtime context.

I compiled and run the machine, but during boot I get this message:

[ 1.533147] spi_stm32 44009000.spi: clk rate = 0               

[ 1.536942] spi_stm32: probe of 44009000.spi failed with error -22  

I also tried with spi1 and got the same error message.

All my kernel variables are default ( SPI=y, SPI_MASTER=y, SPI_STM32=y, SPI_SPIDEV=y)

I also haven't touch any clock configuration in CubeMX, everything should be default.

I uploaded my boot log as attachment, you can find the error message at line 223. There are two messages because I tried with both spi1 and spi5.

I have also uploaded my machine configuration file, along with the cubeMX project

Any idea why this would happen ?

Thanks for your help,

1 ACCEPTED SOLUTION

Accepted Solutions
thp9
Associate II

I fixed this problem after removing a redefinition of RCC generated by CubeMX under tf-a dts file. There were 2 configurations of RCC defined: first one with spi clock configured as it should, and another at the end of the file under section "user code addons" in which the spi clock was disabled for a reason unknown

View solution in original post

6 REPLIES 6
TDK
Guru

This is the STM32 MCU forum. The STM32 MPU forum is here:

https://community.st.com/stm32mpu

You'll probably have better luck asking there.

If you feel a post has answered your question, please click "Accept as Solution".
thp9
Associate II

My post is not listed on a single forum but multiple ones according to the topics I have chosen below my post. Some topics may be sub topics of STM32 MCU this is why you saw it there, but it's also there in the MPU forums.

I had no idea the forum worked that way. Thanks for the explanation. Probably STM32CubeMX is a member of both.

If you feel a post has answered your question, please click "Accept as Solution".
thp9
Associate II

I fixed this problem after removing a redefinition of RCC generated by CubeMX under tf-a dts file. There were 2 configurations of RCC defined: first one with spi clock configured as it should, and another at the end of the file under section "user code addons" in which the spi clock was disabled for a reason unknown

Hi. Do you mind writing what exactly have you done ? I have modified tf-a dts to enable in my case SPI45 clocks but it didn't help much and I still get clk rate = 0.

AMill.9
Associate II

Hi,

I have the same error and I wasn't able to see a redifined RCC generated by CubeMX in my tf-a dts file. I 'm using the buildroot config: st_stm32mp157f_dk2_demo_defconfig provided by github buildroot-external-st repository (new member so can't add link)

After generating from CubeMX I added the following user code in my linux-dts and uboot-dts files:

&spi5{

pinctrl-names = "default", "sleep";

pinctrl-0 = <&spi5_pins_mx>;

pinctrl-1 = <&spi5_sleep_pins_mx>;

 cs-gpios= <&gpiof 6 0>;

status = "okay";

/* USER CODE BEGIN spi5 */

 spidev@0{

  compatible = "linux,spidev";

  reg = <0>;

  spi-max-frequency = <4000000>;

 };

/* USER CODE END spi5 */

};

I also ensured:

CLK_SPI2S23_PLL3Q

CLK_SPI45_PCLK2

are set in my tfa-dts file

I'm out of ideas for solving this and would appreciate if anyone could help me troubleshoot