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

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Tue Nov 16 09:04:09 GMT 2021


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

--- Comment #7 from Staf Verhaegen <staf at fibraservi.eu> ---
(In reply to Luke Kenneth Casson Leighton from comment #5)
> (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).
> 
> (edited, i got it hi not lo)
> 
> # Open Drain Mode, made with a standard FlexLib IOlib cell
> with m.If(sda.oe):
>   # Open Drain Output
>   with m.If(sda.o == 1):
>     # HI output is floating
>     comb += pad.oe.eq(0)
>     comb += pad.o.eq(0)
>   with m.Else():
>     # LO output, drive output to GND.
>     comb += pad.oe.eq(1)
>     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

This should not be needed, your I2C master should already make sure oe=0 when
wanting 1 on output and oe=1 + o=0 when wanting 0 on output.

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


More information about the libre-soc-bugs mailing list