STM32 Example

STM32 RTC Example

Read current date and time from RTC.

Code Example

RTC_TimeTypeDef sTime;
RTC_DateTypeDef sDate;

HAL_RTC_GetTime(&hrtc, &sTime, RTC_FORMAT_BIN);
HAL_RTC_GetDate(&hrtc, &sDate, RTC_FORMAT_BIN);

How it works

This STM32 example demonstrates basic peripheral configuration and HAL usage.

Frequently asked questions

Can I use STM32CubeIDE?

Yes. These examples are intended for STM32CubeIDE and STM32 HAL drivers.

Can I modify the GPIO pins?

Yes. Update GPIO pin definitions according to your board schematic.