RT73: how to control txpower

Live forum: http://rt2x00.serialmonkey.com/viewtopic.php?t=4668


12-03-2008 06:17:48

Now I use Atmel usbkey to control a wireless adapter which uses RT2571WF. So I have looked into the RT2x00 project source code and modified it to make it running on the Atmel usbkey. One of my requirements is to control transmite power. I found the code as follows.

code in rt73usb.h
* Macro's for converting txpower from EEPROM to mac80211 value
* and from mac80211 value to register value.
#define MIN_TXPOWER 0
#define MAX_TXPOWER 31

#define RF3_TXPOWER FIELD32(0x00003e00)

#define TXPOWER_TO_DEV(__txpower) \
({ \
((__txpower) <= MIN_TXPOWER) ? MIN_TXPOWER : \
(((__txpower) >= MAX_TXPOWER) ? MAX_TXPOWER : \
(__txpower)); \
code in rt73usb.c

[code1yy8o0wb]static void rt73usb_config_channel(struct rt2x00_dev *rt2x00dev,
struct rf_channel *rf, const int txpower)
u8 r94;
rt2x00_set_field32(&rf->rf3, RF3_TXPOWER, TXPOWER_TO_DEV(txpower));

r94 = 6;
if (txpower > MAX_TXPOWER && txpower <= (MAX_TXPOWER + r94))
r94 += txpower - MAX_TXPOWER;
else if (txpower < MIN_TXPOWER && txpower >= (MIN_TXPOWER - r94))
r94 += txpower;
rt73usb_bbp_write(rt2x00dev, 94, r94);

But I still do'nt konw the details. For example, if I want to make transmit power to be 15dbm, which value of txpower in the code should I set? what is the use of bbp94 register? Please help me!


12-03-2008 13:46:49

I seriously have no idea where the BBP94 register is for, I couldn't find a good description for it in the legacy drivers.

Looking at older devices setting the txpower in the rf3 word was correct (not sure if it worked, by the legacy drivers used that approach).


13-03-2008 01:48:31

The problem where BBP94 register is for seems not so important. I really want to know what is the relationship between the number from 0 to 31 and the real transmit power(dbm or mw).

The default txpower of channel 1 in EEPROM is 0x0C.What does this mean? Is txpower of channel 1 0x0Cdbm or 0x0Cmw or something else?

Best regards!


13-03-2008 11:10:14

Those numbers are considered "magical", which means that the legacy driver nor the documentation give any hints about its meaning... (
If anybody does manage to "crack the code" and decipher the meaning of the values, I will be more then happy to put additional comments in the code to clarify them. But until then the only thing you can do is experiment a bit with a values and look at the effects.