SWRU455M February 2017 – October 2020 CC3120 , CC3120MOD , CC3130 , CC3135 , CC3135MOD , CC3220MOD , CC3220MODA , CC3220R , CC3220S , CC3220SF , CC3230S , CC3230SF , CC3235MODAS , CC3235MODASF , CC3235MODS , CC3235MODSF , CC3235S , CC3235SF
The configuration of this feature is possible through the Host APIs. The possible configuration includes the mode of the feature and the antennas’ pad number ("pin mux"). This configuration is persistent. Reset is required to apply the changes. The following attributes can be configured:
Example:
typedef enum
{
SL_WLAN_ANT_SELECTION_DISABLED,/* Antenna selection disabled */
SL_WLAN_ANT_SELECTION_ANT1,/* Antenna selection - statically select antenna 1 */
SL_WLAN_ANT_SELECTION_ANT2,/* Antenna selection - statically select antenna 2 */
SL_WLAN_ANT_SELECTION_AUTO, /* Antenna selection - automatic antenna selection during connection. Applicable only for CC3x35\CC3x30 SL devices */
SL_WLAN_ANT_SELECTION_MANUAL /* Antenna selection - manual antenna selection while connected. Applicable only for CC3x20 SL devices */
}SlWlanAntSelectionMode_e;
typedef struct
{
_u8 Mode; /* antenna selection mode - [disable = 0 | ant1 = 1 | ant2 = 2 | auto = 3 | manual = 4] */
_u8 Ant1Pad;/* antenna1 selection pad (not pin!) */
_u8 Ant2Pad;/* antenna2 selection pad (not pin!) */
_u8 Reserved;
_u32 Options;
} SlWlanAntSelectionConfig_t;
_i16 Role;
_i16 Status;
SlWlanAntSelectionConfig_t AntSelConfig;
AntSelConfig. Mode = SL_WLAN_ANT_SELECTION_AUTO;
Status = sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_ANT_SELECTION_CONFIG,
sizeof(SlWlanAntSelectionConfig_t), (_u8 *)&AntSelConfig);
if( Status )
{
/* error */
}
/* restart the device */
Status = sl_Stop(0);
Role = sl_Start(NULL,NULL,NULL);
In manual mode case, there are two additional APIs for setting and getting the desired antenna.
typedef enum
{
SL_WLAN_ANT_IDX_1 = 1,/* Antenna index 1 */
SL_WLAN_ANT_IDX_2,/* Antenna index 2 */
SL_WLAN_ANT_TOGGLE,/* Antenna toggle */
SL_WLAN_ANT_NUM_OF_IDXS
}SlWlanAntIndex_e;
typedef struct SetAntennaCmd
{
SlWlanAntIndex_e AntIndex;/* antenna index - 1, 2 or toggle */
} SetAntennaIndex_t;
Example for antenna setting:
SetAntennaIndex_t param;
param.AntIndex = SL_WLAN_ANT_TOGGLE;
sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID,SL_WLAN_GENERAL_PARAM_ANT_SELECTION_SET,sizeof(SetAntennaIndex_t), (_u8* )¶m);
Example for antenna getting:
_i16 RetVal = 0;
_u16 config_opt = SL_WLAN_GENERAL_PARAM_ANT_SELECTION_GET;
_u16 len = sizeof(SetAntennaIndex_t);
SetAntennaIndex_t param;
param.AntIndex = SL_WLAN_ANT_TOGGLE;
RetVal = sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID, &config_opt, &len, (_u8* )¶m);