Skip to content

Conversation

@ioannis-karachalios
Copy link
Contributor

@ioannis-karachalios ioannis-karachalios commented Nov 10, 2024

  1. As per the PWM API definition, -EBUSY should be returned when pwm_enable_capture is called while capturing
    is already enabled. This commit should deal with adding a ztest_suite_before_t function that should disable capturing.
    Some tests, though, such as test_pulse_capture, execute two sub-tests and so, capturing is disabled in between.
    In fact, the omission of pwm_disable_capture should not only result in aborting a single test, but it can also raise system exception due to invalid context. This is the case for z_impl_pwm_capture_cycles where z_pwm_capture_cycles_callback can be fired whilst the routine has already aborted (without disabling capturing) and so struct z_pwm_capture_cb_data data, defined within function declaration, should not longer be valid.
  2. For the inverted pulse measurements, that should reflect the duty-cycle off interval, the 1% deviation in test_capture should be adjusted so it reflects duty-cycle off.

Fixes #81199

@zephyrbot zephyrbot added the area: PWM Pulse Width Modulation label Nov 10, 2024
@ioannis-karachalios ioannis-karachalios added this to the v4.0.0 milestone Nov 10, 2024
@ioannis-karachalios ioannis-karachalios added the bug The issue is a bug, or the PR is fixing a bug label Nov 10, 2024
@mmahadevan108 mmahadevan108 modified the milestones: v4.0.0, v4.1.0 Nov 12, 2024
Comment on lines 103 to 109
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is not really related to missing pwm_disable_capture() calls. It should be done in a separate commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to a separate commit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this seems to be unneeded.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

As per the PWM API definition, -EBUSY should be returned
when pwm_enable_capture is called and capturing
is already enabled. This commit deals with adding
a ztest_suite_before_t function that should disable
capturing at the end of a single test. Some tests, though,
such as test_pulse_capture, execute two sub-tests
and so, capturing is disabled in between. In fact, the omission
of pwm_disable_capture should not only result in aborting
a single test, but it can also raise system exception
due to invalid context. This is the case for
z_impl_pwm_capture_cycles where z_pwm_capture_cycles_callback
can be fired whilst the routine has already aborted and so
struct z_pwm_capture_cb_data data, defined within function
declaration, should not longer be valid.

Signed-off-by: Ioannis Karachalios <[email protected]>
@ioannis-karachalios ioannis-karachalios force-pushed the test-pwm-loopback-missing-capture-disable-fix branch from 9f49762 to 8c93121 Compare November 25, 2024 17:53
For the inverted pulse measurements, that should reflect
the duty-cycle off interval, the 1% deviation in test_capture
should be adjusted so it reflects duty-cycle off.

Signed-off-by: Ioannis Karachalios <[email protected]>
@kartben
Copy link
Contributor

kartben commented Dec 3, 2024

ping @henrikbrixandersen, if you could please re-approve

@kartben kartben merged commit 221c4d3 into zephyrproject-rtos:main Dec 3, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: PWM Pulse Width Modulation bug The issue is a bug, or the PR is fixing a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PWM Loopback Test Misses Disabling Capture

6 participants