Skip to content

I3C Controller Library#1

Draft
Aymane-ST wants to merge 2 commits intomainfrom
I3C_LIB
Draft

I3C Controller Library#1
Aymane-ST wants to merge 2 commits intomainfrom
I3C_LIB

Conversation

@Aymane-ST
Copy link
Copy Markdown
Owner

Depends on LPS22DF pr: Aymane-ST/LPS22DF#1

Tested on Nucleo H503RB and U385RG_Q

fpistm and others added 2 commits March 6, 2026 15:59
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Signed-off-by: Aymane Bahssain <aymane.bahssain@st.com>
Copy link
Copy Markdown
Collaborator

@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.

Thanks for this first version.
See my comments.
Moreover, ensure to have only one return statement per function. (MISRA compliance).
Is Wire library could/should be used to be extended with I3C support. Default I2C then add possibilities to do I3C or I2C over I3C? It seems several API is common and Wire is generic name.
/cc @cparata

Comment on lines +4 to +14
#if defined(STM32H5xx)
#define I3C_BUS I3C1Bus
#define I3C_SDA_PIN PB7
#define I3C_SCL_PIN PB6
#elif defined(STM32U3xx)
#define I3C_BUS I3C2Bus
#define I3C_SDA_PIN PB14
#define I3C_SCL_PIN PB13_ALT1
#else
#error "Unsupported STM32 family"
#endif
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.

Why not use I3CBus declared in the .cpp.
Haveing a default instance defined by the variant like it is done for Wire and SPI. Even if it is the same pins than Wire instance.
Check only if STM32 series used to build have I3C support.

Comment on lines +8 to +18
#if defined(STM32H5xx)
LPS22DFSensor ps(&I3C1Bus, LPS22DF_STATIC_ADDR_7BIT, LPS22DF_DYN_ADDR_7BIT);
#define I3C_BUS I3C1Bus
#define I3C_SCL PB6
#define I3C_SDA PB7
#elif defined(STM32U3xx)
LPS22DFSensor ps(&I3C2Bus, LPS22DF_STATIC_ADDR_7BIT, LPS22DF_DYN_ADDR_7BIT);
#define I3C_BUS I3C2Bus
#define I3C_SCL PB13_ALT1
#define I3C_SDA PB14
#endif
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.

Ditto

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.

2 participants