Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STM32 RTC : bypass shadow registers #7365

Merged
merged 1 commit into from
Jul 12, 2018

Conversation

jeromecoutant
Copy link
Collaborator

Description

RTC implementation has been reworked a little in order to gain reactivity and avoid some latency.

Major impact is LPTICKER feature.

Tests are OK on my side for each STM32 family and each tool chain.

@marcemmers @bulislaw @c1728p9 @ashok-rao

Pull request type

[ ] Fix
[x] Refactor
[ ] New target
[ ] Feature
[ ] Breaking change

c1728p9
c1728p9 previously approved these changes Jun 28, 2018
@cmonr cmonr requested review from bulislaw and ashok-rao June 29, 2018 02:53
@0xc0170
Copy link
Contributor

0xc0170 commented Jun 29, 2018

@jeromecoutant Needs rebase now. While rebasing, can you add extend the commit msg (which registers are shadow? Because some chips as I noticed do not have them as I read in the comment code - from changes not clear to me how is this actually addressing the issue
to gain reactivity and avoid some latency - how did you achieve these? ).

bulislaw
bulislaw previously approved these changes Jun 29, 2018
@cmonr
Copy link
Contributor

cmonr commented Jun 30, 2018

@marcemmers @bulislaw @c1728p9 @ashok-rao PR has been updated. Would y'all mind re-reviewing?

// Change the RTC current date/time
if (HAL_RTC_SetDate(&RtcHandle, &dateStruct, RTC_FORMAT_BIN) != HAL_OK) {
error("HAL_RTC_SetDate error\n");
}
if (HAL_RTC_SetTime(&RtcHandle, &timeStruct, RTC_FORMAT_BIN) != HAL_OK) {
error("HAL_RTC_SetTime error\n");
}

#if DEVICE_LPTICKER && !MBED_CONF_TARGET_LPTICKER_LPTIM
while (Read_SubSeconds != (RTC->SSR)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible that SSR increments and you get stuck in this loop?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SSR sub seconds register is reset to PREDIV_S value every second.
This prescaler value is set only during init, so I would say we can't get stuck...

@cmonr
Copy link
Contributor

cmonr commented Jul 11, 2018

Looks like this'll need a rebase before it can continue :/

- RTC_SSR for the subseconds
- RTC_TR for the time
- RTC_DR for the date

These registers were accessed through shadow registers which are synchronized with PCLK1 (APB1 clock).
They are now accessed directly in order to avoid waiting for the synchronization duration.
@jeromecoutant
Copy link
Collaborator Author

@cmonr Rebase is done

@cmonr
Copy link
Contributor

cmonr commented Jul 11, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Jul 11, 2018

Build : SUCCESS

Build number : 2571
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/7365/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Jul 11, 2018

@mbed-ci
Copy link

mbed-ci commented Jul 11, 2018

@cmonr cmonr merged commit e1df16e into ARMmbed:master Jul 12, 2018
@jeromecoutant jeromecoutant deleted the PR_RTC_SHADOW branch July 12, 2018 07:38
pan- pushed a commit to pan-/mbed that referenced this pull request Aug 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants