On Thursday 28 September 2006 03:42 pm, [EMAIL PROTECTED] wrote: > Hi, > Is there any code in the tinyos tree for the tmote to act as a I2C slave. > I could find code (MSP430I2CPacket) for it to act as I2C master.
You might want to check Boomerang; it apparently has features for the TMote platform not in vanilla TinyOS. I recently hacked on the current development snapshot of TinyOS-2.x to add I2C slave support for MSP430. It might work on TMote without changes. The code is ugly, put together quickly to help me understand some I2C mechanics. I'm not up to speed on I2C, and this code is surely not the right way to integrate slave support. But it might be useful as a guide. I've attached a tar.gz file with the code. I'm not sure it's kosher to send attachments to the list -- please send flames my way if not. The MSP430's I2C hardware peripheral is super easy to use as a slave. Just initialize slave mode by calling: Create an Msp430I2CConfigure component having the correct slave address in the msp430_i2c_config structure's i2coa field. call HplI2C.setSlaveMode(); call HplI2C.setReceiveMode(); call HplI2C.enableTransmitReady(); call HplI2C.enableReceiveReady(); I hacked the above into a copy of Msp430I2CP.nc as a new command I2CSlave.listen(). Then, in the same component, I2CInterrupts.fired() will call nextRead() and nextWrite() as the I2C hardware exposes requests from a master targeting the slave. These two functions can signal new I2CSlave events to either send I2C data from the bus to the app or vice versa, as required. Steve
slavei2c.tar.gz
Description: application/tgz
_______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
