Last edited 2 months ago

I3C device tree configuration

Applicable for STM32MP25x lines

1. Article purpose[edit source]

The purpose of this article is to explain how to configure the I3C internal peripheral using the device tree mechanism, relying on the bindings documentation, that is the description of the required and optional device-tree properties.

The peripheral can be assigned to different contexts/software components, depending on the final product needs. Refer to How to assign an internal peripheral to an execution context for guidelines on this configuration.

2. DT bindings documentation[edit source]

The device tree binding documents are stored either in the given applicable components listed below, or in the Linux kernel repository:

3. DT configuration[edit source]

This hardware description is a combination of the STM32 microprocessor device tree files (.dtsi extension) and board device tree files (.dts extension). See the Device tree for an explanation of the device-tree file organization.

STM32CubeMX can be used to generate the board device tree. Refer to How to configure the DT using STM32CubeMX for more details.

3.1. DT configuration (STM32/SoC level)[edit source]

The I3C nodes are in the device tree file for the software components supporting the peripheral and listed in the above DT bindings documentation paragraph.

At SoC level, each I3C controller is declared as follows:

i3c1: i3c@40190000 {
	#address-cells = <3>;
	#size-cells = <0>;
	compatible = "st,stm32-i3c";
	reg = <0x40190000 0x400>;
	interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
	clocks = <&rcc CK_KER_I3C1>;
	resets = <&rcc I3C1_R>;
	feature-domains = <&rifsc STM32MP25_RIFSC_I3C1_ID>;
	status = "disabled";
  • for STM32MP25x lines More info.png lines, refer to DTS file stm32mp251.dtsi[1]
Warning white.png Warning
This device tree part is related to STM32 microprocessors. It must be kept as is, without being modified by the end-user.

3.2. DT configuration (board level)[edit source]

Peripheral configuration should be done in specific board device tree files (board dts file and pinctrl dtsi file).
Peripheral can only be used as a Controller device with Linux.

&i3c1 {
	pinctrl-names = "default", "init", "sleep";
	pinctrl-0 = <&i3c1_pins_a>;
	pinctrl-1 = <&i3c1_init_pins_a>;
	pinctrl-2 = <&i3c1_sleep_pins_a>;

	i3c-sda-rising-time-ns = <380>; /* up to 2 I3C targets */

	i3c-scl-hz = <5000000>; /* Default value if undefined: 12500000 */
	i2c-scl-hz = <1000000>; /* If undefined, look at LVR values to determine the max freq. */

 	/* I2C device */
	pressure@5d {
		compatible = "st,lps22hh";
		reg = <0x5d 0x0 0x30>;

        /* I3C device with a static I2C address */
	sensor@68,39200144004 {
		reg = <0x68 0x392 0x144004>;
		assigned-address = <0xa>;

There are two levels of configuration:

  • Configuration of the I3C bus properties:
    • pinctrl-0&1&2 configuration depends on hardware board configuration.
      More details about pin configuration are available here: Pinctrl device tree configuration.
    • i3c-scl-hz is optional and represents the maximum I3C clocking speed for the bus (in Hz). If not defined, 12500000Hz is used.
    • i2c-scl-hz is optional and represents the maximum I2C clocking speed for the bus (in Hz). If not defined, the lowest value of LVR values defined in the reg property of I2C child nodes is used.
    • i3c-sda-rising-time-ns is optional depending on the board hardware characteristics: wire length, resistor, and capacitor of the hardware design. This value is provided in nanoseconds and can be measured by observing the SDA rising slope on an oscilloscope.
  • Configuration of the I2C devices or I3C devices with static address connected on the bus:
    • for I2C devices:
      • reg encodes the static I2C address, and the I3C Legacy Virtual Register (LVR) describing the device significant features (allowed mode and maximum SCL clock frequency).
    • for I3C devices:
      • reg encodes the static I2C address (0 if the device does not have one), and the Provisioned ID (PID) used to uniquely identify a device on a bus. This PID contains information about the vendor, the part, and an instance ID so that several devices of the same type can be connected on the same bus.
      • assigned-address represents the dynamic address to be assigned to this device. This property is only valid if the I3C device has a static address (first cell of the reg property).

4. How to configure the DT using STM32CubeMX[edit source]

The STM32CubeMX tool can be used to configure the STM32MPU device and get the corresponding platform configuration device tree files.
The STM32CubeMX may not support all the properties described in the DT binding files listed in the above DT bindings documentation paragraph. If so, the tool inserts user sections in the generated device tree. These sections can then be edited to add some properties, and they are preserved from one generation to another. Refer to STM32CubeMX user manual for further information.

5. References[edit source]

Refer to the following links for additional information: