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
_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help