[Tinyos-help] I2C, T2 and micaz

Jordi Casals jordi.casals at gmail.com
Wed Feb 28 23:49:35 PST 2007


Ok, thank you! I have read a thread talking about the same problem, and it's
solved!!

The thread is:
http://mail.millennium.berkeley.edu/pipermail/tinyos-help/2007-January/021749.html


2007/2/28, Philip Levis <pal at cs.stanford.edu>:
>
> On Feb 26, 2007, at 6:39 AM, Jordi Casals wrote:
>
> > Hi,
> >
> > I use T2 and a micaz platform and now I am trying to connect an I2C
> > display to my micaz. I don't have the display yet, but I want to
> > have my application ready as soon as possible. I would like to know
> > if the writeDone event is signaled even there is no I2C device
> > connected to my micaz. I don't know if I there is any problem...
> > but Leds.set(0x02) is never called.
> >
> > Thank you
> >
> > ______________________________________________________________
> > module RandomToI2CC{
> >    uses{
> >        interface Boot;
> >        interface Leds;
> >        interface Random;
> >        interface Resource;
> >        interface I2CPacket<TI2CBasicAddr> as I2C;
> >        interface Timer<TMilli> as Timer;
> >    }
> > }
> >
> > implementation{
> >    uint8_t counter = 0;
> >
> >    event void Boot.booted(){
> >        call Leds.set(0);
> >        call Timer.startPeriodic(TIMER_PERIOD);
> >    }
> >      event void Timer.fired(){
> >        if(!(call Resource.isOwner())){
> >            if(call Resource.request() == SUCCESS){
> >                          }
> >        }
> >    }
> >      event void Resource.granted(){
> >        if(call I2C.write(I2C_START | I2C_STOP, 12, sizeof(uint8_t),
> > &counter) == SUCCESS){
> >            call Leds.set(0x01);
> >        }else{
> >            call Leds.set(0xFF);
> >        }
> >    }
> >      async event void I2C.readDone(error_t error, uint16_t addr,
> > uint8_t length, uint8_t* data){
> >          }
> >      async event void I2C.writeDone(error_t error, uint16_t addr,
> > uint8_t length, uint8_t* data){
> >        if(call Resource.release() == SUCCESS){
> >            call Leds.set(0x04);
> >        }
> >        call Leds.set(0x02);
> >    }
> > }
> > ______________________________________________________________
>
>
> When it comes to I2C, things can be hard to debug. I suggest that you
> take a look at how the I2C driver works (chips/atm128/i2c/
> Atm128I2CMasterPacketP.nc). If you're not getting a writeDone(), then
> chances are the I2C isn't issuing an interrupt in response to your
> start condition.
>
> Phil
>



-- 
Jordi Casals
E-mail: jordi.casals at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20070301/f56cd4a8/attachment.html


More information about the Tinyos-help mailing list