Value definitions in generated file stm32f4xx_hal_rtc.h are incorrect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-01-02 3:56 AM
Hello, team!
In the stm32f4xx_hal_rtc.h header, the values for the months are set incorrectly
/* Coded in BCD format */
#define RTC_MONTH_JANUARY ((uint8_t)0x01)
#define RTC_MONTH_FEBRUARY ((uint8_t)0x02)
#define RTC_MONTH_MARCH ((uint8_t)0x03)
#define RTC_MONTH_APRIL ((uint8_t)0x04)
#define RTC_MONTH_MAY ((uint8_t)0x05)
#define RTC_MONTH_JUNE ((uint8_t)0x06)
#define RTC_MONTH_JULY ((uint8_t)0x07)
#define RTC_MONTH_AUGUST ((uint8_t)0x08)
#define RTC_MONTH_SEPTEMBER ((uint8_t)0x09)
#define RTC_MONTH_OCTOBER ((uint8_t)0x10) --> in decimal, this is 16
#define RTC_MONTH_NOVEMBER ((uint8_t)0x11) --> in decimal, this is 17
#define RTC_MONTH_DECEMBER ((uint8_t)0x12) --> in decimal, this is 18
The last three, shall be 0x0A, 0x0B, 0x0C in this order.
Can you please fix this?
- Labels:
-
RTC
-
STM32Cube MCU Packages
-
STM32F4 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-01-02 4:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-01-02 11:30 AM
Yes, this is exactly the same question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-01-02 11:43 AM
/* Coded in BCD format */ not an error. The RTC has few transistors as it doesn't need to handle humans with their decimals.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-01-02 2:59 PM
Absolutely, I added that line for easier identification within the file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-01-02 3:28 PM
Yes, so the hardware has BCD counters, per thread cited by Jan, the constants are provided to facilitate that.
If you want to pass binary values and have the RTC API code translated them, just use 1-12, and define a set of constants for that model if your code needs such, ST has the BCD ones because the number-space appears non-continuous and is liable to trap the unwary.
Up vote any posts that you find helpful, it shows what's working..
