Repository navigation
fix(canopen): can_bridge_example never initialized its TWAI node before START - #803
Merged
Merged
Conversation
…re START start_bus() constructed the espp::Twai and called start() without initialize(), so the node was never created and start() returned operation_not_permitted -- reported to the host as "start failed: Not owner" (newlib's EPERM string). Call initialize() first; start() still runs explicitly so the host gets a precise error code. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DFjjnq3XCTRAXENSxsCxJU
|
✅Static analysis result - no issues found! ✅ |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The change matches the Twai lifecycle contract and resolves the reported startup failure.
Review effort: Lite
Findings: None
What changed in this PR
Fixes CAN bridge startup by initializing the TWAI node before explicitly starting it.
Changes:
- Calls
initialize()beforestart(). - Preserves explicit start error reporting.
| File | Description |
|---|---|
components/canopen/can_bridge_example/main/can_bridge_example.cpp |
Corrects TWAI initialization order. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
1 of 2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Every START from the CAN console / DS402 panel failed with
start failed: Not owner.start_bus()incan_bridge_example.cppconstructed theespp::Twaiand calledstart()without ever callinginitialize(), so the node was never created;Twai::start()on an uninitialized node returnsoperation_not_permitted, and newlib's message for that errno is "Not owner". This has been the case since the example landed in #748 (initialize()has always been a separate step onespp::Twai).Fix: call
initialize()beforestart().auto_startstays off sostart()still runs explicitly and the host gets its own error code if enabling the node fails.Test plan
components/canopen/can_bridge_examplebuilds (esp32s3, manager on)🤖 Generated with Claude Code
https://claude.ai/code/session_01DFjjnq3XCTRAXENSxsCxJU