Microchip AN734 (I2C slave)
I spent most of yesterday getting Microchip’s AN734 code working on a PIC16F690. To spare others the pain, here’s a tarball of my source code and Makefile.
To test this code, I connected a couple wires to the I2C lines on the flash memory on one of my computer’s memory DIMMs. I got the idea from the lm-sensors project. Here’s a photo:

So does it work? I’ll test it using the SMBus tools from lm_sensors. (In Fedora, “yum install lm_sensors” as root will install it).
The SMBus protocol writes an address byte, then reads the resulting data. AN734 just reads/writes the same buffer, so the effect is to echo the SMBus address back.
i2cget will only write to i2c addresses 3 and above. I have fixed this in the tarball above. For whatever reason, the address is half the one given in the an734.asm source file. So I set the address to 0×06.
Now, I’m ready to test:
[root@kaonashi ~]# i2cget -y 0 3 0x01
0x01
[root@kaonashi ~]# i2cget -y 0 3 0xff
0xff
Sweet!
