... | ... | @@ -15,10 +15,17 @@ Both SCL and SDA lines have pull-ups in order to drive the signal up by default. |
|
|
|
|
|
When the master wants to do an operation (a read or a write) on a parcticular slave, it:
|
|
|
1. generates a START condition, that means to drive to the low level the SDA while the SCL is still high;
|
|
|
2. Communicate the address and the operation the master wants to perform (in _7-bit addressing_ the address is sent along with the operation bit, 0 for write and 1 for read. in 10-bit addressing there is also a header involved; for further informations see the reference manual).
|
|
|
3. If a slave recognizes his address, the SDA is pulled down in order to send a slave ACK.
|
|
|
2. Communicate the address and the operation the master wants to perform. So, in _7-bit addressing_ the address is sent along with the operation bit, 0 for write and 1 for read. In 10-bit addressing there is also a header involved; for further informations see the reference manual.
|
|
|
3. If a slave recognizes his address, the slave pulls the SDA line down in order to send a slave ACK (S-ACK).
|
|
|
So, in total, this prologue would be 7bits (slave address) + 1bit (R/W operation to perform) + 1bit (slave responds with an ACK or the line returns high, so a NACK is received).
|
|
|
|
|
|

|
|
|
After this phase, if a slave responds with an ACK, the operation will be performed:
|
|
|
- Read (R/W bit is high): The slave sends a byte and if the master sends an ACK the slave will send another byte, the communication is stopped otherwise;
|
|
|
- Write (R/W bit is low): The slave receives a byte and responds with an ACK. After the ACK the master could continue sending bytes or stopping the communication.
|
|
|
|
|
|
After the data transfer a STOP condition is sent (consisting in driving the SDA to the high level while SCL is high).
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
# _Deadlocks are a feature, not a bug!_
|
... | ... | |