a general question to I2C Slave mode

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 493 times
Been thanked: 187 times

a general question to I2C Slave mode

Post by Rudi »

hi

i try to get a CPU ( ESP8266 ) in I2C Slave mode.
my thinking for Slave mode is, that SDA and SCL must be an Input, where SDA can be a output by send Data / ACK
so my thinking is, to setup SDA and SCL as "open-drain" in init procedure and set is as input.
because SDA, SCL is pulled up the level would be high and do not block the I2C bus.

if Master waiting for a ACK ( SDA is open-drain ) the SLAVE do a ACK by sending a ACK, if the SDA would going to a output with high output (1) and this sets (Masters) SDA HIGH in the 9th time slot and Master know, data bytes send are ACK / Address matched.

EDIT AFAIK ..( ash on my main ) forget the second way..
if Master waiting for an ACK ( SDA is open-drain ) the SLAVE do an ACK by sending an ACK, if the SDA would going to an output with low output (0) and this sets (Masters) SDA in the 9th time slot and Master know, data bytes send are ACK / Address matched. After this the Slave toogle SDA back to "open-drain" input ?


is this the right thinking?

thank you
best wishes
rudi ;-)

Post Reply