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

Consistent behavior of us_ticker_init accross targets #8558

Closed
LaurentLouf opened this issue Oct 26, 2018 · 5 comments
Closed

Consistent behavior of us_ticker_init accross targets #8558

LaurentLouf opened this issue Oct 26, 2018 · 5 comments

Comments

@LaurentLouf
Copy link
Contributor

LaurentLouf commented Oct 26, 2018

Description

I have noticed that compared to most of other targets, the us_ticker_init on STM targets does not any mechanism to check if the ticker has already been initialized. For example, on target MAX_32620, we have the following, simple yet effective :

void us_ticker_init(void)
{
if (us_ticker_inited)
return;
us_ticker_inited = 1;
[...]
}

And we have something similar for a lot of other targets, but at least the target STM is missing this feature. This would be nice to have a consistent behavior across all targets to be sure that calling multiple times us_ticker_init will only initialize the ticker once.

Issue request type

[ ] Question
[x] Enhancement
[ ] Bug

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 26, 2018

From the specs (related to ticker init):

    • The function ticker_init is safe to call repeatedly - Verified by test ::ticker_init_test
    • The function ticker_init allows the ticker to keep counting and disables the ticker interrupt - Verified by test ::ticker_init_test

@c1728p9 Please review

@c1728p9
Copy link
Contributor

c1728p9 commented Oct 26, 2018

Hi @LaurentLouf the ticker specification requires that calling ticker_init disables ticker interrupts. This is to ensure that when using an application with a bootloader, any pending ticker events setup by the bootloader are not unintentionally triggered in the application during ticker_init.

The code you have show above doesn't conform to this behavior so this is actually a bug in the MAX32620. All devices should perform some initialization on multiple calls to us_ticker_init.

One part of us_ticker_init that is implementation defined is if the internal counter is reset or keeps counting where it left off. The MCU vendor can change this behavior to best suite the hardware. The mbed code making use of the ticker uses an offset from when us_ticker_init was called so it works the same in both cases.

@ciarmcom
Copy link
Member

Internal Jira reference: https://jira.arm.com/browse/MBOCUSTRIA-110

@elm3
Copy link

elm3 commented Jan 7, 2019

@ARMmbed/team-maximintegrated

@ciarmcom
Copy link
Member

Thank you for raising this issue. Please note we have updated our policies and
now only defects should be raised directly in GitHub. Going forward questions and
enhancements will be considered in our forums, https://forums.mbed.com/ . If this
issue is still relevant please re-raise it there.
This GitHub issue will now be closed.

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

No branches or pull requests

7 participants