Skip to content

Driver DRV8825 for stepper motor was added #1407

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 4 commits into
base: develop
Choose a base branch
from

Conversation

Naglfario
Copy link

@Naglfario Naglfario commented Aug 4, 2025

Description

  • New Drv8825 driver

Motivation and Context

DRV8825 is a stepper motor driver that is made as compatible as possible with A4988, but there are some nuances. I tried to use the A4988 library to work with my DRV8825 driver, but the driver did not work correctly. After little investigation, I realized that despite the same connectors, this driver is more capricious to the control signal. Thus, I wrote a library to control the stepper motor through the DRV8825 driver.

How Has This Been Tested?

When I written a new library, I tested it several times through a sample project with my ESP32 WROOM(rev 3), DRV8825 and Nema 17 (stepping motor) to make sure that the motor does not miss steps.

Screenshots

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue with code or algorithm)
  • New feature (non-breaking change which adds functionality to code)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Config and build (change in the configuration and build system, has no impact on code or features)
  • Dependencies (update dependencies and changes associated, has no impact on code or features)
  • Unit Tests (add new Unit Test(s) or improved existing one(s), has no impact on code or features)
  • Documentation (changes or updates in the documentation, has no impact on code or features)

Checklist:

  • My code follows the code style of this project (only if there are changes in source code).
  • My changes require an update to the documentation (there are changes that require the docs website to be updated).
  • I have updated the documentation accordingly (the changes require an update on the docs in this repo).
  • I have read the CONTRIBUTING document.
  • I have tested everything locally and all new and existing tests passed (only if there are changes in source code).
  • I have added new tests to cover my changes.

Summary by CodeRabbit

  • Chores
    • Added a category label to classify the Drv8825 device as a "motor".
    • Introduced a lock file to ensure consistent dependency versions for the Drv8825 device.
    • Added a version configuration file to define release and versioning settings for the Drv8825 device.

@nfbot nfbot added the Type: enhancement New feature or request label Aug 4, 2025
Copy link

coderabbitai bot commented Aug 4, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (5)
  • devices/Drv8825/Drv8825.cs is excluded by none and included by none
  • devices/Drv8825/Drv8825_circuit_bb.jpeg is excluded by !**/*.jpeg and included by none
  • devices/Drv8825/README.md is excluded by !**/*.md and included by none
  • devices/Drv8825/samples/Program.cs is excluded by none and included by none
  • devices/Drv8825/samples/Properties/AssemblyInfo.cs is excluded by none and included by none

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Three new files were added under devices/Drv8825/: a category.txt file labeling the device as "motor", a packages.lock.json file specifying locked .NET nanoFramework dependencies, and a version.json file configuring versioning and release settings using the NerdBank.GitVersioning schema.

Changes

Cohort / File(s) Change Summary
Category Label Addition
devices/Drv8825/category.txt
Added a file containing the label "motor" to categorize the Drv8825 device.
Dependency Lock File
devices/Drv8825/packages.lock.json
Introduced a lock file listing exact .NET nanoFramework package versions and hashes for reproducible builds.
Versioning Configuration
devices/Drv8825/version.json
Added a JSON file specifying versioning rules and release branch patterns using NerdBank.GitVersioning.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
devices/Drv8825/version.json (1)

8-12: Releasing from develop may expose unstable code

Including ^refs/heads/develop$ in publicReleaseRefSpec means every build from the develop branch is treated as a public (non-prerelease) package. Most repos keep develop for integration and reserve main/version tags for release artifacts, letting CI append a pre-release label (e.g. -alpha). Consider either:

  1. Removing develop from the list, or
  2. Adding a release: false / prerelease scheme for develop to prevent accidental public pushes.

Example minimal change:

-    "^refs/heads/develop$",
+    "^refs/heads/develop$" // remove or turn into prerelease pattern

Up to project policy, but worth a second look.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 39a0daf and 8105846.

⛔ Files ignored due to path filters (16)
  • devices/Drv8825/Direction.cs is excluded by none and included by none
  • devices/Drv8825/Drv8825.cs is excluded by none and included by none
  • devices/Drv8825/Drv8825.nfproj is excluded by none and included by none
  • devices/Drv8825/Drv8825.nuspec is excluded by none and included by none
  • devices/Drv8825/Drv8825.sln is excluded by none and included by none
  • devices/Drv8825/Drv8825_circuit_bb.jpeg is excluded by !**/*.jpeg and included by none
  • devices/Drv8825/MicrostepsController.cs is excluded by none and included by none
  • devices/Drv8825/Properties/AssemblyInfo.cs is excluded by none and included by none
  • devices/Drv8825/README.md is excluded by !**/*.md and included by none
  • devices/Drv8825/Settings.StyleCop is excluded by none and included by none
  • devices/Drv8825/StepSize.cs is excluded by none and included by none
  • devices/Drv8825/packages.config is excluded by none and included by none
  • devices/Drv8825/samples/Drv8825.samples.nfproj is excluded by none and included by none
  • devices/Drv8825/samples/Program.cs is excluded by none and included by none
  • devices/Drv8825/samples/Properties/AssemblyInfo.cs is excluded by none and included by none
  • devices/Drv8825/samples/packages.config is excluded by none and included by none
