Closed oddstr13 closed 9 years ago
Attiny must have pullup and double check the pins.
Pull-up is present. Pins are double checked, triple checked and so on. They are the same as MISO and SCK SPI pins on the attiny84 and attiny85.
One of these days, I'll get myself a saleae, so that I can see what's going on. There are a few tools I would like to get before it however, like a proper soldering station.
I see that the attinys use a different backend for the I2C, might be related. cores/cosa/Cosa/TWI.hh#L25
The attinys use USI. They do not have true TWI support. The TWI protocol is "manually" parsed.
Possibly related to the issue: http://www.advamation.com/knowhow/raspberrypi/rpi-i2c-bug.html Would need a logic analyzer or oscilloscope to confirm.
@oddstr13
Thanks for continuing the research on this issue. This gives me a good lead on what could be done. There are some timing constants in the Cosa TWI implementation for USI (ATtiny) that you can tweak. https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/USI/USI_TWI.cpp#L25
You could start by turning on USE_FAST_MODE.
After that we would need to know what is the timing to keep within the non-stretch limit.
Cheers!
@oddstr13
Could you please confirm that the ATtiny (TWI slave) shows up when scanned from an Arduino? That it is really just an rpi i2c issue.
The CosaTWIscanner sketch does indeed see the ATtiny84/85.
They do seem to freeze up from time to time, not quite sure why, but it seems to be related to me moving around the wires for the i2c bus on my breadboard. Resetting tiny fixes it. Likely a separate issue.
Thanks for the update even if it actually puts an issue on the table that I have avoided; TWI timeout. Currently there is no error state when the protocol fails. Robustness could be improved if the TWI Slave is to have a broader usage.
CosaTWIslave does not show up on the I2C bus when uploaded to:
CosaTWIslave does show up when uploaded to:
My current definition of show up is the following python script ran on a Raspberry Pi B1, outputting
0x5a
as one of the available devices on the bus.