WARP Project Forums - Wireless Open-Access Research Platform

You are not logged in.

#1 2013-Dec-19 08:06:47

matthias
Member
From: TU Darmstadt (Germany)
Registered: 2013-Jan-09
Posts: 44

Immediate transmission in 802.11 using wlan_tx_start

Dear 802.11 developers,

I'd like to transmit wifi frames, even if the wireless channel is busy. Therefore, I'd like to bypass the wlan_mac_dcf_hw and trigger a transmission in software. In the reference design's header files I found the wlan_tx_start and the wlan_tx_buffer_sel functions which seem to be required to achieve my goal.

As a first test, I created an ACK frame and triggered the transmission which resulted in the "Tx PHY Running" (debug header, connected to D7 in screen shot) to go up. However, it seems like the phy signal field is ignored during the transmission as a change of rate and length (by changing tx_length variable) settings---using wlan_phy_set_tx_signal---does not influence the length of the high phase of the "Tx PHY Running" signal.

Am I missing something in my code?

Code:

	tx_length = wlan_create_ack_frame((void*)(TX_PKT_BUF_TO_ADDR(TX_PKT_BUF_ACK) + PHY_TX_PKT_BUF_MPDU_OFFSET), rx_header->address_1);
	wlan_phy_set_tx_signal(TX_PKT_BUF_ACK, WLAN_PHY_RATE_BPSK12, tx_length + WLAN_PHY_FCS_NBYTES);
	wlan_tx_buffer_sel(TX_PKT_BUF_ACK);
	wlan_tx_start();

http://picload.org/image/owdwrol/20130627.png

Offline

 

#2 2013-Dec-19 08:41:04

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: Immediate transmission in 802.11 using wlan_tx_start

I think you found a bug in the code.

The Tx PHY register WLAN_TX_REG_PKT_BUF_SEL has two fields:
  [3:0]: Tx pkt buf selection
  [23:16]: PHY header offset

The PHY header offset field sets the "zero" byte for the PHY's accesses of the packet buffer. This allows the MAC to store the tx_frame_info struct at the base of each pkt buffer. The PHY ignores this by jumping ahead PHY_header_offset bytes when starting a transmission.

We added this feature long after writing the wlan_tx_buffer_sel() function. And since we don't use wlan_tx_buffer_sel() in the reference implementation, we didn't notice that it was overwriting both fields. Sorry for the error.

Try replacing the code for wlan_tx_buffer_sel() with:

Code:

inline void wlan_tx_buffer_sel(u8 n) {
	//The register-selected Tx pkt buffer is only used for transmissions that
	// are initiated via wlan_tx_start(); normal MAC transmissions will use
	// the mac_hw Tx functions, which override this pkt buf selection

	//Overwrite only the 4LSB (preserve rest of register)
	Xil_Out32(WLAN_TX_REG_PKT_BUF_SEL, ((Xil_In32(WLAN_TX_REG_PKT_BUF_SEL) & ~0xF) | (n & 0xF)) );
	return;
}

Offline

 

#3 2013-Dec-20 17:04:15

matthias
Member
From: TU Darmstadt (Germany)
Registered: 2013-Jan-09
Posts: 44

Re: Immediate transmission in 802.11 using wlan_tx_start

Thanks for the explaination, it works!

Offline

 

#4 2013-Dec-22 03:09:37

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: Immediate transmission in 802.11 using wlan_tx_start

Great.

One thing to watch for when using this- the Tx PHY could interrupt an ongoing reception. The Tx PHY controls the Tx/Rx state of the MAX2829 via the radio_controller usr_ ports. By starting a transmission directly via wlan_tx_start(), the Tx PHY will switch the radio to Tx mode immediately, even if the Rx PHY is mid-reception. The Rx PHY would continue processing samples and eventually fail the FCS check. The DCF implementation prevents this by treating Rx-PHY-busy as CCA-busy, causing potential Tx events to defer until post-Rx.

Offline

 

#5 2014-Nov-05 05:17:06

matthias
Member
From: TU Darmstadt (Germany)
Registered: 2013-Jan-09
Posts: 44

Re: Immediate transmission in 802.11 using wlan_tx_start

Hallo Patrick,

it is already a while, that I last used the wlan_tx_start() function to directly transmit frames. Now, I ported my design to version 1.0.0 of the reference design. However, I realized that changes in the wlan_phy_tx_pmd_axiw_v2_01_a core prevent the wlan_tx_start() function to work properly, as tx gains and tx antenna mask signals are always passed though from external inputs, even if a transmission gets triggered by software. To circumvent the problem, I created a new register for tx gains and the tx antenna mask in the wlan_phy_tx_pmd_axiw_v2_01_a core and created a new macro to set values from C:

Code:

