[Tinyos Core WG] Re: [Tinyos-devel] Re: I2C and SPI sharing

Jonathan Hui jhui at archrock.com
Fri Oct 27 16:26:58 PDT 2006


Kevin Klues wrote:
> So, I'm trying to break this problem down and figure out what the best
> solution is.  So far I've come to notice two things worth noting...
> 
> 1) If unconfigure is not called between subsequent I2C calls (with or
> without the radio/SPI taking over in between), then the whole stack
> breaks.

What do you mean? I have used the implementation to do multiple I2C 
reads/writes between a given request/release pair. What I2C device are 
you testing against?

> 2) The very first I2C write always returns a writeDone with error==FAIL

Again, what I2C device are you testing against?

> Is there any specific reason this is happening?  Why does the I2C bus
> depend on it being configured/unconfigured on every request/release,
> even if no one else has taken over in between.

I believe the SPI is implemented this way too and has always been 
implemented this way ever since configure made it in to the interface. 
In my mind, checking whether the bus has been used by a different client 
or not is simply an optimization, and not fundamental to the functional 
operation of the module.

> Also, the fact that the  very first write fails suggests to me that
> the unconfigure code should actually be located at the beginning of
> the configure code, ensuring that it is always called before the
> current configure code, thus eliminating the dependence on the
> unconfigure call between subsequent I2C writes.

Again, I don't believe there is a need to unconfigure between each 
read/write. If it did, we wouldn't be able to support repeated starts.

--
Jonathan Hui
jhui at archrock.com


More information about the Tinyos-2.0wg mailing list