[Libre-soc-bugs] [Bug 746] I2C needs an Open Drain IO Pad

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Mon Nov 15 22:52:20 GMT 2021


https://bugs.libre-soc.org/show_bug.cgi?id=746

--- Comment #5 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
(In reply to Cesar Strauss from comment #1)
> It seems that Open Drain can be implemented by a constant zero output, and
> switching the tri-state/direction/oe control signal (1=tri-state,
> 0=push-pull to ground).

# Open Drain Mode, made with a standard FlexLib IOlib cell
with m.If(sda.oe):
  with m.If(sda.o == 1):
    comb += pad.oe.eq(1)
    comb += pad.o.eq(1)
  with m.Else():
    comb += pad.oe.eq(0)
    comb += pad.o.eq(0)
with m.Else():
    comb += pad.oe.eq(0)
    comb += sda.i.eq(pad.i)

this will do the job, Staf: no need to change IOLib

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list