#define wlan_mac_tx_params(gain_rf_a, gain_rf_b, gain_rf_c, gain_rf_d, antMask) \
	Xil_Out32(XPAR_WLAN_PHY_TX_MEMMAP_TX_PARAMS, \
			(gain_rf_a & 0x3F) | \
			((gain_rf_b & 0x3F) << 6) | \
			((gain_rf_c & 0x3F) << 12) | \
			((gain_rf_d & 0x3F) << 18) | \
			((antMask & 0xF) << 24))

Now, the transmission using wlan_tx_start() works again with the following code:

Code:

		wlan_phy_set_tx_signal(TX_PKT_BUF_ACK, WLAN_PHY_RATE_BPSK12, tx_length);

		wlan_tx_buffer_sel(TX_PKT_BUF_ACK);
		wlan_mac_tx_params(40, 40, 40, 40, 0x1);

		wlan_tx_start();

I was wondering, if you could add my modifications to the next version of the reference design, so that I do not need to patch it every time a new version comes out.

Here are the changes in the Simulink project:
http://img5.picload.org/image/calaicr/screenshot2014-11-05at12.05.53.png
http://img5.picload.org/image/calaica/screenshot2014-11-05at12.06.01.png
http://img5.picload.org/image/calaicl/screenshot2014-11-05at12.06.16.png

Last edited by matthias (2014-Nov-05 05:17:30)

Offline

 

#6 2014-Nov-05 21:12:06

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: Immediate transmission in 802.11 using wlan_tx_start

I think you can achieve the same control with no hardware changes. I haven't actually tested this but am pretty sure it will work.

To control which RF interfaces are asserted when the Tx PHY starts, edit wlan_radio_init() in wlan_phy_util.c:

Code:

//Reference code - Tx PHY controls TxEn for all radios
radio_controller_setCtrlSource(RC_BASEADDR, (RC_RFA | RC_RFB), (RC_REG0_TXEN_CTRLSRC), RC_CTRLSRC_HW);

//Custom code - Tx PHY asserts all TxEn outputs; radio_controller ignores usr_TxEn for RF B
radio_controller_setCtrlSource(RC_BASEADDR, (RC_RFA), (RC_REG0_TXEN_CTRLSRC), RC_CTRLSRC_HW);
radio_controller_setCtrlSource(RC_BASEADDR, (RC_RFB), (RC_REG0_TXEN_CTRLSRC), RC_CTRLSRC_REG);

In wlan_phy_init:

Code:

//Reference code - Use MAC ant_mask ports to select active radio per Tx
REG_SET_BITS(WLAN_TX_REG_CFG, WLAN_TX_REG_CFG_USE_MAC_ANT_MASKS);

//Custom code - ignore MAC ant_masks; assert all RC_USR_TXEN outputs for every Tx
REG_CLEAR_BITS(WLAN_TX_REG_CFG, WLAN_TX_REG_CFG_USE_MAC_ANT_MASKS);

To control the Tx VGA gain from software, edit wlan_radio_init() in wlan_phy_util.c:

Code:

//Reference code - Tx PHY controls Tx gains via usr_ radio_controller ports
radio_controller_setTxGainSource(RC_BASEADDR, RC_ALL_RF, RC_GAINSRC_HW);

//Custom code - Tx gains set by software
radio_controller_setTxGainSource(RC_BASEADDR, RC_ALL_RF, RC_GAINSRC_REG);

Then to change the active RF interface or Tx power between transmissions:

Code:

radio_controller_setTxGainTarget(RC_BASEADDR, RC_ALL_RF, new_gain_value);

//Select RF B for Tx
radio_controller_setCtrlSource(RC_BASEADDR, (RC_RFB), (RC_REG0_TXEN_CTRLSRC), RC_CTRLSRC_HW);
radio_controller_setCtrlSource(RC_BASEADDR, (RC_RFA), (RC_REG0_TXEN_CTRLSRC), RC_CTRLSRC_REG);

One other thing to consider- you can achieve very similar control of the transmitter even when routing Tx events through the wlan_mac_dcf_hw core. The NoMAC application for CPU Low does this. Every packet passed down from CPU High is transmitted immediately. The DCF core is configured to ignore medium-busy events from physical carrier sensing and the NAV. The core's Tx state machine runs for every new Tx, but immediately transitions from ST_IDLE to ST_DO_TX, since the idle_for_difs input will always be true.

If this flow would work for your application, it would make porting your code forward to updated reference designs much easier.  If this flow won't work, please let us know why so we can consider improving this.

Offline

 

#7 2014-Nov-06 17:16:37

matthias
Member
From: TU Darmstadt (Germany)
Registered: 2013-Jan-09
Posts: 44

Re: Immediate transmission in 802.11 using wlan_tx_start

The NoMAC design was exactly what I needed ;-) Thanks.

Offline

 

#8 2014-Nov-12 02:29:07

matthias
Member
From: TU Darmstadt (Germany)
Registered: 2013-Jan-09
Posts: 44

Re: Immediate transmission in 802.11 using wlan_tx_start

This is exactly the behavior that I need.

Offline

 

Board footer