📒 Files selected for processing (3)
  • devices/Drv8825/category.txt (1 hunks)
  • devices/Drv8825/packages.lock.json (1 hunks)
  • devices/Drv8825/version.json (1 hunks)
🔇 Additional comments (5)
devices/Drv8825/category.txt (1)

1-1: Category looks correct

The device is appropriately categorized as "motor". No further action required.

devices/Drv8825/packages.lock.json (2)

29-40: Consider marking build-only tools as PrivateAssets to avoid bloating the deployment image

Nerdbank.GitVersioning and StyleCop.MSBuild are build/analysis-time tools. When they appear as direct package references the nanoFramework project will carry them into the lock file, but unless PrivateAssets="all" (or developmentDependency="true") is set in the <PackageReference> the assemblies are copied to the target and increase flash/RAM usage on MCU targets for no benefit.

Please double-check the corresponding csproj:

<PackageReference Include="Nerdbank.GitVersioning" Version="3.7.115" PrivateAssets="all" />
<PackageReference Include="StyleCop.MSBuild"      Version="6.2.0"   PrivateAssets="all" />

If those attributes are already present you can ignore the warning; otherwise consider adding them and regenerating the lock file.


1-49: Lock file LGTM – exact pinning matches nanoFramework guidance

All runtime packages are pinned to exact patch versions with content hashes, ensuring deterministic builds — exactly what nanoFramework recommends. No anomalies spotted.

devices/Drv8825/version.json (2)

3-3: Patch component is implicit – confirm that this is intentional

"version": "1.1" resolves to 1.1.0 under NBGV.
If you intend to ship the very first patch (-preview or ‑beta later) this is fine; if you expected 1.1.x to be auto-incremented you need to bump the third component manually or rely on versionHeight.


1-16: Versioning file otherwise looks consistent

Schema reference, numeric-identifier padding and cloud-build variable propagation are all in line with the repo’s other device libraries.


1A, 1B, 2A, 2B - connect to the 4 coils of motor

DIR - connect to microcontroller pin

Choose a reason for hiding this comment

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

Would be good to expand this to include a simple description. Perhaps even from the data sheet.

DIR - Connect to microcontroller output pin, sets the direction of stepping. Internal pulldown

STEP - Connect to microcontroller output pin, rising edge causes the indexer to move one step. Internal pulldown.

RST - Connect to microcontroller output pin, active-low, reinitializes the indexer logic and disables H-bridge outputs. Internal pulldown.

SLP - Can be joned to RST or left high to enable the device. Low puts the device to sleep.

Copy link
Author

@Naglfario Naglfario Aug 7, 2025

Choose a reason for hiding this comment

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

Thank you for you review! I'll work on it later and i'll improve documentation


RST — join with SLP and connect to microcontroller pin or to 3.3-5V

Logic power supply can be connected to FAULT pin, it will works, but it useless.

Choose a reason for hiding this comment

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

FAULT - Logic low when in fault condition (overtemp, overcurrent). Connect to Microcontroller input with pullup.

Choose a reason for hiding this comment

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

I don't believe connecting FAULT to Vcc is the correct thing to do according to the datasheet that's an output which is pulled low for fault conditions. So if there is a fault connecting it to Vcc will cause it to short circuit the powersupply.

Copy link
Author

Choose a reason for hiding this comment

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

Well, I understand your concern. However, according to the datasheet:

Note that the carrier includes a 1.5k protection resistor in series with the FAULT pin that makes it is safe to connect this pin directly to a logic voltage supply, as might happen if you use this board in a system designed for the pin-compatible A4988 carrier

Copy link

@Workshopshed Workshopshed Aug 7, 2025

Choose a reason for hiding this comment

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

So that is specific to the module you are using rather than the driver chip itself. The link below has a simpler circuit where FAULT is not connected which might be a better option, or perhaps the high level wiring diagram on the TI datasheet.

.https://www.pololu.com/product/2133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants