cancel
Showing results for 
Search instead for 
Did you mean: 

RTC Clock Source Selecton Issue - STM32MP135F

skarayigit
Associate III

Hi,

I'm having an issue with RTC module. getting an error due to no clock source is connected to rtc_ck:

[ 3.645423] stm32_rtc 5c004000.rtc: rtc_ck is slow
[ 3.749902] stm32_rtc 5c004000.rtc: Can't enter in init mode. Prescaler config failed.
[ 3.756489] stm32_rtc: probe of 5c004000.rtc failed with error -110

when I checked the clocks:

root@stm32mp1:~# cat /sys/kernel/debug/clk/clk_summary |grep rtc
rtcapb 0 0 0 66625000 0 0 50000 Y
ck_rtc 0 0 0 0 0 0 50000 Y
root@stm32mp1:~# cat /sys/kernel/debug/clk/clk_summary |grep lse
ck_lse 0 0 0 32768 0 0 50000 Y

Also checked the RCC_BDCR @ 0x50000400 and the returned value is 0x00100035 which means RTCSRC[1:0] register is 0. That means it is not selecting any other clock source (LSE, LSI and HSE/DIV). I have tried to change and select every clock source configuration from CubeMX using RTC Clock Mux, no luck. It doesn't choose a clock source and it stays conneted to 0. 

I have read and tried to solve it using the sources below:

https://wiki.stmicroelectronics.cn/stm32mpu/index.php?title=RTC_device_tree_configuration&stable=1

https://wiki.st.com/stm32mpu/wiki/RCC_internal_peripheral

https://wiki.st.com/stm32mpu/wiki/Clock_device_tree_configuration

What might be the issue here? 

Optee DT:

#include <dt-bindings/rtc/rtc-stm32.h>
/{ /* Root*/
clocks {
        clk_hsi: clk-hsi {
            clock-frequency = <64000000>;
        };
        clk_lse: clk-lse {
            clock-frequency = <32768>;
            st,drive = < LSEDRV_MEDIUM_HIGH >;
        };
        clk_hse: clk-hse {
            clock-frequency = <24000000>;
        };
        clk_i2sin: clk-i2sin {
            status = "disabled";
        };
    };
};
&rcc{
    pinctrl-names = "default";
    pinctrl-0 = <&rcc_pins_mx>;
    status = "okay";
    clocks = <&clk_hse>, <&clk_hsi>, <&clk_lse>, <&clk_lsi>, <&clk_csi>;
    clock-names = "clk-hse", "clk-hsi", "clk-lse", "clk-lsi", "clk-csi";
    st,clksrc=<
        CLK_MPU_PLL1P
        CLK_AXI_PLL2P
        CLK_MLAHBS_PLL3
        CLK_RTC_LSE
        CLK_MCO1_LSE
        CLK_MCO2_DISABLED
        CLK_CKPER_HSE
        CLK_ETH1_PLL4P
        CLK_ETH2_PLL4P
        CLK_SDMMC1_PLL4P
        CLK_STGEN_HSE
        CLK_USBPHY_HSE
        CLK_I2C4_HSI
        CLK_USBO_USBPHY
        CLK_ADC1_CKPER
        CLK_ADC2_CKPER
        CLK_I2C12_HSI
        CLK_I2C5_HSI
        CLK_UART2_HSI
        CLK_UART4_HSI
        CLK_SAI1_PLL4Q
        CLK_RNG1_PLL4R
        CLK_SAES_AXI
        CLK_LPTIM3_PCLK3
    >;
    st,clkdiv = <
        DIV(DIV_MPU, 1)
        DIV(DIV_AXI, 0)
        DIV(DIV_MLAHB, 0)
        DIV(DIV_APB1, 1)
        DIV(DIV_APB2, 1)
        DIV(DIV_APB3, 1)
        DIV(DIV_APB4, 1)
        DIV(DIV_APB5, 2)
        DIV(DIV_APB6, 1)
        DIV(DIV_RTC, 0)
        DIV(DIV_MCO1, 0)
        DIV(DIV_MCO2, 0)
    >;
    ...
};
&rtc{
    pinctrl-names = "default";
    pinctrl-0 = <&rtc_pins_mx>;
    status = "okay";
    /* USER CODE BEGIN rtc */
    st,alarm = <RTC_OUT1>;
    /* USER CODE END rtc */
};

 

2 REPLIES 2
skarayigit
Associate III

Cube MX Configs for RTC.   

 

Screenshot 2024-02-22 132131.png

Screenshot 2024-02-22 132101.png

Screenshot 2024-02-22 132114.png

skarayigit
Associate III

Hello, @Olivier GALLIEN, could you help me with this or tag someone who could help? Thanks. I believe that the RTC is very basic but I cannot find what I am missing.