You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.3 (Windows Store 1.8.6.0)
-I'm using a Tiny25 to scan for an unknown number of I2C devices so I later can only send data to devices that I know exist. In doing this, I'm sending a known request for version info from the slave devices. The problem is if the device doesn't exist then TinyWireM.endTransmission() does not return the SCL line to high.
You can see the clock not returning to high here:
Close up of where the problem starts:
Data 0x14 is the reply from a device, address 0x11 is a non-existent possible device.
Snippet of the scanning code: for (int a = 0x10; a < 0x18; a++) { TinyWireM.beginTransmission(a); TinyWireM.send(0x7F); TinyWireM.endTransmission(); if (TinyWireM.requestFrom(a, 1) > 0) { Addresses[AirChains++] = a; while(TinyWireM.available()) { TinyWireM.receive(); } } delayMicroseconds (50); }
The text was updated successfully, but these errors were encountered:
I am able to work around the issue by changing the following code in TinyWireM.cpp
uint8_t USI_TWI::endTransmission(uint8_t stop){ // actually sends the buffer
bool xferOK = false;
uint8_t errorCode = 0;
xferOK = USI_TWI_Start_Read_Write(USI_Buf,USI_BufIdx+1); // core func that does the work
USI_BufIdx = 0;
if (xferOK) {
if (stop) {
errorCode = USI_TWI_Master_Stop();
if (errorCode == 0) {
errorCode = USI_TWI_Get_State_Info();
return errorCode;
}
}
return 0;
}
else { // there was an error
errorCode = USI_TWI_Get_State_Info(); // this function returns the error number
USI_TWI_Master_Stop(); //Forces a STOP to be sent -- added by Muadeeb
return errorCode;
}
}
Arduino board: None -- raw ATTiny25
Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.3 (Windows Store 1.8.6.0)
-I'm using a Tiny25 to scan for an unknown number of I2C devices so I later can only send data to devices that I know exist. In doing this, I'm sending a known request for version info from the slave devices. The problem is if the device doesn't exist then TinyWireM.endTransmission() does not return the SCL line to high.
You can see the clock not returning to high here:
Close up of where the problem starts:
Data 0x14 is the reply from a device, address 0x11 is a non-existent possible device.
Snippet of the scanning code:
for (int a = 0x10; a < 0x18; a++) { TinyWireM.beginTransmission(a); TinyWireM.send(0x7F); TinyWireM.endTransmission(); if (TinyWireM.requestFrom(a, 1) > 0) { Addresses[AirChains++] = a; while(TinyWireM.available()) { TinyWireM.receive(); } } delayMicroseconds (50); }
The text was updated successfully, but these errors were encountered: