Skip to content

drivers: stepper: Fix stepper callbacks when using work_q #88835

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jbr7rr
Copy link

@jbr7rr jbr7rr commented Apr 20, 2025

Fix issue where stepper callbacks were not being called when using work_q. This was due to the steps being counted down before the work_q was rescheduled.

Added additional unit tests to stepper_api to verify the fix. Needed to increase the tolerance to 30% because of the timing of the work_q.

Fixes: #88821

- platform:native_sim/native/64:DTC_OVERLAY_FILE="boards/native_sim_adi_tmc2209_work_q.overlay"
extra_configs:
- CONFIG_GPIO=y
- CONFIG_COUNTER=y
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- CONFIG_COUNTER=y

- platform:native_sim/native/64:DTC_OVERLAY_FILE="boards/native_sim_ti_drv84xx_work_q.overlay"
extra_configs:
- CONFIG_GPIO=y
- CONFIG_COUNTER=y
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- CONFIG_COUNTER=y

Copy link
Member

@jilaypandya jilaypandya left a comment

Choose a reason for hiding this comment

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

Thanks for this Patch :)

can you run this script locally in order to fix compliance checks ./scripts/ci/check_compliance.py.

POLL_AND_CHECK_SIGNAL(stepper_signal, stepper_event, STEPPER_EVENT_STEPS_COMPLETED,
K_MSEC(pos * 120));
K_MSEC(pos * 130));
Copy link
Member

Choose a reason for hiding this comment

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

Might as well make the 130 a define or a config

Copy link
Author

Choose a reason for hiding this comment

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

Would adding Kconfig file with the parameter to the test and then adding the parameter to the testcase.yaml be a good solution?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, that would be great actually. Thanks.

@jbr7rr jbr7rr force-pushed the fix-stepper-callbacks-when-using-work_q branch from 988f785 to dfeb19e Compare April 22, 2025 12:32
Fix issue where stepper callbacks were not being called when
using work_q. This was due to the steps being counted down before
the work_q was rescheduled. Added additional unit tests to stepper_api
to verify the fix.

Signed-off-by: Josselin Bunt <josselin@sensible.health
@jbr7rr jbr7rr force-pushed the fix-stepper-callbacks-when-using-work_q branch from dfeb19e to 5d6dced Compare April 22, 2025 13:21
Copy link
Collaborator

@faxe1008 faxe1008 left a comment

Choose a reason for hiding this comment

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

This should be seperated into two commits.

@jbr7rr
Copy link
Author

jbr7rr commented Apr 22, 2025

This should be seperated into two commits.

How? Unit test and fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stepper: Callbacks not called when not using a dedicated timer
4 participants