Antenna Diversity on CYW943907AEVAL1F
This blog post discusses the antenna diversity feature available in CYW43907, streamlined for robust Wi-Fi connectivity. CYW943907AEVAL1F has two PCB antennas to improve the quality and reliability of a wireless link in a non-static environment. In this device, a running average SNR is maintained for each antenna amongst which antenna with better SNR is chosen to support changing environmental conditions.
The CYW943907AEVAL1F EVK has provision for two external antennas along with the on-board PCB antennas (ANT 0 & ANT 1). Two external antennas are connected to the J1 and J2 connector which has an internal switch connected to it. When an External antenna is connected to J1 and J2 PCB antennas are automatically dis-connected.
Note: After connecting the external antennas in the J1 and J2 connector, please make sure I and O pins of J1/J2 are shorted. Else press the external antennas properly. The CYW43907 has ANT0_DIV_RF_SW_CTRL_4, ANT1_DIV_RF_SW_CTRL_5 control signals which are routed to an SPDT switch (U7) which works based on the following truth table.
|VCON1 (5 of U7)|
VCON2 (2 of U7)
|ANT0 (4 of U7)||ANT1 (3 of U7)|
For Antenna diversity to be enabled following NVRAM parameters should be enabled. Please refer to following link for more details about NVRAM parameters
- swdiv_en: 0 - disable software diversity; 1 - enable software diversity
- swdiv_gpio: specify which GPIO pin will be used for software diversity control (for CYW943907AEVAL1F swdiv_gpio = 0 because we are not controlling the antenna diversity through GPIO)
- swdiv_swcntrl_en: diversity mode control variety; 4390x is using mode 2 (controlled by Phy layer)
- swdiv_swctrl_ant0, swdiv_swctrl_ant1=1: entries used as shared memory setting for ucode activity, now uses mode 1 (swdiv_swctrl_ant0 = 0, swdiv_swctrl_ant1 = 1)
A sample application is attached to this blog post which calls the IOCTLs to check the active antenna. Please refer to How to use IOCTL commands in CYW43907 to understand the way APIs are being used. The definitions of the used IOCTLs are provided below.
|WLC_SET_ANTDIV||-1: default antdiv setting; 0: Force reception on antenna 0; 1: Force reception on antenna 1; 2: Start diversity reception with antenna 1; 3: Start diversity reception with antenna 0|
|WLC_GET_ANTDIV||Returns the current antenna diversity method in use|
|WLC_GET_RX_ANT||Returns last used RX antenna|
In our environment, some attenuators are introduced in one of the two antenna paths; hence the antenna diversity algorithm should select the other antenna after a brief settling period which can be displayed in the oscilloscope if you probe 2nd and 5th pin of U7 (shown in below image).
So, by probing the pins of U7, the user can match the console log with the physical signals going into the antennas.
WL commands for antenna diversity
Following are the WL commands that are used to control antenna diversity instead of being controlled by application.
- wl antdiv <value>
- 0 Forces the use of antenna 0
- 1 Forces the use of antenna 1
- 3 Automatic selection of antenna diversity
- wl swdiv_reset_stats - Resets the antenna diversity statistics
- wl swdiv_stats - returns the antenna diversity related statistics