-
Notifications
You must be signed in to change notification settings - Fork 2k
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
drivers/include/periph: add FREQM peripheral driver #20020
Conversation
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.
Give it a quick try and it works nice !
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 is looking good!
Some nits and a suggestion to simplify the API:
cpu/samd5x/include/periph_cpu.h
Outdated
#ifndef SAM0_GCLK_MAIN | ||
#define SAM0_GCLK_MAIN 0 /**< 120 MHz main clock */ | ||
#endif |
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.
#ifndef SAM0_GCLK_MAIN | |
#define SAM0_GCLK_MAIN 0 /**< 120 MHz main clock */ | |
#endif | |
#define SAM0_GCLK_MAIN 0 /**< 120 MHz main clock */ |
Main Clock is fixed to GCLK0
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.
Is it possible that SAM0_GCLK_32KHZ
is also fixed? When trying to overwrite it I didn't get any text on the terminal.
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 shoudln't be, unless it's hard-coded somewhere.
But maybe we should add some static_assert()
to ensure no two GCLKs are configured to the same ID.
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 pretty good now!
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!
Only some minor nitpicks.
b07dca4
to
bfb3b5f
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.
Looks good, thank you for your contribution!
Looks like something is missing with Kconfig. |
Contribution description
This PR adds a peripheral driver for frequency meter (FREQM). Tested with SAM E54 XPLAINED PRO EVALUATION KIT (ATSAME54P20A microcontroller).
I think I have access to some other boards to test the driver in the near future.
Testing procedure
As the FREQM needs a reference clock to measure the frequency of another clock this test uses two internal clocks. The slower internal clock is used as reference to measure the faster internal clock.
The test can be invoked with:
Expected result (via serial):