Skip to content

STM32: RTC No Longer Enabled by Reading the Time #9176

@mattbrown015

Description

@mattbrown015

Description

I think this #8777 causes a problem! :-(

@jeromecoutant tried to sneak in a cheeky optimisation that, AFAICT, isn't important for the PR i.e. STM32 RTC : skip rtc_write if possible.

This change means the RTC doesn't get enabled when previously it did.

time in mbed_rtc_time.cpp does this:

time_t time(time_t *timer)
{
    _mutex->lock();
    if (_rtc_isenabled != NULL) {
        if (!(_rtc_isenabled())) {
            set_time(0);
        }
    }
    ...
}

But, if the RTC isn't enabled its value is probably 0 and set_time(0) will just return early without doing anything!

Issue request type

[ ] Question
[ ] Enhancement
[X] Bug

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions