Easyi3C is a leading supplier of embedded system tools that simplify the development and debugging of various communication protocols. The company offers a range of products designed to help engineers and developers use I3C/I2C , USB and MIPI, JEDEC, MCTP and other protocols more efficiently.
The following are more examples of automated code to provide engineers with references to build more complex test code:
1. IBI related test code examples:
# ==========================================================================
# --------------------------------------------------------------------------
# Copyright © 2025 by Easyi3C, Inc.
# All rights reserved.
# ==========================================================================
import sys
from ezi3c import EasyI3C
from ezi3c.err import *
from ezi3c.protocol.i3c import ccc
from ezi3c import utils
ez = EasyI3C()
ret = ez.open()
if not ret:
print("Failed to open adpater")
sys.exit(1)
slave_addr = 0x70
try:
ez.set_io_voltage(1.0)
ez.set_bus_clk_freq(1000, 4000)
ez.ibi_enable()
ez.i3c.ccc_rstdaa()
ez.i3c.ccc_setaasa()
ret = ez.i3c.write(slave_addr, [16, 0x69])
ret = ez.i3c.write(slave_addr, [26, 0x04])
ret = ez.i3c.write(slave_addr, [32, 0x07])
ret, data = ez.i3c.write_read(slave_addr, [26], rx_len=1)
ez.i3c.ccc_enec_broadcast(ccc.ENEC.ENINT)
while True:
slave, data = ez.ibi_get(block=True)
print("Received IBI: dev:{:02X}, payload:{}".format(slave, utils.hex_string(data)))
ret = ez.i3c.write(slave_addr, [32, 0x07])
finally:
ez_close(ez)2. Parity is incorrectly inserted, IBI header:
# ==========================================================================
# --------------------------------------------------------------------------
# Copyright © 2025 by Easyi3C, Inc.
# All rights reserved.
# ==========================================================================
import sys
from ezi3c.api import *
# Notes: You must make modifications based on your actual salve address
slave_addr = 0x70
ez = ez_open()
if not ez:
print("Cannot open Adapter")
sys.exit(-1)
try:
version = ez_get_version(ez)
print("version:{:08X}".format(version))
clk = ez_get_bus_clk_freq(ez)
print("POR Default Clk Freq(100, 1000): {}".format(clk))
clk = ez_set_bus_clk_freq(ez, 1000, 4000)
print("Cur Clk Freq: {}".format(clk))
duty = ez_get_bus_clk_duty(ez)
print("POR Default Clk Duty(50, 50): {}".format(duty))
duty = ez_set_bus_clk_duty(ez, 50, 40)
print("Cur Clk Duty: {}".format(duty))
ret = ez_set_io_voltage(ez, 1.0)
assert ret == 0
print("> RSTDAA ...")
ez_ccc_rstdaa(ez)
print("> i2c write & read ...")
ret = ez_i2c_write(ez, slave_addr, [0x40, 0xa1, 0xa2, 0xa3, 0xa4])
assert ret == E_OK
ret, data = ez_i2c_write_read(ez, slave_addr, 0x40, 4)
assert ret == 0
assert data == (0xa1, 0xa2, 0xa3, 0xa4)
print("> SETAASA ...")
ez_ccc_setaasa(ez)
print("> i3c write & read ...")
ret = ez_i3c_write(ez, slave_addr, [0x40, 0xb1, 0xb2, 0xb3, 0xb4])
assert ret == 0
ret, data = ez_i3c_write_read(ez, slave_addr, 0x40, 4)
assert ret == 0
assert data == (0xb1, 0xb2, 0xb3, 0xb4)
print("> RSTDAA ...")
ez_ccc_rstdaa(ez)
print("> ENTDAA ...")
ez_ccc_entdaa(ez, [0x08])
addr = 0x08
print("> i3c write & read ...")
ret = ez_i3c_write(ez, addr, [0x40, 0xb1, 0xb2, 0xb3, 0xb4])
assert ret == 0
ret, data = ez_i3c_write_read(ez, addr, 0x40, 4)
assert ret == 0
assert data == (0xb1, 0xb2, 0xb3, 0xb4)
print("> i3c write & read with IBI header...")
ret = ez_i3c_write(ez, addr, [0x40, 0xb1, 0xb2, 0xb3, 0xb4], with_ibi_header=True)
assert ret == 0
ret, data = ez_i3c_write_read(ez, addr, 0x40, 4, with_ibi_header=True)
assert ret == 0
assert data == (0xb1, 0xb2, 0xb3, 0xb4)
print("> i3c write & read with Parity error...")
ret = ez_i3c_write(ez, addr, [0x40, 0x0, 0x0, 0x0, 0x0], inject_parity_err=True)
assert ret == 0
ret, data = ez_i3c_write_read(ez, addr, 0x40, 4)
assert ret == 0
assert data == (0xb1, 0xb2, 0xb3, 0xb4)
finally:
ez_close(ez)