Skip to content

edge: fix psoc-edge I2C clock and expose Wire on the header - #38

Merged
AkshayChandra-IFX merged 2 commits into
edge-mainfrom
edge-fix-i2c-clock-div
Oct 30, 2026
Merged

AkshayChandra-IFX merged 2 commits into
edge-mainfrom
edge-fix-i2c-clock-div

Conversation

@AkshayChandra-IFX

@AkshayChandra-IFX AkshayChandra-IFX commented Oct 29, 2026 •

Copy link
Copy Markdown

Description
Both I2C clock dividers were set to clock-div = <1>, which ran SCL at ~6.25 MHz instead of 100 kHz. The PSoC Edge I2C driver uses this divider directly and ignores clock-frequency. This PR sets clock-div = <63> for Wire and Wire1, giving ~99 kHz SCL.

Wire was on SCB0 (P8_0/P8_1), the internal sensor bus, which isn't on any header. This PR moves it to SCB11 on P17_2/P17_3, next to Wire1, so the loopback test can be wired.

A couple of things to keep in mind:

  • Wire no longer talks to the on-board IMU, pressure and humidity sensors.
  • P17_2/P17_3 don't have on-board pull-ups. The loopback test works because they share the pull-ups on P17_0/P17_1; using Wire on its own needs external pull-ups.

Related Issue
None.

Context
Wiring: P17_2 ↔ P17_0 (SCL), P17_3 ↔ P17_1 (SDA)

@AkshayChandra-IFX AkshayChandra-IFX changed the title Edge fix i2c clock div edge: fix kit_pse84_ai I2C clock and expose Wire on the header Oct 29, 2026
@AkshayChandra-IFX
AkshayChandra-IFX marked this pull request as ready for review October 29, 2026 08:23
@AkshayChandra-IFX
AkshayChandra-IFX marked this pull request as draft October 29, 2026 08:24
@AkshayChandra-IFX AkshayChandra-IFX changed the title edge: fix kit_pse84_ai I2C clock and expose Wire on the header edge: fix psoc-edge I2C clock and expose Wire on the header Oct 29, 2026
@AkshayChandra-IFX
AkshayChandra-IFX marked this pull request as ready for review October 29, 2026 09:14
@djaumann

Copy link
Copy Markdown

Looks good :)

@jaenrig-ifx jaenrig-ifx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice!

AkshayChandra-IFX and others added 2 commits October 30, 2026 04:12
Both I2C clock dividers (peri0_group1_16bit_1 for Wire,
peri0_group1_16bit_3 for Wire1) were set to clock-div = <1>, feeding the
SCB with 100 MHz and driving SCL at ~6.25 MHz instead of 100 kHz, which
broke I2C communication (test_wire_connected1_pingpong).

The PSoC Edge I2C driver does not derive the SCB clock from
clock-frequency; it uses the devicetree divider with fixed 16x
oversampling. Set clock-div = <63>: 100 MHz / 63 = ~1.59 MHz SCB clock
(within the PDL 1.55-3.2 MHz range for a 100 kHz master), ~99 kHz SCL.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: AkshayChandra-IFX <akshaychandra.nagzarkar@infineon.com>
SCB0 (P8_0/P8_1) is the internal sensor bus and not on a header, so
Wire could not be tested. Map Wire to SCB11 on P17_2/P17_3; mark
test_wire_connected1_pingpong as passing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: AkshayChandra-IFX <akshaychandra.nagzarkar@infineon.com>
@AkshayChandra-IFX
AkshayChandra-IFX merged commit 20d68e0 into edge-main Oct 30, 2026
16 checks passed

clocks = <&peri0_group1_16bit_1>;

pinctrl-0 = <&p17_2_scb11_i2c_scl &p17_3_scb11_i2c_sda>;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Here you have updated but still variant.h points to the #define SDA 43 /< P8_1 */
#define SCL 42 /
< P8_0 */. So that should be changed right?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes. thanks to point out. This is missed, i will update it!

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