-
Notifications
You must be signed in to change notification settings - Fork 8.4k
drivers: pwm: nrfx: adjust PWM driver to fast PWM120 #80672
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
Fast PWM120 instance works with 320MHz clock, thus pwm_nrfx_get_cycles_per_sec needs to be adjusted. Also, it uses cachable RAM, thus sys_cache function needs to be added to flush the cached sequence. Upstream PR : zephyrproject-rtos/zephyr#80672 Signed-off-by: Michał Stasiak <[email protected]>
Fast PWM120 instance works with 320MHz clock, thus pwm_nrfx_get_cycles_per_sec needs to be adjusted. Also, it uses cachable RAM, thus sys_cache function needs to be added to flush the cached sequence. Upstream PR #: zephyrproject-rtos/zephyr#80672 Signed-off-by: Michał Stasiak <[email protected]>
drivers/pwm/pwm_nrfx.c
Outdated
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 we need to check in runtime whether d-cache operation is needed or not, depending on seq.values.p_raw memory region attributes. You can take inspiration from this PR: https://github.com/zephyrproject-rtos/zephyr/pull/80015/files , see UARTE_IS_CACHEABLE .
Maybe in the future we could switch to dmm for this shim, but let's it keep simple as this is hotfix
drivers/pwm/pwm_nrfx.c
Outdated
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.
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.
Since it is a hotfix, could we postpone the changes until the DMM rework?
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 don't see connection between this and DMM, but I'm fine with this staying temporarily if you post a follow-up PR.
3ab9af4 to
4ec37b3
Compare
drivers/pwm/pwm_nrfx.c
Outdated
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.
| #ifdef CONFIG_NRFX_PWM120 | |
| *cycles = 320ul * 1000ul * 1000ul; | |
| #else | |
| #ifdef CONFIG_NRFX_PWM120 | |
| *cycles = 320ul * 1000ul * 1000ul; | |
| #else |
this won't work when enabling multiple instances.
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 believe current solution will do, though it can be replaced with suitable macro introduced in future nrfx release
4ec37b3 to
711ec28
Compare
drivers/pwm/pwm_nrfx.c
Outdated
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.
-1, please, describe clock in DT and capture it, it is actually straightforward.
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 am affraid that would require adding clock property to every nrf pwm node. If thats not an issue, then sure.
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.
all that need it, yes. Just check the UART case.
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.
@gmarull won't it imply tree-wide change in all PWM nodes, in nRF52/53/91 devices as well? we wanted to avoid it
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 can be made optional, see
zephyr/drivers/serial/uart_nrfx_uarte.c
Lines 2290 to 2294 in 124aae3
| #define UARTE_GET_FREQ(idx) DT_PROP(DT_CLOCKS_CTLR(UARTE(idx)), clock_frequency) | |
| #define UARTE_GET_BAUDRATE_DIV(idx) \ | |
| COND_CODE_1(DT_CLOCKS_HAS_IDX(UARTE(idx), 0), \ | |
| ((UARTE_GET_FREQ(idx) / NRF_UARTE_BASE_FREQUENCY_16MHZ)), (1)) |
211755d to
ea712e3
Compare
686a78d to
d87e42f
Compare
d87e42f to
4891848
Compare
4891848 to
05031ac
Compare
05031ac to
6a8dc82
Compare
Added hsfll120 clock for fast PWM120 nodes. Signed-off-by: Michał Stasiak <[email protected]>
Fast PWM120 instance works with 320MHz clock, thus pwm_nrfx_get_cycles_per_sec needs to be adjusted, applying correct clock frequency. Also, it uses cachable RAM, thus sys_cache function needs to be added to flush the cached sequence. Signed-off-by: Michał Stasiak <[email protected]>
Add pin retenion if GPD is enabled for nRF54H20. Signed-off-by: Michał Stasiak <[email protected]>
f31e675
6a8dc82 to
f31e675
Compare
Fast PWM120 instance works with 320MHz clock, thus
pwm_nrfx_get_cycles_per_secneeds to be adjusted.Also, it uses cachable RAM, thus sys_cache function needs to be added to flush the cached sequence.