in the top image you can see such communication between two arduinos, both of which support the so-called clock-starching, i.e. the slave is keeping SCL LOW while it is preparing the response.
Clock Stretching - the Slave is allowed to hold the clock line low until it is ready to give out the result. The Master must wait for the clock to go back to high before continuing with its work.
Unfortunately the other chip ( that will be used as a master ) does not support this clock-starching and expects a reply immediately. Is there any way I could make arduino respond immediately after getting the request?
PaulS:
When the request comes in, it should trigger an interrupt on the Arduino - the OnRequest one - that you should have supplied an interrupt handler for.
It is your responsibility to supply the reply immediately - for some reasonable definition of "immediately".
You can load the outgoing buffer on the slave before it gets the request from the master. Usually I2C is so slow that the slave does have time to load the buffer with the requested data in between the bits of the I2C protocol.
You have to dig down to find out what else is happening that's preventing it from responding in time.
Hi, I am facing the exactly same problem. The master chip does not support I2C clock stretching when communicate with a arduino uno as a i2c slave.
The communication will work when I set the master clock below 83KHz.
I can't modify the code on master side, so is there any suggestion for my work?
in the top image you can see such communication between two arduinos, both of which support the so-called clock-starching, i.e. the slave is keeping SCL LOW while it is preparing the response.
By definition, in a TWI Bus, a Master is the device that generates the SCL (clock) pulses as many as needed. The slave can modulate only the SDA line to mark ACK or NACK.
GolamMostafa:
By definition, in a TWI Bus, a Master is the device that generates the SCL (clock) pulses as many as needed. The slave can modulate only the SDA line to mark ACK or NACK.
Then you're reading the wrong definition. Go back and read it again. Search for the words "clock stretching".
Operating procedures 1. Let us build as per Fig-1. 2. Upload programs for the Master, and for the Slave. 3. Reset both the UNOs. The Prompt messages should be there. 4. Press K1. 5. LCDS shows: Fine!, and LCDM shows: 555.