Skip to content

Commit

Permalink
cc3200: Re-config antenna selection when waking from suspended mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Campora committed Jun 7, 2015
1 parent b4a41a8 commit 491c321
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 0 additions & 2 deletions cc3200/bootmgr/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@ static void bootmgr_board_init(void) {
#if MICROPY_HW_ANTENNA_DIVERSITY
// configure the antenna selection pins
antenna_init0();
// select the internal antenna
antenna_select(ANTENNA_TYPE_INTERNAL);
#endif

// Enable the Data Hashing Engine
Expand Down
2 changes: 0 additions & 2 deletions cc3200/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ int main (void) {
#if MICROPY_HW_ANTENNA_DIVERSITY
// configure the antenna selection pins
antenna_init0();
// select the internal antenna
antenna_select(ANTENNA_TYPE_INTERNAL);
#endif

// Init the watchdog
Expand Down
13 changes: 11 additions & 2 deletions cc3200/misc/antenna.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ DEFINE CONSTANTS
#define REG_PAD_CONFIG_26 (0x4402E108)
#define REG_PAD_CONFIG_27 (0x4402E10C)

/******************************************************************************
DEFINE PRIVATE DATA
******************************************************************************/
static antenna_type_t antenna_type_selected = ANTENNA_TYPE_INTERNAL;

/******************************************************************************
DEFINE PUBLIC FUNCTIONS
******************************************************************************/
Expand Down Expand Up @@ -76,14 +81,18 @@ void antenna_init0(void) {

// set the direction
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) {
if (antenna_type == ANTENNA_TYPE_INTERNAL) {
void antenna_select (antenna_type_t _antenna) {
if (_antenna == ANTENNA_TYPE_INTERNAL) {
MAP_GPIOPinWrite(GPIOA3_BASE, 0x0C, 0x04);
} else {
MAP_GPIOPinWrite(GPIOA3_BASE, 0x0C, 0x08);
}
antenna_type_selected = _antenna;
}

#endif
Expand Down
4 changes: 4 additions & 0 deletions cc3200/mods/pybsleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#include "mperror.h"
#include "sleeprestore.h"
#include "serverstask.h"
#include "antenna.h"

/******************************************************************************
DECLARE PRIVATE CONSTANTS
Expand Down Expand Up @@ -397,6 +398,9 @@ void pybsleep_suspend_exit (void) {
// ungate the clock to the shared spi bus
MAP_PRCMPeripheralClkEnable(PRCM_SSPI, PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK);

// re-configure the antenna selection pins
antenna_init0();

// reinitialize simplelink's interface
sl_IfOpen (NULL, 0);

Expand Down

0 comments on commit 491c321

Please sign in to comment.