Forum Discussion
How to properly constrain bidirectional I2C SCL / SDA ports ?
Hi,
We are using an I2C slave controller and like to know how to properly constrain bidirectional SDA and SCL lines to meet setup and hold time requirements.
I searched on the internet and cannot find anywhere advising what constraints to use for I2C SDA, SCL bidirectional ports. Will they be also different constraints for eg START, STOP conditions etc? I will appreciate if you can advise with an example of SDC constraints.
Our I2C interface within the I2C controller module follows the defined behaviour of a I2C slave in the NXP specification (https://www.nxp.com/docs/en/user-guide/UM10204.pdf)
We are using stability check components (checkstable digital filters for the read sda/scl condition to ensure only stable values of SDA and SCL are used by testing over a period of 10 clock cycles (100nS per cycle) that the bit has not changed) for SDA and SCL set to the shortest setting to ensure this works with the 10MHz clock that is used for our FPGA Cyclone V.
We are using a higher frequency clock (10MHz) driving state machine i2c_fsm, bus_strobe process etc.
The transfer can occur over speed of 100kbits/s in standard mode.
Your prompt reply to this matter will be appreciated.
Regards,
Kevin
11 Replies
- SyafieqS
Super Contributor
Hi Kevin,
May I know if there is any update?
- M_Aboelnaga
New Contributor
Any update please on this?
I cant find any source that shows SDC constraints for SCL and SDA?
In I2c or I3C.
Because both are used as clock and data- RichardT_altera
Super Contributor
Hi,
There is no Altera cookbook with dedicated SDC for I2C SDA/SCL. That is expected as I2C is open-drain and protocol-timed (NXP UM10204), while Quartus STA only use clocks + set_input_delay / set_output_delay on ports.
What we constrain in SDC:- clk_10m , capture/launch clock of the controller
- set_input_delay on SCL and SDA (pad → first filter flop), or set_false_path -from if treated as async after the filter
- set_output_delay on bidir SDA (and SCL only if clock-stretch), with both -max and -min
Example (delay values are placeholders):
set_input_delay -clock [get_clocks clk_10m] -max 20 [get_ports {i2c_scl i2c_sda}]
set_input_delay -clock [get_clocks clk_10m] -min $i2c_board_min [get_ports {i2c_scl i2c_sda}]
set_output_delay -clock [get_clocks clk_10m] -max 20 [get_ports {i2c_sda}]
set_output_delay -clock [get_clocks clk_10m] -min -$i2c_board_max [get_ports {i2c_sda}]
Regards,
Richard Tan- M_Aboelnaga
New Contributor
Hi,
What about SCL as data?
there are some cases that use SCL as data, SDA as clock.
Do we make create_clock on SDA ? and input delay on SCL port with respect to SDA clock?
- M_Aboelnaga
New Contributor
- josila
New Member
I think the important thing here is to separate the I2C bus timing requirements from the FPGA's internal timing constraints. Since SDA and SCL are bidirectional open-drain signals and are asynchronous to the 10 MHz system clock, I would first check how the input synchronizers and output drivers are implemented. Make sure the external bus timing, including setup time, hold time, and signal rise time, is considered rather than relying only on the internal clock period. I'd also be careful with false-path constraints so they don't accidentally exclude timing checks between synchronizer stages. Have you checked the timing reports for the paths between the input synchronizers and the FSM?