-
Notifications
You must be signed in to change notification settings - Fork 3k
Ticker free() - requirements, pseudo code, tests, implementation #7508
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
Conversation
build failures in CI: |
Yes, like I mentioned in the description. Implementation of |
@c1728p9 @0xc0170 I'm not sure if requirements for ' Should we use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good aside from the requirement that the ticker stops counting.
hal/us_ticker_api.h
Outdated
@@ -73,6 +73,9 @@ extern "C" { | |||
* Verified by ::ticker_fire_now_test | |||
* * The ticker operations ticker_read, ticker_clear_interrupt, ticker_set_interrupt and ticker_fire_interrupt | |||
* take less than 20us to complete - Verified by ::ticker_speed_test | |||
* * The function ticker_free stops the ticker from counting and disables the ticker interrupt - |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't be a requirement that the ticker stops counting, since some low power ticker implementations are backed by an RTC which may keep counting.
440fda4
to
4039e31
Compare
Fixed after review and added implementation for CI boards. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I left few comments.
targets/TARGET_STM/lp_ticker.c
Outdated
@@ -231,7 +231,8 @@ void lp_ticker_clear_interrupt(void) | |||
|
|||
void lp_ticker_free(void) | |||
{ | |||
|
|||
LptimHandle.Instance = LPTIM1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is useless as the LptimHandle is not used.
targets/TARGET_STM/lp_ticker.c
Outdated
} | ||
|
||
void lp_ticker_free(void) | ||
{ | ||
|
||
//NVIC_DisableIRQ(RTC_WKUP_IRQn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line ?
targets/TARGET_STM/lp_ticker.c
Outdated
@@ -231,7 +231,8 @@ void lp_ticker_clear_interrupt(void) | |||
|
|||
void lp_ticker_free(void) | |||
{ | |||
|
|||
LptimHandle.Instance = LPTIM1; | |||
NVIC_DisableIRQ(LPTIM1_IRQn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not call the lp_ticker_disable_interrupt() instead ?
targets/TARGET_STM/us_ticker.c
Outdated
@@ -259,6 +259,6 @@ void restore_timer_ctx(void) | |||
|
|||
void us_ticker_free(void) | |||
{ | |||
|
|||
__HAL_TIM_DISABLE_IT(&TimMasterHandle, TIM_IT_CC1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not call the us_ticker_disable_interrupt() instead ?
@bcostm Thanks for the review. |
/morph build |
@mprse I believe test will fail as some targets need free implemented |
Hopefully I manage to add ticker free for all targets. For CI targets ticker free is implemented to be consistent with requirements (I couldn't test all CI boards since I do not have all of them). For other boards I just added empty stub of ticker free function. |
Build : FAILUREBuild number : 2660 |
Test for systimer initialises ticker interface with stubs. This needs to be updated and ticker free function must be included. |
Fixed |
/morph build |
Build : FAILUREBuild number : 2663 |
Looking at the previous test runs, this is the new issue, and seems not related here (could be an issue on master) Restarting to confirm /morph test |
Yes you're right. I think also there should be a problem somewhere in the code managing the LPTIM. But no idea at first glance...
This is the list of the boards having the LPTICKER/LPTIM configuration in targets.json: DISCO_F413ZH Do you have one of them ? |
@bcostm From that list, we only have NUCLEO_F746ZG in CI. |
Test : FAILUREBuild number : 2430 |
Wow, quite the apt timing with that last failure. |
I was just thinking that maybe you have one of the other boards on your desk/office ? I'll try to run this test on other boards. |
@cmonr Thanks for clarification. I have successfully reproduced the failure on NUCLEO_L476RG and I'm looking into it. |
This PR provides implementation of ticker_free() function for the following boards: ARCH_PRO EV_COG_AD3029LZ EV_COG_AD4050LZ K22F K64F K82F KW24D KW41Z LPC546XX NRF51_DK NRF52_DK NUCLEO_F207ZG NUCLEO_F401RE NUCLEO_F429ZI NUCLEO_F746ZG REALTEK_RTL8195AM
… the ticker interface.
I have modified STM |
/morph build |
Build : FAILUREBuild number : 2724 |
…uring. In `ticker speed` test case execution time of ticker API functions is measured using Timer object. Test replaces original ticker handler for testing purposes, so test should not relay on higher level ticker based features(like Timer). Use low level ticker API for time measuring.
Added fix for boards without lp ticker. |
/morph build |
Build : SUCCESSBuild number : 2726 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 2362 |
Test : SUCCESSBuild number : 2457 |
Ticker free() - requirements, pseudo code, tests, implementation
Description
This patch fixes ticker
ticker_free()
issue.@c1728p9 Can you please take a look at the requirements, tests and example implementation?
TODO
ticker_free()
for one target for verification (NRF5x
family boards).ticker_free()
implementation for the remaining boards.Pull request type