Skip to content

Commit 491c321

Browse files
author
Daniel Campora
committed
cc3200: Re-config antenna selection when waking from suspended mode.
1 parent b4a41a8 commit 491c321

4 files changed

Lines changed: 15 additions & 6 deletions

File tree

cc3200/bootmgr/main.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,6 @@ static void bootmgr_board_init(void) {
155155
#if MICROPY_HW_ANTENNA_DIVERSITY
156156
// configure the antenna selection pins
157157
antenna_init0();
158-
// select the internal antenna
159-
antenna_select(ANTENNA_TYPE_INTERNAL);
160158
#endif
161159

162160
// Enable the Data Hashing Engine

cc3200/main.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ int main (void) {
6969
#if MICROPY_HW_ANTENNA_DIVERSITY
7070
// configure the antenna selection pins
7171
antenna_init0();
72-
// select the internal antenna
73-
antenna_select(ANTENNA_TYPE_INTERNAL);
7472
#endif
7573

7674
// Init the watchdog

cc3200/misc/antenna.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ DEFINE CONSTANTS
4646
#define REG_PAD_CONFIG_26 (0x4402E108)
4747
#define REG_PAD_CONFIG_27 (0x4402E10C)
4848

49+
/******************************************************************************
50+
DEFINE PRIVATE DATA
51+
******************************************************************************/
52+
static antenna_type_t antenna_type_selected = ANTENNA_TYPE_INTERNAL;
53+
4954
/******************************************************************************
5055
DEFINE PUBLIC FUNCTIONS
5156
******************************************************************************/
@@ -76,14 +81,18 @@ void antenna_init0(void) {
7681

7782
// set the direction
7883
HWREG(REG_PAD_CONFIG_26) = ((HWREG(REG_PAD_CONFIG_27) & ~0xC00) | 0x00000800);
84+
85+
// select the currently active antenna
86+
antenna_select(antenna_type_selected);
7987
}
8088

81-
void antenna_select (antenna_type_t antenna_type) {
82-
if (antenna_type == ANTENNA_TYPE_INTERNAL) {
89+
void antenna_select (antenna_type_t _antenna) {
90+
if (_antenna == ANTENNA_TYPE_INTERNAL) {
8391
MAP_GPIOPinWrite(GPIOA3_BASE, 0x0C, 0x04);
8492
} else {
8593
MAP_GPIOPinWrite(GPIOA3_BASE, 0x0C, 0x08);
8694
}
95+
antenna_type_selected = _antenna;
8796
}
8897

8998
#endif

cc3200/mods/pybsleep.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#include "mperror.h"
5555
#include "sleeprestore.h"
5656
#include "serverstask.h"
57+
#include "antenna.h"
5758

5859
/******************************************************************************
5960
DECLARE PRIVATE CONSTANTS
@@ -397,6 +398,9 @@ void pybsleep_suspend_exit (void) {
397398
// ungate the clock to the shared spi bus
398399
MAP_PRCMPeripheralClkEnable(PRCM_SSPI, PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK);
399400

401+
// re-configure the antenna selection pins
402+
antenna_init0();
403+
400404
// reinitialize simplelink's interface
401405
sl_IfOpen (NULL, 0);
402406

0 commit comments

Comments
 (0)