From 43b9679bcc22f50f67ec086bebef4b4a925e3e28 Mon Sep 17 00:00:00 2001 From: Jonas Olsson Date: Thu, 1 Dec 2016 23:32:45 +0100 Subject: [PATCH] Move setting of RF mode to correct place, needs to be called on every boot. --- cpu/cc26xx-cc13xx/rf-core/prop-mode.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/cpu/cc26xx-cc13xx/rf-core/prop-mode.c b/cpu/cc26xx-cc13xx/rf-core/prop-mode.c index b75d534d1..b5d870a95 100644 --- a/cpu/cc26xx-cc13xx/rf-core/prop-mode.c +++ b/cpu/cc26xx-cc13xx/rf-core/prop-mode.c @@ -573,8 +573,6 @@ init(void) return RF_CORE_CMD_ERROR; } - rf_core_set_modesel(); - /* Initialise RX buffers */ memset(rx_buf_0, 0, RX_BUF_SIZE); memset(rx_buf_1, 0, RX_BUF_SIZE); @@ -600,9 +598,6 @@ init(void) /* Initialize current read pointer to first element (used in ISR) */ rx_read_entry = rx_buf_0; - /* Let CC13xxware automatically set a correct value for RTRIM for us */ - ti_lib_rfcrtrim((rfc_radioOp_t *)&smartrf_settings_cmd_prop_radio_div_setup); - smartrf_settings_cmd_prop_rx_adv.pQueue = &rx_data_queue; smartrf_settings_cmd_prop_rx_adv.pOutput = (uint8_t *)&rx_stats; @@ -895,9 +890,30 @@ on(void) return RF_CORE_CMD_ERROR; } + /* Keep track of RF Core mode */ + rf_core_set_modesel(); + + /* Apply patches to radio core */ rf_patch_cpe_genfsk(); + while(!HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFACKIFG)); + HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFACKIFG) = 0; rf_patch_rfe_genfsk(); + /* Initialize bus request */ + HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFACKIFG) = 0; + HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDR) = + CMDR_DIR_CMD_1BYTE(CMD_BUS_REQUEST, 1); + + /* set VCOLDO reference */ + ti_lib_rfc_adi3vco_ldo_voltage_mode(true); + + /* Let CC13xxware automatically set a correct value for RTRIM for us */ + ti_lib_rfc_rtrim((rfc_radioOp_t *)&smartrf_settings_cmd_prop_radio_div_setup); + + /* Make sure BUS_REQUEST is done */ + while(!HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFACKIFG)); + HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFACKIFG) = 0; + if(rf_core_start_rat() != RF_CORE_CMD_OK) { PRINTF("on: rf_core_start_rat() failed\n");