From ee501fb887f70c481726d6169d47a096448359e7 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 6 Nov 2016 17:07:17 +0000 Subject: [PATCH] Delegate RF Front End and Bias settings to board.h --- cpu/cc26xx-cc13xx/rf-core/ieee-mode.c | 2 + cpu/cc26xx-cc13xx/rf-core/prop-mode.c | 6 +++ cpu/cc26xx-cc13xx/rf-core/rf-ble.c | 2 + cpu/cc26xx-cc13xx/rf-core/rf-core.h | 39 ++++++++++++++++++++ cpu/cc26xx-cc13xx/rf-core/smartrf-settings.c | 4 +- 5 files changed, 51 insertions(+), 2 deletions(-) diff --git a/cpu/cc26xx-cc13xx/rf-core/ieee-mode.c b/cpu/cc26xx-cc13xx/rf-core/ieee-mode.c index 1bc7de0fd..5edc3fadb 100644 --- a/cpu/cc26xx-cc13xx/rf-core/ieee-mode.c +++ b/cpu/cc26xx-cc13xx/rf-core/ieee-mode.c @@ -489,6 +489,8 @@ rf_radio_setup() cmd.txPower = tx_power_current->tx_power; cmd.pRegOverride = ieee_overrides; + cmd.config.frontEndMode = RF_CORE_RADIO_SETUP_FRONT_END_MODE; + cmd.config.biasMode = RF_CORE_RADIO_SETUP_BIAS_MODE; cmd.mode = 1; /* Send Radio setup to RF Core */ diff --git a/cpu/cc26xx-cc13xx/rf-core/prop-mode.c b/cpu/cc26xx-cc13xx/rf-core/prop-mode.c index 0de61f36e..6e43c5e73 100644 --- a/cpu/cc26xx-cc13xx/rf-core/prop-mode.c +++ b/cpu/cc26xx-cc13xx/rf-core/prop-mode.c @@ -386,6 +386,12 @@ prop_div_radio_setup(void) /* Update to the correct TX power setting */ smartrf_settings_cmd_prop_radio_div_setup.txPower = tx_power_current->tx_power; + /* Adjust RF Front End and Bias based on the board */ + smartrf_settings_cmd_prop_radio_div_setup.config.frontEndMode = + RF_CORE_PROP_FRONT_END_MODE; + smartrf_settings_cmd_prop_radio_div_setup.config.biasMode = + RF_CORE_PROP_BIAS_MODE; + /* Send Radio setup to RF Core */ if(rf_core_send_cmd((uint32_t)cmd, &cmd_status) != RF_CORE_CMD_OK) { PRINTF("prop_div_radio_setup: DIV_SETUP, CMDSTA=0x%08lx, status=0x%04x\n", diff --git a/cpu/cc26xx-cc13xx/rf-core/rf-ble.c b/cpu/cc26xx-cc13xx/rf-core/rf-ble.c index 3cfea03bd..75a11213a 100644 --- a/cpu/cc26xx-cc13xx/rf-core/rf-ble.c +++ b/cpu/cc26xx-cc13xx/rf-core/rf-ble.c @@ -215,6 +215,8 @@ rf_radio_setup() cmd.txPower = tx_power; cmd.pRegOverride = ble_overrides; + cmd.config.frontEndMode = RF_CORE_RADIO_SETUP_FRONT_END_MODE; + cmd.config.biasMode = RF_CORE_RADIO_SETUP_BIAS_MODE; cmd.mode = 0; /* Send Radio setup to RF Core */ diff --git a/cpu/cc26xx-cc13xx/rf-core/rf-core.h b/cpu/cc26xx-cc13xx/rf-core/rf-core.h index 7a75bde50..762aa5650 100644 --- a/cpu/cc26xx-cc13xx/rf-core/rf-core.h +++ b/cpu/cc26xx-cc13xx/rf-core/rf-core.h @@ -64,6 +64,45 @@ #define RF_CORE_CHANNEL 25 #endif /* RF_CORE_CONF_IEEE_MODE_CHANNEL */ /*---------------------------------------------------------------------------*/ +#define RF_CORE_FRONT_END_MODE_DIFFERENTIAL 0 +#define RF_CORE_FRONT_END_MODE_SINGLE_RFP 1 +#define RF_CORE_FRONT_END_MODE_SINGLE_RFN 2 + +#define RF_CORE_BIAS_MODE_INTERNAL 0 +#define RF_CORE_BIAS_MODE_EXTERNAL 1 +/*---------------------------------------------------------------------------*/ +/* + * RF Front-End Mode and Bias for CMD_RADIO_SETUP (IEEE and BLE) + * Default: Differential mode, internal bias + */ +#ifdef RF_CORE_CONF_RADIO_SETUP_FRONT_END_MODE +#define RF_CORE_RADIO_SETUP_FRONT_END_MODE RF_CORE_CONF_RADIO_SETUP_FRONT_END_MODE +#else +#define RF_CORE_RADIO_SETUP_FRONT_END_MODE RF_CORE_FRONT_END_MODE_DIFFERENTIAL +#endif + +#ifdef RF_CORE_CONF_RADIO_SETUP_BIAS_MODE +#define RF_CORE_RADIO_SETUP_BIAS_MODE RF_CORE_CONF_RADIO_SETUP_BIAS_MODE +#else +#define RF_CORE_RADIO_SETUP_BIAS_MODE RF_CORE_BIAS_MODE_INTERNAL +#endif +/*---------------------------------------------------------------------------*/ +/* + * RF Front-End Mode and Bias for CMD_PROP_DIV_RADIO_SETUP (PROP mode) + * Default: Differential mode, external bias + */ +#ifdef RF_CORE_CONF_PROP_FRONT_END_MODE +#define RF_CORE_PROP_FRONT_END_MODE RF_CORE_CONF_PROP_FRONT_END_MODE +#else +#define RF_CORE_PROP_FRONT_END_MODE RF_CORE_FRONT_END_MODE_DIFFERENTIAL +#endif + +#ifdef RF_CORE_CONF_PROP_BIAS_MODE +#define RF_CORE_PROP_BIAS_MODE RF_CORE_CONF_PROP_BIAS_MODE +#else +#define RF_CORE_PROP_BIAS_MODE RF_CORE_BIAS_MODE_EXTERNAL +#endif +/*---------------------------------------------------------------------------*/ #define RF_CORE_CMD_ERROR 0 #define RF_CORE_CMD_OK 1 /*---------------------------------------------------------------------------*/ diff --git a/cpu/cc26xx-cc13xx/rf-core/smartrf-settings.c b/cpu/cc26xx-cc13xx/rf-core/smartrf-settings.c index 3d411463e..ea875f286 100644 --- a/cpu/cc26xx-cc13xx/rf-core/smartrf-settings.c +++ b/cpu/cc26xx-cc13xx/rf-core/smartrf-settings.c @@ -137,8 +137,8 @@ rfc_CMD_PROP_RADIO_DIV_SETUP_t smartrf_settings_cmd_prop_radio_div_setup = /* 7: .4g mode with dynamic whitening and CRC choice */ .formatConf.whitenMode = 0x7, - .config.frontEndMode = 0x0, /* Differential mode */ - .config.biasMode = 0x1, /* External bias*/ + .config.frontEndMode = 0x00, /* Set by the driver */ + .config.biasMode = 0x00, /* Set by the driver */ .config.analogCfgMode = 0x0, .config.bNoFsPowerUp = 0x0, .txPower = 0x00, /* Driver sets correct value */