Skip to content

firmware: fix I2C pins and clock for XIAO ESP32C6 - #4

Open
watarufujiwara-zeals wants to merge 2 commits into
airoa-org:mainfrom
omakase-robotics:feature-firm_fix
Open

firmware: fix I2C pins and clock for XIAO ESP32C6#4
watarufujiwara-zeals wants to merge 2 commits into
airoa-org:mainfrom
omakase-robotics:feature-firm_fix

Conversation

@watarufujiwara-zeals

Copy link
Copy Markdown

Description

Bug fixes for the AS5601 encoder firmware targeting the Seeed XIAO ESP32C6.

  • Lower I2C clock from 400kHz to 100kHz for stable AS5601 operation
  • Fix SDA/SCL pin assignment from 21/22 to 20/19 to match the XIAO ESP32C6 pinout
  • Remove duplicate Wire.begin() / Wire.setClock() in setup()encoder.begin() handles this internally

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Flashed onto a Seeed XIAO ESP32C6 + AS5601 and verified encoder values stream correctly via Serial monitor.

watarufujiwara-zeals and others added 2 commits June 23, 2026 11:02
- I2C clock: 400kHz → 100kHz (AS5601 stability fix)
- SDA/SCL pins: 21/22 → 20/19 (match ESP32C6 hardware wiring)
- Remove duplicate Wire.begin()/setClock() before encoder.begin()
- DEVICE_ID: "CHANGE HERE" → "R003"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
DEVICE_ID should remain "CHANGE HERE" as a per-device placeholder
to be set at flash time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ifukuh-pfr

Copy link
Copy Markdown

Confirming this fix. Same issue on XIAO ESP32C6 + AS5601 wired per the yubi-hw table (SCL=D8, SDA=D9): "No magnet detected", stream stuck at 0.0. The leading argument-less Wire.begin() inits I2C on the default pins, so the SDA/SCL edits had no effect. This PR fixes it — encoder reads correctly after applying.

@okubotakuya-airoa

Copy link
Copy Markdown
Contributor

Thank you for your PR and the additional verification.
As you point out, there does seem to be a mismatch between the instructions in yubi-hw on p12 and the software in this repo. We will check the final specification and get back to you with an update.

Also, regarding the observation that a baudrate of 100kHz is more stable, we suspect this mismatch may be the cause. Currently, AIRoA uses the D4/D5 pins together with 400kHz, so switching to these pins might allow 400kHz to work without issues as well.

@okubotakuya-airoa

Copy link
Copy Markdown
Contributor

After investigating internally, it appears that an incorrect pin assignment was written in as a result of the modifications made during the open-sourcing process.
We will therefore fix this on the yubi-hw side. Once that fix is complete and your devices are confirmed to be working, we would like to close this PR.

@mtsuchi

mtsuchi commented Jul 20, 2026

Copy link
Copy Markdown

We apologize for the issue with the wrong PIN assignment. We have fixed it now. You can see the PR about it at the following link.
Toyota/yubi-hw#21

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.

4 participants