Device : STM32F103C8T6 (minimal development board)
When enabling the RTC peripheral, I noticed that CubeMX shows a selection box to enable or leave the tamper output ( PC13 ) unused.
I deselected the "Tamper" box, and expected to have the PC13 available for GPIO, as it has the onboard LED connected. But the CubeMX claims the PC13 pin anyhow, when the RTC module is enabled. The initialisation code resets the pin and thus turns on the LED. The specific code that is responsible for this behaviour is in: stm32f1xx_hal_rtc.c on line 299 :
/* Set the signal which will be routed to RTC Tamper pin*/
MODIFY_REG(BKP->RTCCR, (BKP_RTCCR_CCO | BKP_RTCCR_ASOE | BKP_RTCCR_ASOS), hrtc->Init.OutPut);
which assigns the alternate function "ASOE" to PC13.
To my opinion, the Tamper functionality should only be included when it is enabled in CubeMX.
Reconfiguring PC13 for GPIO requires the backup register RTCCR at 0x40006c2c to be cleared.