Skip to content

Add TMC2100 driver support#134

Merged
laurb9 merged 2 commits intomasterfrom
feature/add-tmc2100
Jan 3, 2026
Merged

Add TMC2100 driver support#134
laurb9 merged 2 commits intomasterfrom
feature/add-tmc2100

Conversation

@laurb9
Copy link
Owner

@laurb9 laurb9 commented Jan 2, 2026

TMC2100 Implementation and Verification

Goal

Add support for the TMC2100 stepper driver and update library documentation.
Resolves #47

Changes

Source Code

  • [NEW] src/TMC2100.h
  • [NEW] src/TMC2100.cpp

Examples

  • [NEW] examples/TMC2100/TMC2100.ino

Documentation & Metadata

  • keywords.txt: Added TMC2100.
  • library.properties: Added TMC2100 to description.
  • library.json: Added TMC2100 to description and keywords.
  • README.md: Added TMC2100 to supported list using Trinamic link.
  • .agent/workflows/build_and_test.md: Updated to match CI (removed unit tests, added loop for all examples).

Verification

Build Results

Ran the /build_and_test workflow.

  • PlatformIO Build: Success for nodemcuv2, adafruit_feather_m0, esp32dev, teensylc.
  • PlatformIO CI: Verified all examples (including user-modified BasicStepperDriver & AccelTest).
  • Arduino CLI (Make):
    • examples/TMC2100: Success
    • examples/TestSerial: Failed (Missing file TestSerial.ino - Unrelated existing issue)
  • Unit Tests: Skipped (No tests in test folder - Unrelated existing issue)

The TMC2100 implementation and example have been verified to compile correctly.

Agent: gemini-2.0-pro (antigravity)

Agent: gemini-2.0-pro (antigravity)
@continue
Copy link

continue bot commented Jan 2, 2026

All Green - Keep your PRs mergeable

Learn more

All Green is an AI agent that automatically:

✅ Addresses code review comments

✅ Fixes failing CI checks

✅ Resolves merge conflicts


Unsubscribe from All Green comments

Copy link
Owner Author

@laurb9 laurb9 left a comment

Choose a reason for hiding this comment

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

Review Summary

This PR adds TMC2100 driver support to the StepperDriver library. The implementation follows the established patterns in the codebase and successfully integrates with the existing architecture.

What's Good

  • Consistent Architecture: The TMC2100 class properly inherits from BasicStepperDriver and follows the same constructor patterns as other drivers (DRV8834, DRV8880)
  • Correct CFG Pin Logic: The microstepping configuration correctly implements TMC2100's CFG1/CFG2 truth table, including support for SpreadCycle and StealthChop modes
  • Proper Documentation Updates: All metadata files (keywords.txt, library.json, library.properties, README.md) are correctly updated
  • Build Verification: The PR includes comprehensive build verification across multiple platforms
  • Example Code: A complete example demonstrates both basic and fully-wired configurations

Issues to Address

  1. Header Comment Placement (src/TMC2100.h:33): The "Fully wired" comment appears before a constructor that doesn't take CFG pins and should be repositioned
  2. Missing override Keyword (src/TMC2100.h:31): The begin() method should be marked with override for better type safety
  3. Example Comment Clarity (examples/TMC2100/TMC2100.ino:33): The comment could be clearer about parameter semantics

Testing Recommendations

Consider adding a test that verifies:

  • Dynamic microstepping changes work correctly with CFG pin mode switching
  • StealthChop mode activates properly for 1/16 microstepping with CFG2 in INPUT state

The implementation is solid and ready for merge once the minor documentation issues are addressed.


GLM-4.7
Z.ai


public:
/*
* Basic connection: only DIR, STEP are connected.
Copy link
Owner Author

Choose a reason for hiding this comment

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

The comment on line 33 ("Fully wired. All the necessary control pins for TMC2100 are connected...") appears before a constructor (line 31) that only takes DIR, STEP, and SLEEP parameters. This comment should be placed after line 31 or moved to before the actual constructors that take CFG pins (lines 38 and 41).


GLM-4.7
Z.ai

// maximum level controllable by CFG pins is 1/16, TMC2100 can interpolate to 1/256 internally
static const short MAX_MICROSTEP = 16;

public:
Copy link
Owner Author

Choose a reason for hiding this comment

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

The begin() method on line 31 overrides the base class implementation but is missing the override keyword. While this pattern exists in other drivers (e.g., A4988.h), adding override would improve type safety and allow the compiler to catch signature mismatches.


GLM-4.7
Z.ai

TMC2100 stepper(MOTOR_STEPS, DIR, STEP, SLEEP, CFG1, CFG2);

void setup() {
stepper.begin(RPM, MICROSTEPS);
Copy link
Owner Author

Choose a reason for hiding this comment

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

The comment "Fully wired: DIR, STEP, SLEEP, CFG1, CFG2" is misleading. The constructor TMC2100(MOTOR_STEPS, DIR, STEP, SLEEP, CFG1, CFG2) actually takes (steps, dir_pin, step_pin, enable_pin, cf1_pin, cf2_pin) as parameters. The 4th parameter is enable_pin (which can function as SLEEP), not a separate pin name. Consider clarifying this in the comment to match actual parameter semantics.


GLM-4.7
Z.ai

}

// CFG1 CFG2 Microsteps Mode
// GND GND 1 SpreadCycle
Copy link
Owner Author

Choose a reason for hiding this comment

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

The CFG pin configuration logic correctly implements the TMC2100 microstepping modes, including support for both SpreadCycle and StealthChop modes. The pin mode handling (setting pins to INPUT for float/open states) is consistent with the DRV8880 implementation pattern in this codebase.


GLM-4.7
Z.ai

…erride keyword

- Made BasicStepperDriver::begin virtual
- Added override to TMC2100, A4988, and DRV8880 begin() methods
- Fixed mislocated comment in TMC2100.h
- Clarified SLEEP/ENABLE pin in TMC2100 example

Agent: gemini-2.0-pro (antigravity)
@laurb9
Copy link
Owner Author

laurb9 commented Jan 2, 2026

I have addressed all the PR feedback:

  1. TMC2100.h: Fixed the mislocated comment regarding fully wired connections.
  2. Type Safety: Made BasicStepperDriver::begin() virtual in the base class. This allowed me to add the override keyword to TMC2100::begin() as requested.
  3. Library Consistency: Also added the override keyword to A4988::begin() and DRV8880::begin() for consistency across the library.
  4. Example clarity: Clarified the SLEEP/ENABLE pin comment in the TMC2100 example.

Verified that all examples compile successfully after these changes.

Agent: gemini-2.0-pro (antigravity)

@laurb9 laurb9 merged commit dac6fb1 into master Jan 3, 2026
10 checks passed
@laurb9 laurb9 deleted the feature/add-tmc2100 branch January 3, 2026 05:48
@laurb9 laurb9 mentioned this pull request Jan 5, 2026
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

adding TMC 2100 driver to the list

1 participant