Hi all,
 
I am trying to add a new attribute for an external pressure sensor on basicsb. I am using TinyOS 1.1.6v.
 
However, seems that I wired up something wrong. Here is what I did:
 
 
     1.  I created Pressure.nc and PressureM.nc files which I included in sensorboards/basicsb. Since it is analogue sensor I basically c/v the code from Photo.nc and           PhotoM.nc just changing the names. 
    Pressure.nc file:

includes sensorboard;

configuration Pressure

{

provides interface ADC as PressureADC;

provides interface StdControl;

}

implementation

{

components PressureM, ADCC;

StdControl = PressureM;

PressureADC = ADCC.ADC[TOS_ADC_PRESSURE_PORT];

PressureM.ADCControl -> ADCC;

}

PressureM.nc file:

includes sensorboard;

module PressureM {

provides interface StdControl;

uses {

interface ADCControl;

}

}

implementation

{

command result_t StdControl.init() {

call ADCControl.bindPort(TOS_ADC_PRESSURE_PORT, TOSH_ACTUAL_PRESSURE_PORT);

TOSH_MAKE_PRESSURE_CTL_OUTPUT();

TOSH_SET_PRESSURE_CTL_PIN();

dbg(DBG_BOOT, "PRESSURE initialized.\n");

return call ADCControl.init();

}

command result_t StdControl.start() {

TOSH_MAKE_PRESSURE_CTL_OUTPUT();

TOSH_SET_PRESSURE_CTL_PIN();

return SUCCESS;

}

command result_t StdControl.stop() {

TOSH_CLR_PRESSURE_CTL_PIN();

return SUCCESS;

}

}

 

    2.  I created the attribute files (AttrMoto.nc and AttrMotoM.nc)
 
            AttrMoto.nc:
               

configuration AttrMoto {

provides

{

interface ADC as PressureADC;

interface StdControl;

}

} implementation {

components Pressure, AttrMotoM, Attr;

PressureADC = Pressure;

StdControl = Pressure;

StdControl = AttrMotoM;

AttrMotoM.AttrRegister -> Attr.Attr[unique("Attr")];

AttrMotoM.ADC -> Pressure.PressureADC;

AttrMotoM.SubControl -> Pressure.StdControl;

}

 

In AttrMotoM.nc I changed only the following:

                    command result_t StdControl.init()

{

call SubControl.init();

if (call AttrRegister.registerAttr("pressure", UINT16, 2) != SUCCESS)

return FAIL;

return SUCCESS;

}

 

    3.  I added the attribute "pressure" to the catalog.xml file
 
    4.  Changed TinyDBAttr.nc as follows:
 

includes Attr;

configuration TinyDBAttr {

provides interface AttrUse;

provides interface StdControl;

}

implementation {

components Attr, AttrPot, AttrGlobal, TinyDBAttrM, TupleRouterM, AttrTime,

TinyAlloc, NETWORK_MODULE

#ifdef kEEPROM_ATTR

, AttrLog

#endif

#if !defined(PLATFORM_PC)

, AttrVoltage

#endif

#if defined(BOARD_MICASB) || defined(BOARD_BASICSB)

, AttrPhoto, AttrMoto//, AttrTemp

//#if !defined(PLATFORM_PC)

// , AttrAccel

//# ifdef kUSE_MAGNETOMETER

// , AttrMag

//# endif

// , AttrMic

//#endif

#endif /* BOARD_MICASB */

#if defined(BOARD_MICAWB) || defined(BOARD_MICAWBDOT)

, AttrHumidity, AttrTaosPhoto, AttrPressure//, AttrHamamaTsu // , AttrMelexis

#endif /* BOARD_MICAWB */

#ifdef BOARD_MDA300CA

, AttrEcho10, AttrHumidity

#endif

;

AttrUse = Attr.AttrUse;

AttrGlobal.StdControl = StdControl;

AttrPot.StdControl = StdControl;

AttrTime.StdControl = StdControl;

#ifdef kEEPROM_ATTR

AttrLog.StdControl = StdControl;

#endif

TinyDBAttrM.StdControl = StdControl;

#if !defined(PLATFORM_PC)

AttrVoltage.StdControl = StdControl;

#endif

#if defined(BOARD_MICASB) || defined(BOARD_BASICSB)

AttrPhoto.StdControl = StdControl;

// AttrTemp.StdControl = StdControl;

AttrMoto.StdControl = StdControl;

//#if !defined(PLATFORM_PC)

// AttrAccel.StdControl = StdControl;

//#ifdef kUSE_MAGNETOMETER

// AttrMag.StdControl = StdControl;

//#endif

// AttrMic.StdControl = StdControl;

//#endif

#endif /* BOARD_MICASB */

#if defined(BOARD_MICAWB) || defined(BOARD_MICAWBDOT)

AttrHumidity.StdControl = StdControl;

AttrTaosPhoto.StdControl = StdControl;

AttrPressure.StdControl = StdControl;

// AttrHamamaTsu.StdControl = StdControl;

// AttrMelexis.StdControl = StdControl;

#endif /* BOARD_MICAWB */

#ifdef BOARD_MDA300CA

AttrEcho10.StdControl = StdControl;

AttrHumidity.StdControl = StdControl;

#endif

TinyDBAttrM.ParentAttr -> Attr.Attr[unique("Attr")];

#ifdef kCONTENT_ATTR

TinyDBAttrM.ContentionAttr -> Attr.Attr[unique("Attr")];

#endif

TinyDBAttrM.FreeSpaceAttr -> Attr.Attr[unique("Attr")];

TinyDBAttrM.QueueLenAttr -> Attr.Attr[unique("Attr")];

TinyDBAttrM.MHQueueLenAttr -> Attr.Attr[unique("Attr")];

TinyDBAttrM.DepthAttr -> Attr.Attr[unique("Attr")];

TinyDBAttrM.QidAttr -> Attr.Attr[unique("Attr")];

// TinyDBAttrM.XmitCountAttr -> Attr.Attr[unique("Attr")];

TinyDBAttrM.QualityAttr -> Attr.Attr[unique("Attr")];

#ifdef kHAS_NEIGHBOR_ATTR

TinyDBAttrM.NeighborAttr -> Attr.Attr[unique("Attr")];

#endif

TinyDBAttrM.QueryProcessor -> TupleRouterM;

TinyDBAttrM.NetworkMonitor -> NETWORK_MODULE;

TinyDBAttrM.MemAlloc -> TinyAlloc;

}

 

What happens is, if I select only nodeid from GUI I can get the nodeid back. However If I choose nodeid and pressure attributes in GUI I cannot even get the nodeid back. I tested the pressure sensor using temp.nc file and "temp" attribute wiring the pressure sensor on the temp ADC port and it worked fine, so it is not a HW problem.

Any ideas, suggestions?

 

Regards,

Amra

     
_______________________________________________
Tinyos-users mailing list
[EMAIL PROTECTED]
http://mail.Millennium.Berkeley.EDU/mailman/listinfo/tinyos-users

Reply via email to