...
This application note explains how to use the STM32H7 RTC in the FreeRTOS demo application.
1. Understanding RTC Interfaces
1.1. FreeRTOS RTC Implementation
The FreeRTOS BSP makes use of the STM32CubeH7 software component to provide a device driver for the STM32H7 RTC. The driver is configured (enabled / disabled) at the BSP build time, using the HAL_RTC_MODULE_ENABLED configuration option, defined in the stm32h7xx_hal_conf.h file.
1.2. FreeRTOS RTC C-Binding API
The RTC driver implements the following C-binding API:
...
Code Block |
---|
typedef struct { uint32_t HourFormat; /* Specifies the RTC Hour Format. */ uint32_t AsynchPrediv; /* Specifies the RTC Asynchronous Predivider value. */ uint32_t SynchPrediv; /* Specifies the RTC Synchronous Predivider value. */ uint32_t OutPut; /* Specifies which signal will be routed to the RTC output. */ uint32_t OutPutRemap; /* Specifies the remap for RTC output. */ uint32_t OutPutPolarity; /* Specifies the polarity of the output signal. */ uint32_t OutPutType; /* Specifies the RTC Output Pin mode. */ } RTC_InitTypeDef; |
2. RTC CLI Command
The FreeRTOS application implements the following RTC related CLI command:
Command | Description | Comments |
rtc_get_date | Get the RTC time and date | |
rtc_set_date YYYY:MM:DD:hh:mm | Set the RTC time and date | YYYY - year to be set; MM - month to be set; DD - date to be set; hh - hours to be set; mm - minutes to be set |
3. Validating RTC Operation
Use the following step-wise procedure to validate the FreeRTOS RTC operation:
...