If I put this part in the RTC config it’s solved. I will create a ticket in mbed project.
#if defined __HAL_RCC_RTCAPB_CLK_ENABLE __HAL_RCC_RTCAPB_CLK_ENABLE(); #endif /* __HAL_RCC_RTCAPB_CLK_ENABLE */