Blog
Technology Sharing
I3C Host adapter Pro+ (7)hits:23


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.



7. Automated Testing (1):

Compared to other products on the market, our I3C Host Adapter features automated testing support. Through Python scripts, engineers can quickly implement test code for different test functions according to their needs. This is simple, efficient, easy to modify, and facilitates test code sharing among teams.

1. The following is a code example for testing the I2C and I3C protocols:

# ==========================================================================
# --------------------------------------------------------------------------
# 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)


2. The following is a code example for GPIO operation:

# ==========================================================================
# --------------------------------------------------------------------------
# Copyright © 2025 by Easyi3C, Inc.
# All rights reserved.
# ==========================================================================

import sys
from ezi3c.api import *
from ezi3c.gpio import *

ez = ez_open()
if not ez:
    print("Cannot open Adapter")
    sys.exit(-1)

try:
    print("> GPIO0 enable output:")
    ret = ez_gpio_config(ez, 0x1, 0x1)

    print("> GPIO0 drive high:")
    ret = ez_gpio_write(ez, 0x1, 0x1)

    ret = ez_gpio_read(ez)
    print("> Read GPIO input status: {}".format(ret))

finally:
    ez_close(ez)


Service Line:

Address:Silicon Valley
Email:support@easyi3c.com

Copyright © Easyi3C Co., LTD