Hi ,
I am trying to read out values from a Temp Sensor (LTC4151) which is
interfaced to a MSP430 micro controller on a TelosB Platform. The micro
controller uses an I2C interface to talk to the sensor. I am using TinyOS
2.1.0 for making the application. I have wired my application to the
following component *tinyos2.1.0/tos/chips/msp430/usart/MSP430I2CC*
I have the above setup which senses the temp sensor values and transmits to
a base station on the PC. Now I would like to write some values into the
internal registers of the temperature sensor and read them back for testing
purposes. According to the datasheet, I have to initialize the control
register of the temp sensor to a value 0x1C for writing into its
registers.
I have tried to initialize the control register value in file *
tinyos2.1.0/tos/chips/msp430/usart/HplMSP430I2C0P.nc* as follows
async command void HplI2C.setModeI2C( msp430_i2c_union_config_t* config )
{
.....
atomic {
U0CTL &= ~(I2C | I2CEN | SYNC);
U0CTL = SWRST;
U0CTL |= SYNC | I2C;
U0CTL &= ~I2CEN;
U0CTL = (config->i2cRegisters.uctl | (I2C | SYNC)) & ~I2CEN;
* // I2CTCTL = config->i2cRegisters.i2ctctl;
I2CTCTL = 0x1c; *
I2CPSC = config->i2cRegisters.i2cpsc;
I2CSCLH = config->i2cRegisters.i2csclh;
I2CSCLL = config->i2cRegisters.i2cscll;
I2COA = config->i2cRegisters.i2coa;
U0CTL |= I2CEN;
}
However, If i do this, the I2C module becomes non functional. The Read/
Write commands in I2C interface stops working
OR
Should I do this in *tinyos2.1.0/tos/chips/msp430/usart/msp430usart.h
*typedef union {
msp430_i2c_config_t i2cConfig;
msp430_i2c_registers_t i2cRegisters;
} msp430_i2c_union_config_t;
msp430_i2c_union_config_t msp430_i2c_default_config = {
{
rxdmaen : 0,
txdmaen : 0,
xa : 0,
listen : 0,
mst : 1,
i2cword : 0,
i2crm : 1,
i2cssel : 0x2,
i2cpsc : 0,
i2csclh : 0x3,
i2cscll : 0x3,
i2coa : 0,
* i2ctctl : 0x1C, //00011100*
}
Could someone tell me if I am doing it right? or point me to the right
place?
Thanks ,
Venkat.
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help