If the T2 impl is like the T1 version there are four bits
you can send to I2C read/write, which are conveniently
not defined or described anywhere:

/*
** I2CPacket read/write command flags,
**  defined in I2CPacketM.nc but not in a header file...
*/
#define STOP_FLAG       0x01 //send stop/end command at the
                             //  end of the packet
#define ACK_FLAG        0x02 //ack every byte except for the
                             // last received
#define ACK_END_FLAG    0x04 //acks after the last byte read
#define ADDR_8BITS_FLAG 0x80 //slave address is a full eight
                             // bits as sent. w/this bit user
                             // must set read flag explicitly

Through exhaustive testing and spec reading I found that these
two needed to be set for my external device. I believe they
are both the default expected I2C behavior so why they are
non-default options is left as an exercise for the reader:

// works...no END ACK...dunno?
#define I2CP_I2CFLAGS   (STOP_FLAG | ACK_FLAG)

Also watch out for "wait-state" handshakes between bytes on
the I2C bus. The T1 code doesn't detect them and can over run.
If you read one byte correctly then part of another and
nothing more you may need to extend the timeout between
bytes in I2CM.nc

MS



Ronald Eliseo Reyes López wrote:
> 
> ---------- Forwarded message ----------
> From: *Philip Levis* <p...@cs.stanford.edu <mailto:p...@cs.stanford.edu>>
> Date: 2010/5/17
> Subject: Re: Help with I2CPacket.nc
> To: Ronald Eliseo Reyes López <reyesronal...@gmail.com 
> <mailto:reyesronal...@gmail.com>>
> Cc: pbuonado...@archrock.com <mailto:pbuonado...@archrock.com>, 
> j...@archrock.com <mailto:j...@archrock.com>
> 
> 
> Please send questions to tinyos-help. Thanks!
> 
> Phil
> 
> On May 16, 2010, at 5:21 PM, Ronald Eliseo Reyes López wrote:
> 
>  > Hi.
>  >
>  > I'm a student and I need to control an pressure sensor, exactly 
> BMP085 from Bosch Sensortec, for my tesis degree.
>  > This sensor use I2C protocol to communicate with master, which will 
> be a Telosb mote.
>  >
>  > The problem is I don't understand how to use the i2c_flags with the 
> I2CPAcket's command read. The explanation is not enouhg seem me, please 
> anybody can help me?
>  >
>  > I have the new version of tinyos-2.x from cvs repository.
>  >
>  > thanks in advance, and i hope your answer.
>  >
>  > Ronald Reyes
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help@millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to