cc3200: Re-config antenna selection when waking from suspended mode.

This commit is contained in:
Daniel Campora 2015-06-07 13:28:47 +02:00
parent b4a41a8f70
commit 491c321720
4 changed files with 15 additions and 6 deletions

View File

@ -155,8 +155,6 @@ static void bootmgr_board_init(void) {
#if MICROPY_HW_ANTENNA_DIVERSITY #if MICROPY_HW_ANTENNA_DIVERSITY
// configure the antenna selection pins // configure the antenna selection pins
antenna_init0(); antenna_init0();
// select the internal antenna
antenna_select(ANTENNA_TYPE_INTERNAL);
#endif #endif
// Enable the Data Hashing Engine // Enable the Data Hashing Engine

View File

@ -69,8 +69,6 @@ int main (void) {
#if MICROPY_HW_ANTENNA_DIVERSITY #if MICROPY_HW_ANTENNA_DIVERSITY
// configure the antenna selection pins // configure the antenna selection pins
antenna_init0(); antenna_init0();
// select the internal antenna
antenna_select(ANTENNA_TYPE_INTERNAL);
#endif #endif
// Init the watchdog // Init the watchdog

View File

@ -46,6 +46,11 @@ DEFINE CONSTANTS
#define REG_PAD_CONFIG_26 (0x4402E108) #define REG_PAD_CONFIG_26 (0x4402E108)
#define REG_PAD_CONFIG_27 (0x4402E10C) #define REG_PAD_CONFIG_27 (0x4402E10C)
/******************************************************************************
DEFINE PRIVATE DATA
******************************************************************************/
static antenna_type_t antenna_type_selected = ANTENNA_TYPE_INTERNAL;
/****************************************************************************** /******************************************************************************
DEFINE PUBLIC FUNCTIONS DEFINE PUBLIC FUNCTIONS
******************************************************************************/ ******************************************************************************/
@ -76,14 +81,18 @@ void antenna_init0(void) {
// set the direction // set the direction
HWREG(REG_PAD_CONFIG_26) = ((HWREG(REG_PAD_CONFIG_27) & ~0xC00) | 0x00000800); HWREG(REG_PAD_CONFIG_26) = ((HWREG(REG_PAD_CONFIG_27) & ~0xC00) | 0x00000800);
// select the currently active antenna
antenna_select(antenna_type_selected);
} }
void antenna_select (antenna_type_t antenna_type) { void antenna_select (antenna_type_t _antenna) {
if (antenna_type == ANTENNA_TYPE_INTERNAL) { if (_antenna == ANTENNA_TYPE_INTERNAL) {
MAP_GPIOPinWrite(GPIOA3_BASE, 0x0C, 0x04); MAP_GPIOPinWrite(GPIOA3_BASE, 0x0C, 0x04);
} else { } else {
MAP_GPIOPinWrite(GPIOA3_BASE, 0x0C, 0x08); MAP_GPIOPinWrite(GPIOA3_BASE, 0x0C, 0x08);
} }
antenna_type_selected = _antenna;
} }
#endif #endif

View File

@ -54,6 +54,7 @@
#include "mperror.h" #include "mperror.h"
#include "sleeprestore.h" #include "sleeprestore.h"
#include "serverstask.h" #include "serverstask.h"
#include "antenna.h"
/****************************************************************************** /******************************************************************************
DECLARE PRIVATE CONSTANTS DECLARE PRIVATE CONSTANTS
@ -397,6 +398,9 @@ void pybsleep_suspend_exit (void) {
// ungate the clock to the shared spi bus // ungate the clock to the shared spi bus
MAP_PRCMPeripheralClkEnable(PRCM_SSPI, PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK); MAP_PRCMPeripheralClkEnable(PRCM_SSPI, PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK);
// re-configure the antenna selection pins
antenna_init0();
// reinitialize simplelink's interface // reinitialize simplelink's interface
sl_IfOpen (NULL, 0); sl_IfOpen (NULL, 0);