Greetings,
I'm looking to control the default radio power level at runtime for
Telos motes using TinyOS-2.x. In tos/chips/cc2420/CC2420Power.nc I
see the following comment:
"[This] does not include transmission power, see the CC2420Config interface."
However, the CC2420Config interface does not include any command to
set the default radio power level. The file
tos/chips/cc2420/CC2420ControlP.nc includes a state variable
'm_tx_power' that is initialized to CC2420_DEF_RFPOWER; however, that
variable is never used. The file tos/chips/cc2420/CC2420TransmitP.nc
directly uses CC2420_DEF_RFPOWER to set the default power level:
if ( !tx_power ) {
// If our packet's tx_power wasn't configured to anything but 0,
// send it using the default RF power. This assumes the
// packet's metadata is all set to 0's on boot.
tx_power = CC2420_DEF_RFPOWER;
}
It looks to me like the original intent was to provide a software
interface for setting the default radio power level via the
CC2420Config, but that its realization got lost along the way. With
the current implementation, I cannot see a way to set the default
radio power in software.
One way to resolve this would be to add two new commands to the
CC2420Config interface:
command uint8_t getDefaultTxPower();
command void setDefaultTxPower(uint8_t txPower);
Then, in CC2420ControlP add implementations of those commands (again,
'm_tx_power' is already declared in this module and initialized to
CC2420_DEF_RFPOWER):
command uint8_t CC2420Config.getDefaultTxPower() {
return m_tx_power;
}
command uint8_t CC2420Config.setDefaultTxPower(uint8_t txPower) {
m_tx_power = txPower;
}
Then, in CC2420TransmitP use the CC2420Config interface, and call the
getDefaultTxPower command to set the default power:
if ( !tx_power ) {
// If our packet's tx_power wasn't configured to anything but 0,
// send it using the default RF power. This assumes the
// packet's metadata is all set to 0's on boot.
tx_power = call CC2420Config.getDefaultTxPower();
}
Does this seem reasonable? Am I missing some other mechanism to set
the default radio power level in software?
Thanks in advance for your assistance.
Andy
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help