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

AON timer prescale_count is not reset after a new wkup_ctrl.prescaler is written #25417

Open
antmarzam opened this issue Nov 27, 2024 · 2 comments
Labels

Comments

@antmarzam
Copy link
Contributor

There is a bug in aon_timer_core.

The issue becomes visible in the following scenario:

  1. WKUP counter counts (wkup_ctrl.enable=1)
  2. WKUP count is disabled (wkup_ctrl.enable=0) leaving prescale_count_q=A
  3. WKUP count is enabled again, and a new wkup_ctrl.prescaler=B is written.

If B < A, the RTL will have to overflow prescaler_count_q before the new prescaler count becomes effective.

Assuming the expected use case for the WKUP counter is to set the prescaler and leave it as is until reset this isn't a critical bug.

The proposal is to reset prescaler_count_q every time a new wup_ctrl.prescaler value is written as well as the current reset on rst_aon_ni.

@antmarzam antmarzam added the Type:Bug Bugs label Nov 27, 2024
@marnovandermaas
Copy link
Contributor

Alternatively, you can change the equal sign to a greater than or equal sign:

(prescale_count_q == reg2hw_i.wkup_ctrl.prescaler.q);

@antmarzam
Copy link
Contributor Author

Alternatively, you can change the equal sign to a greater than or equal sign:

If we change it so it becomes: (prescale_count_q >= reg2hw_i.wkup_ctrl.prescaler.q); , then that would mean the first counted unit would be incremented without any prescaler increments. Would that be ok?

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

No branches or pull requests

2 participants