Skip to content

Add I3C Support library #2963

Open
Aymane-ST wants to merge 5 commits into
stm32duino:mainfrom
Aymane-ST:I3C_LIB
Open

Add I3C Support library #2963
Aymane-ST wants to merge 5 commits into
stm32duino:mainfrom
Aymane-ST:I3C_LIB

Conversation

@Aymane-ST
Copy link
Copy Markdown
Contributor

Summary

This PR introduces an I3C library for STM32 .

Current scope includes:

  • I3C controller mode
  • I3C target mode
  • Common Command Code (CCC) helpers
  • Dynamic Address Assignment (DAA) and discovery helpers
  • In-Band Interrupt (IBI) support
  • Mixed bus support with I2C controller-side transfers

Supported STM32 families

Currently supported families:

  • STM32H5xx
  • STM32U3xx

Implemented features

Controller mode

  • controller initialization and timing setup
  • configurable controller startup options
  • default private I3C SDR transfers:
    • write
    • read
    • writeReg
    • readReg
    • writeRegBuffer
    • readRegBuffer

Legacy I2C on mixed I3C bus

  • explicit helper API:
    • i2cWrite
    • i2cRead
    • i2cWriteRead
    • i2cWriteReg
    • i2cReadReg
    • i2cWriteRegBuffer
    • i2cReadRegBuffer
    • scanI2CDevices
    • isI2CDeviceReady
  • unified same-name overloads using I3CTransferType

CCC helpers

  • broadcast/direct write and direct read helpers
  • high-level wrappers for:
    • RSTDAA
    • DISEC
    • SETAASA
    • SETDASA
    • GETPID
    • GETBCR
    • GETDCR
    • event configuration (ENEC / DISEC)

Discovery / dynamic addressing

  • DAA helpers
  • discovery API for:
    • unknown devices only
    • known devices + optional unknown discovery
  • known-device matching by static address or PID
  • dynamic address allocation helpers

Target mode

  • target initialization and configuration
  • private receive/transmit helpers
  • target-side notification support
  • IBI request support

Controller-side IBI

  • target device configuration for IBI handling
  • controller-side IBI enable/disable
  • polling and callback access to received IBI events

Internal structure

The implementation is split into:

  • I3C.cpp: controller/target/CCC/discovery/IBI core logic
  • I3C_I2C.cpp: legacy I2C-over-I3C helpers and unified transport overloads

The public API remains exposed through a single I3C.h header.

Files added

Main additions:

  • libraries/I3C/src/I3C.h
  • libraries/I3C/src/I3C.cpp
  • libraries/I3C/src/I3C_I2C.cpp

Examples and build integration were also updated accordingly.

Signed-off-by: Aymane Bahssain <aymane.bahssain@st.com>
Signed-off-by: Aymane Bahssain <aymane.bahssain@st.com>
Signed-off-by: Aymane Bahssain <aymane.bahssain@st.com>
Signed-off-by: Aymane Bahssain <aymane.bahssain@st.com>
Signed-off-by: Aymane Bahssain <aymane.bahssain@st.com>
@Aymane-ST Aymane-ST added this to the 3.0.0 milestone Apr 24, 2026
@Aymane-ST Aymane-ST requested a review from fpistm April 24, 2026 14:59
@Aymane-ST Aymane-ST self-assigned this Apr 24, 2026
@Aymane-ST Aymane-ST added the enhancement New feature or request label Apr 24, 2026
@fpistm fpistm requested review from cparata April 24, 2026 15:01
Copy link
Copy Markdown
Member

@fpistm fpistm left a comment

Choose a reason for hiding this comment

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

LGTM for a first version

@github-project-automation github-project-automation Bot moved this from In progress to Reviewer approved in STM32duino libraries May 11, 2026
Copy link
Copy Markdown
Contributor

@cparata cparata left a comment

Choose a reason for hiding this comment

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

I'm wondering if it is better to move the I3C examples for LPS22DF directly on the LPS22DF library. I think that it is better to avoid the dependency inside the Core on the LPS22DF library. What about this proposal?

@fpistm
Copy link
Copy Markdown
Member

fpistm commented May 11, 2026

OK for me. I will update the PR as @Aymane-ST is OoO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Reviewer approved

Development

Successfully merging this pull request may close these issues.

3 participants