Dear all, In my system a compass is added to MICAz node by I2C
communication mode in tinyos 2.0. Now I want to obtain the compass output
periodically. The program follows, but I can not obtain the compass output.
In the configuration file { ...... Compass.Resource ->
ATM128I2CMasterC.Resource; Compass. I2CPacket -> ATM128I2CMasterC.I2CPacket;
} In the main fie we define module Compass{ ..... Interface Resource;
Interface I2CPacket<TI2CBasicAddr>} In the Timer function we request the
resource: Timer.fire(){ Resource.request(); ..... } In
the resource granted function we read the compass output by I2C as following
Resource.granted(){ if(call
I2CPacket.write(I2C_START,C0,.....)==SUCCESS) {
// delay(100); if(call
I2CPacket.write(I2C_START,C1,.....)==SUCCESS) call
I2CPacket.read(I2C_START,C1,.....); } Res!
ource.release(); } Even I add the delay(100), it still does not
work. When I track the program, and find the second ``call
I2CPacket.write(I2C_START,C1,.....)`` is not successful. After careful analysis
of the I2C driver, I found in the program Atm128I2CMasterPacketP.nc, when the
I2CPacket.write begins, the variable " state" changes intoI2C_STARTING. When
this function call I2C.sendCommand() function and finishes, the variable state
still is I2C_STARTING. Track the I2C.sendCommand() in the HplAtm128I2CBusP
file and found, there is only one operation TWCR=current. It appear weird
that there is no event to change the state variabe in
Atm128I2CMasterPacketP.nc. It is evident, after the writing operation is done,
there should exist an operation to change the state. But I can not find it.
Does anyone give me help? Thanks a lot! Jianxin Chen
_________________________________________________________________
新年换新颜,快来妆扮自己的MSN给心仪的TA一个惊喜!
http://im.live.cn/emoticons/?ID=18_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help