Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: stepper: add stepper driver for allegro a4979 #86620
base: main
Are you sure you want to change the base?
drivers: stepper: add stepper driver for allegro a4979 #86620
Changes from 2 commits
fb0a8e5
f1f5dd9
045be44
07cf50b
9ac0968
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check failure on line 21 in drivers/stepper/allegro/a4979.c
TRAILING_WHITESPACE
Check failure on line 35 in drivers/stepper/allegro/a4979.c
TRAILING_WHITESPACE
Check failure on line 82 in drivers/stepper/allegro/a4979.c
ELSE_AFTER_BRACE
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.
Disabling of the timing source was fine in case of calling this with
false
what I meant with my comment is if there is a benefit to setting the step pin to0
after disabling 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.
This is taken from the drv824 driver. The drv8424 only takes a step on a rising edge. Thus it is there to ensure that the step pin has the correct value when a new movement command is called. Before step-dir was separated, the step pin was in state high for half of the step time and thus the disable command could otherwise leave the step pin in high, which would lead to a missing step for the new movement command.
I am not sure if this can still happen with the current step-dir implementation, as it toggles the pin twice in the same interrupt. That said, it still ensures the correct pin value, but one could argue, that it better fits during enabling.
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.
Just realized during testing that disabling of the timing source now was missing.
The a4979 also only takes a step on a rising edge. The implementation does work without ensuring the step pin having the correct value before a new movement command is called. Still I think it would make sense to set the step pin to zero during the init function. What are your opinions?
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.
0 on init would make sense, through 0 on enable (before setting enable pin to 1) might also make sense. At least on the drv8424 the step pin value is irrelevant while disabled but becomes important once enabled. I admit, I dont know what happens on the driver when you enable with step pin on 1. That said, this depends on how one views things happening on the step pin while disabled. If this is classified as undefined behavior, then 0 on init is enough.
Check failure on line 169 in drivers/stepper/allegro/a4979.c
TRAILING_WHITESPACE
Check failure on line 200 in drivers/stepper/allegro/a4979.c
TRAILING_WHITESPACE
Check warning on line 272 in drivers/stepper/allegro/a4979.c
LONG_LINE
Check warning on line 273 in drivers/stepper/allegro/a4979.c
LONG_LINE
Check warning on line 280 in drivers/stepper/allegro/a4979.c
LONG_LINE
Check warning on line 281 in drivers/stepper/allegro/a4979.c
LONG_LINE
Check warning on line 285 in drivers/stepper/allegro/a4979.c
LONG_LINE
Check warning on line 286 in drivers/stepper/allegro/a4979.c
LONG_LINE
Check warning on line 287 in drivers/stepper/allegro/a4979.c
SPACE_BEFORE_TAB
Check warning on line 288 in drivers/stepper/allegro/a4979.c
LONG_LINE
Check warning on line 288 in drivers/stepper/allegro/a4979.c
SPACE_BEFORE_TAB
Check failure on line 289 in drivers/stepper/allegro/a4979.c
TRAILING_WHITESPACE
Check warning on line 291 in drivers/stepper/allegro/a4979.c
MISSING_EOF_NEWLINE