-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add test for periph timer #30
base: master
Are you sure you want to change the base?
Add test for periph timer #30
Conversation
@MichelRottleuthner can you squash please? |
89de720
to
5ab0c74
Compare
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.
I think the python interface and robot tests can be structured and simplified, however that can be done in a follow up PR (by me). Still some changes to the shell-based test firmware
tests/periph_timer_cli/main.c
Outdated
cmd_timer_bench_read }, | ||
{ "timer_init", "init_timer", cmd_timer_init }, | ||
{ "timer_set", "set timer to relative value", cmd_timer_set }, | ||
{ "timer_absolute", "set timer to absolute value", cmd_timer_absolute }, |
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.
should be timer_set_absolute
to match (current) API
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.
done
tests/periph_timer_cli/main.c
Outdated
} | ||
|
||
timer_start(timer_dev); | ||
puts("Success: timer_start()\n"); |
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.
better use _print_cmd_result
here too
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.
done
tests/periph_timer_cli/main.c
Outdated
} | ||
|
||
timer_stop(timer_dev); | ||
puts("Success: timer_stop()\n"); |
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.
same here, use _print_cmd_result
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.
done
tests/periph_timer_cli/main.c
Outdated
|
||
static gpio_t _get_pin(const char *port_str, const char *pin_str) | ||
{ | ||
int port = _get_num(port_str); |
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.
error case is not checked here and below, i.e. CONVER_ERROR
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.
done
tests/periph_timer_cli/main.c
Outdated
|
||
if (temp == str || *temp != '\0' || | ||
((val == LONG_MIN || val == LONG_MAX) && errno == ERANGE)) { | ||
val = CONVERT_ERROR; |
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.
the error case is not evaluated in many cases where this function is used. Maybe change to
static inline int _get_num(const char *str, uint32_t *val)
and return value by reference and error as return?
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.
done
This the first few tests for periph/timer.
To make this work properly on all boards we need to provide the debug pin configuration with the environment, i.e. tell the test which pin of the DUT is connected to DEBUG0 of PHiLIP
Known issues:
The trace mechanism of PHiLIP sometimes reports timings that are not accurate.
This causes problems with the jitter test because sometimes delays around ~1.8 ms are added to the actual measurement. I verified with the scope that the timing deviation in this case actually didn't come from the DUT.
I discussed this offline with @MrKevinWeiss and we agreed that the best solution for this would be to use the capture features of the PHiLIP timer.