ATtinyx5 I2C master (and 2Mbaud)

I had trouble with Atmel’s application note so I redid it. I also switched to assembly and made the SCL timing as uniform as possible. This is 400kHz (a bit faster at 10Mhz, a bit slower at 8 but works without a crystal).

And I actually commented it.

http://harleyhacking.blogspot.com/2009/ … -good.html

Archives and test programs are at some of the other posts.

I also coded a 2Megabaud [edit:]UART output (at 10Mhz) driver so I could use my FTDI breakout to read back things without hogging the CPU.

http://harleyhacking.blogspot.com/2009/ … roved.html

nitpick: “baud” is normally used with asynchronous serial data (UART), with start/stop bits.

SPI, I2C, and other clocked data systems tend to use the term “bps”

I should clarify, the 2 Megabaud goes to my FTDI serial breakout when it is set to 2000000 baud. Yes, async - 1 start bit, 8 data bits, minimal 1 stop bit (usually somewhat longer since you have to reenter the routine and it takes a few clocks). With a 15Mhz Xtal it would be 3Mb.