Fix SPI bus detach issue on ESP32-C3 with Arduino 3.x#176
Open
hallard wants to merge 1 commit intoLSatan:masterfrom
Open
Fix SPI bus detach issue on ESP32-C3 with Arduino 3.x#176hallard wants to merge 1 commit intoLSatan:masterfrom
hallard wants to merge 1 commit intoLSatan:masterfrom
Conversation
On ESP32-C3 with Arduino 3.x (IDF 5.x), SPI.end() fully detaches the SPI bus and releases GPIO pins. Since SpiStart()/SpiEnd() are called around every single SPI transaction, this causes the bus to be repeatedly torn down and rebuilt, which breaks GPIO pin assignments and hangs the firmware. Fix by: - Only calling SPI.begin() once (on first use) instead of every transaction - Removing SPI.end() from SpiEnd(), keeping only SPI.endTransaction() This fixes CC1101 operation on ESP32-C3 boards while remaining compatible with ESP32, ESP32-S3, and ESP8266. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
SPI.end()now fully detaches the SPI bus and releases GPIO pins on newer ESP32 Arduino coresSpiStart()/SpiEnd()wrap every single SPI transaction, this caused the bus to be repeatedly torn down and rebuilt, hanging the firmwareChanges
SpiStart(): Only callSPI.begin()andpinMode()once (first use), skip on subsequent callsSpiEnd(): RemoveSPI.end(), keep onlySPI.endTransaction()Testing
🤖 Generated with Claude Code