Skip to content

Nuvoton: Rework us_ticker, lp_ticker and RTC #6028

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

Closed
wants to merge 2 commits into from

Conversation

ccli8
Copy link
Contributor

@ccli8 ccli8 commented Feb 7, 2018

Description

This PR updates for all Nuvoton targets:

  • NUMAKER_PFM_NUC472
  • NUMAKER_PFM_M453
  • NUMAKER_PFM_M487
  • NUMAKER_PFM_NANO130

It has the following updates:

  1. Rework us_ticker/lp_ticker. Because upper layer (hal/mbed_ticker_api.c) has addressed ticker frequency/bit size/some wrap-around issues, us_ticker/lp_ticker are reworked to make code more concise and reasonable.
  2. Rework RTC. H/W RTC just supports year range 2000~2099, but time/set_time requires POSIX time which starts from 1970. The rework fixes it by using H/W RTC to keep elapsed time since some time point rather than real date time.

ccli8 added 2 commits February 7, 2018 09:09
The rework includes the following:
1. Remove ticker overflow handling because upper layer (mbed_ticker_api.c) has done with it.
   This makes us_ticker/lp_ticker implementation more succinct and avoids potential error.
2. Refine timer register access with low-power clock source
The rework includes the following:
1. Support year range beyond H/W RTC 2000~2099.
2. Refine RTC register access with low-power clock source
TIMER_EnableInt(timer3_base);
TIMER_EnableWakeup((TIMER_T *) NU_MODBASE(timer3_modinit.modname));
/* NOTE: When engine is clocked by low power clock source (LXT/LIRC), we need to wait for 3 engine clocks. */
Copy link
Contributor

Choose a reason for hiding this comment

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

what does engine mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@0xc0170 It means just the Timer H/W. For power-saving consideration, H/W is so designed. When its clock source is low power oscillator (LXT/LIRC), wait cycles are needed to avoid the programming pitfall.

@0xc0170 0xc0170 requested a review from bulislaw February 7, 2018 15:03
@0xc0170
Copy link
Contributor

0xc0170 commented Feb 8, 2018

Can you split this to two PR? RTC and another one us/lp ticker changes?

@ccli8
Copy link
Contributor Author

ccli8 commented Feb 9, 2018

Can you split this to two PR? RTC and another one us/lp ticker changes?

@0xc0170 OK. I will split this PR into two.

@ccli8 ccli8 closed this Feb 9, 2018
@sg- sg- removed the needs: work label Feb 9, 2018
@ccli8 ccli8 deleted the nuvoton branch February 9, 2018 01:23
@ccli8
Copy link
Contributor Author

ccli8 commented Feb 9, 2018

@0xc0170 I've split this PR into #6048 and #6049.

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 9, 2018

Thanks, we will review them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants