[Tinyos-commits]
CVS: tinyos-1.x/tos/platform/telosb DS2411M.nc, 1.1, 1.2
Cory Sharp
cssharp at users.sourceforge.net
Fri Aug 19 15:08:37 PDT 2005
Update of /cvsroot/tinyos/tinyos-1.x/tos/platform/telosb
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17797
Modified Files:
DS2411M.nc
Log Message:
The 1-wire protocol for the DS2411 is picky abut timings. Optimization flags
-Os versus -O change TOSH_uwait enough to cause the protocol to fail. I've
made a more robust uwait here for the DS2411 that uses the TimerA counter which
is running at 1MHz. Outright replacing TOSH_uwait with this code breaks
initialization code.
Index: DS2411M.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/platform/telosb/DS2411M.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DS2411M.nc 2 Dec 2004 22:18:07 -0000 1.1
--- DS2411M.nc 19 Aug 2005 22:08:35 -0000 1.2
***************
*** 42,45 ****
--- 42,51 ----
uint8_t m_id[8];
+ void uwait( uint16_t usec )
+ {
+ const uint16_t t0 = TAR;
+ while( (TAR-t0) < usec );
+ }
+
enum
{
***************
*** 66,74 ****
int present;
call DS2411Pin.output_low();
! TOSH_uwait(STD_H); //t_RSTL
call DS2411Pin.prepare_read();
! TOSH_uwait(STD_I); //t_MSP
present = call DS2411Pin.read();
! TOSH_uwait(STD_J); //t_REC
return (present == 0);
}
--- 72,80 ----
int present;
call DS2411Pin.output_low();
! uwait(STD_H); //t_RSTL
call DS2411Pin.prepare_read();
! uwait(STD_I); //t_MSP
present = call DS2411Pin.read();
! uwait(STD_J); //t_REC
return (present == 0);
}
***************
*** 77,83 ****
{
call DS2411Pin.output_low();
! TOSH_uwait(STD_A); //t_W1L
call DS2411Pin.output_high();
! TOSH_uwait(STD_B); //t_SLOT - t_W1L
}
--- 83,89 ----
{
call DS2411Pin.output_low();
! uwait(STD_A); //t_W1L
call DS2411Pin.output_high();
! uwait(STD_B); //t_SLOT - t_W1L
}
***************
*** 85,91 ****
{
call DS2411Pin.output_low();
! TOSH_uwait(STD_C); //t_W0L
call DS2411Pin.output_high();
! TOSH_uwait(STD_D); //t_SLOT - t_W0L
}
--- 91,97 ----
{
call DS2411Pin.output_low();
! uwait(STD_C); //t_W0L
call DS2411Pin.output_high();
! uwait(STD_D); //t_SLOT - t_W0L
}
***************
*** 102,110 ****
int bit;
call DS2411Pin.output_low();
! TOSH_uwait(STD_A); //t_RL
call DS2411Pin.prepare_read();
! TOSH_uwait(STD_E); //near-max t_MSR
bit = call DS2411Pin.read();
! TOSH_uwait(STD_F); //t_REC
return bit;
}
--- 108,116 ----
int bit;
call DS2411Pin.output_low();
! uwait(STD_A); //t_RL
call DS2411Pin.prepare_read();
! uwait(STD_E); //near-max t_MSR
bit = call DS2411Pin.read();
! uwait(STD_F); //t_REC
return bit;
}
More information about the Tinyos-commits
mailing list