cancel
Showing results for 
Search instead for 
Did you mean: 

SPI5 clock in STM32MP151

vsaakian
Associate III

Working on setting up SPI bus and get a connection to ESP32C6 WiFi/BT module. Trying to configure SPI5 clock in device tree for STM32MP151. Have used different sources (HSI, HSE, PLL4Q), but the enable count on the SPI5_k clock is always zero. I am suspecting now that problem must be elsewhere. Has anyone stumbled upon this? 

14 REPLIES 14

Thanks. I also suspect it is a driver issue. I tried to plug in a driver from ESP32 (esp-hosted-ng), but I am not sure how to do it properly right now. It is "baked" together with image, but I am just not sure what to write in "compatible" field

@vsaakian ,
I have no knowledge about this driver, I think you could get some support to know how to use it with your Linux system thanks to people who made it.

Kind regards,
Erwan.

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 Erwan,
We had some progress on this and currently the driver kernel module is loaded, but the clock looks still disabled

Right now SPI5 it is configured to use CLK_SPI45_HSE which is 24 MHz, but enable count in clock tree is still 0:
vsaakian_0-1702983239233.png
SPI device configuration in the device tree looks like following:
&spi5{
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&spi5_pins_mx>;
    pinctrl-1 = <&spi5_sleep_pins_mx>;
    cs-gpios = <&gpioj 1>;
     cs-num = <1>;
    status = "okay";
 
    esp32spi@0 {
         status = "disabled";
        compatible = "semtech,sx1301";
        reg = <0>; /* CS #0 */
        spi-max-frequency = <24000000>;
        reset-gpios = <&gpiof 15 GPIO_ACTIVE_HIGH>;
    };
};
 
The device is disabled because we are running a kernel module with the driver.

Pin configuration is the following:
      spi5_pins_mx: spi5_mx-0 {
            pins1 {
                  pinmux = <STM32_PINMUX('K', 0, AF5)>, /* SPI5_SCK */
                             <STM32_PINMUX('J', 10, AF5)>, /* SPI5_MOSI */
                               <STM32_PINMUX('J', 1, GPIO)>; /* CHIP SELECT */
                  bias-disable;
                drive-push-pull;
                slew-rate = <1>;
            };
 
            pins2 {
                  pinmux = <STM32_PINMUX('J', 11, AF5)>; /* SPI5_MISO */
                  bias-disable;
            };
      };
 
      spi5_sleep_pins_mx: spi5_sleep_mx-0 {
            pins {
                  pinmux = <STM32_PINMUX('K', 0, ANALOG)>, /* SPI1_SCK */
                               <STM32_PINMUX('J', 10, ANALOG)>, /* SPI_MOSI */
                               <STM32_PINMUX('J', 11, ANALOG)>, /* SPI_MISO */
                               <STM32_PINMUX('J', 1, ANALOG)>; /* CHIP SELECT */
            };
      };
 
 
When driver is probed module can successfully load and it looks like we get interrupts from DATA_READY and HANDSHAKE:
vsaakian_1-1702983239235.png

 

However, interrupt events are not handled in work queue it seems. Could it be that the problem is still lies in clock configuration? We have tried to run it on as low as 1 MHz on both ESP32 firmware and Linux host with the same result.

Hello @vsaakian ,
Did you try to get the clk_summary after the load of the module ? 
Did you try to check signals at oscilloscope to see if everything looks okay ?

Kind regards,
Erwan.

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.

I could see the clock using oscilloscope, it's frequency however is 20 times lower than configured. I start the driver with 1MHz configured and what I get out is 50KHz. SPI5 is set up to use HSE clock of 24MHz. Trying to understand if there's any divider on the driver side..