lucullusTheOnly / TinyWire

Composite Master and Slave I2C library for Atmels ATTiny microcontrollers
107 stars 26 forks source link

Pure master is blocking itself after first transmission #6

Open lucullusTheOnly opened 6 years ago

lucullusTheOnly commented 6 years ago

When using the TinyWire library as a pure master it seems to block itself after the first transmission.

This issue was found on arduino.stackexchange.com. The asker used an ATTiny85 as the master and an Arduino UNO as a slave. I have confirmed this with my own ATTiny85 and an Arduino Nano.

lucullusTheOnly commented 6 years ago

In my circuit the library sends error code 6, which is an unexpected stop condition in the NOISE_TESTING define block in the function USI_TWI_Start_Read_Write. Even when resetting the flag after we detected a Stop condition with the PinChange interrupt does not solve the issue. Maybe the flag reacts also to low noise on the line or it is set after a longer period of time (longer than 7us). This issue doesn't show up, if you initialize the library as slave, because then it executes Twi_master_init() directly before it starts sending, which resets all USI flags.

For now I have deactivated the NOISE_TESTING block. It is the question, if this block is really usefull.