This time, I'm fighting with I2C and need some help with my Slave.
I'm using the Hardware TWI on Master and on Slave Side.
Everything is working fine, except one thing:
When the Master wants to get data from the slave, but the slave is not ready yet, the slave ISR(TWI_vect) is executed again and again, because the slave is not clearing the TWINT Flag (to hold down the SCL). This repeated calls of the ISR Vector are slowing down all other things.
So, the idea was to switch off the TWI Interrupt (TWIE) after the SLA+R is received and switch the Interrupt back on when the data is ready to send.
But when I do this, everything goes wrong. The Master isn't waiting for the slave and the communication breaks down.
My question: Is my idea (switching the Interrupt off) bad and I should find another way? Or should this method work, but I have to search the problem somewhere else?