Using the Propeller as an I2C Slave Device

AiChip Industries has released code which allows a Propeller to be used as a simple I2C Slave device.

Original Parallax Propeller Forum thread : here

Vetson 005 ( 2008-04-13 ) source code can be downloaded from the Parallax Forum : here - It is recommended to check the forum thread for later versions.

A selection of source code is provided -
  • I2cSlave_Demo : Test code to proves it all works
  • I2cSlave_Slave : The actual I2C Slave handler ( PASM )
  • I2cSlave_Master : I2C Master routines ( Spin )
  • I2cSlave_16Kx8Ram : Test of 16Kx8 I2C Ram
  • I2cSlave_32Kx8Ram : Theoretical 32Kx8 I2C Ram
  • I2cLogger_Demo : Demonstrates I2C Bus capture / logging

The I2C Slave implementation allows a number of I2C Ram devices to be emulated, limited only by Propeller Chip memory capacity and Cog Numbers. The entire 32KB Hub memory can be used. A 1Kx8 I2C Ram can be emulated per Cog without requiring any Hub resources. The maximum capacity for a single Propeller Chip is 39KB ( one 32KBx8 plus seven 1Kx8 ).

A Propeller Chip I2C Ram is accessed in exactly the same way as an I2C eeprom would be. The I2C Slave supports 7-bit and 10-bit device addressing and is written in Propeller Assembler (PASM) for maximum speed. The I2C Ram is cleared at start-up.

In addition to the I2C Slave code a modified version of it is provided to demonstrate how I2C Bus capture and logging could be performed.