cc3200: Use the pull up/down resistors on the antenna selection pins.
This commit is contained in:
parent
f960d753e4
commit
330e21c986
@ -55,32 +55,24 @@ static antenna_type_t antenna_type_selected = ANTENNA_TYPE_INTERNAL;
|
|||||||
DEFINE PUBLIC FUNCTIONS
|
DEFINE PUBLIC FUNCTIONS
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
void antenna_init0(void) {
|
void antenna_init0(void) {
|
||||||
|
// enable the peripheral clock and set the gpio direction for
|
||||||
MAP_PRCMPeripheralClkEnable(PRCM_GPIOA3, PRCM_RUN_MODE_CLK);
|
// both antenna 1 and antenna 2 pins
|
||||||
|
MAP_PRCMPeripheralClkEnable(PRCM_GPIOA3, PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK);
|
||||||
MAP_GPIODirModeSet(GPIOA3_BASE, 0x0C, GPIO_DIR_MODE_OUT);
|
MAP_GPIODirModeSet(GPIOA3_BASE, 0x0C, GPIO_DIR_MODE_OUT);
|
||||||
|
|
||||||
// configure PIN_29 for GPIOOutput
|
// configure antenna 1 pin type and strength
|
||||||
HWREG(REG_PAD_CONFIG_26) = ((HWREG(REG_PAD_CONFIG_26) & ~(PAD_STRENGTH_MASK
|
HWREG(REG_PAD_CONFIG_26) = ((HWREG(REG_PAD_CONFIG_26) & ~(PAD_STRENGTH_MASK | PAD_TYPE_MASK)) | (0x00000020 | 0x00000000));
|
||||||
| PAD_TYPE_MASK)) | (0x00000020 | 0x00000000 ));
|
|
||||||
|
|
||||||
// set the mode
|
// set the mode
|
||||||
HWREG(REG_PAD_CONFIG_26) = (((HWREG(REG_PAD_CONFIG_26) & ~PAD_MODE_MASK) |
|
HWREG(REG_PAD_CONFIG_26) = ((HWREG(REG_PAD_CONFIG_26) & ~PAD_MODE_MASK) | 0x00000000) & ~(3 << 10);
|
||||||
0x00000000) & ~(3 << 10));
|
|
||||||
|
|
||||||
// set the direction
|
// set the direction
|
||||||
HWREG(REG_PAD_CONFIG_26) = ((HWREG(REG_PAD_CONFIG_26) & ~0xC00) | 0x00000800);
|
HWREG(REG_PAD_CONFIG_26) = ((HWREG(REG_PAD_CONFIG_26) & ~0xC00) | 0x00000800);
|
||||||
|
|
||||||
|
// configure antenna 2 pin type and strength
|
||||||
// configure PIN_30 for GPIOOutput
|
HWREG(REG_PAD_CONFIG_27) = ((HWREG(REG_PAD_CONFIG_27) & ~(PAD_STRENGTH_MASK | PAD_TYPE_MASK)) | (0x00000020 | 0x00000000));
|
||||||
HWREG(REG_PAD_CONFIG_27) = ((HWREG(REG_PAD_CONFIG_27) & ~(PAD_STRENGTH_MASK
|
|
||||||
| PAD_TYPE_MASK)) | (0x00000020 | 0x00000000 ));
|
|
||||||
|
|
||||||
// set the mode
|
// set the mode
|
||||||
HWREG(REG_PAD_CONFIG_27) = (((HWREG(REG_PAD_CONFIG_27) & ~PAD_MODE_MASK) |
|
HWREG(REG_PAD_CONFIG_27) = ((HWREG(REG_PAD_CONFIG_27) & ~PAD_MODE_MASK) | 0x00000000) & ~(3 << 10);
|
||||||
0x00000000) & ~(3 << 10));
|
|
||||||
|
|
||||||
// set the direction
|
// set the direction
|
||||||
HWREG(REG_PAD_CONFIG_26) = ((HWREG(REG_PAD_CONFIG_27) & ~0xC00) | 0x00000800);
|
HWREG(REG_PAD_CONFIG_27) = ((HWREG(REG_PAD_CONFIG_27) & ~0xC00) | 0x00000800);
|
||||||
|
|
||||||
// select the currently active antenna
|
// select the currently active antenna
|
||||||
antenna_select(antenna_type_selected);
|
antenna_select(antenna_type_selected);
|
||||||
@ -89,8 +81,14 @@ void antenna_init0(void) {
|
|||||||
void antenna_select (antenna_type_t _antenna) {
|
void antenna_select (antenna_type_t _antenna) {
|
||||||
if (_antenna == ANTENNA_TYPE_INTERNAL) {
|
if (_antenna == ANTENNA_TYPE_INTERNAL) {
|
||||||
MAP_GPIOPinWrite(GPIOA3_BASE, 0x0C, 0x04);
|
MAP_GPIOPinWrite(GPIOA3_BASE, 0x0C, 0x04);
|
||||||
|
// also configure the pull-up and pull-down accordingly
|
||||||
|
HWREG(REG_PAD_CONFIG_26) = ((HWREG(REG_PAD_CONFIG_26) & ~PAD_TYPE_MASK)) | PIN_TYPE_STD_PU;
|
||||||
|
HWREG(REG_PAD_CONFIG_27) = ((HWREG(REG_PAD_CONFIG_27) & ~PAD_TYPE_MASK)) | PIN_TYPE_STD_PD;
|
||||||
} else {
|
} else {
|
||||||
MAP_GPIOPinWrite(GPIOA3_BASE, 0x0C, 0x08);
|
MAP_GPIOPinWrite(GPIOA3_BASE, 0x0C, 0x08);
|
||||||
|
// also configure the pull-up and pull-down accordingly
|
||||||
|
HWREG(REG_PAD_CONFIG_26) = ((HWREG(REG_PAD_CONFIG_26) & ~PAD_TYPE_MASK)) | PIN_TYPE_STD_PD;
|
||||||
|
HWREG(REG_PAD_CONFIG_27) = ((HWREG(REG_PAD_CONFIG_27) & ~PAD_TYPE_MASK)) | PIN_TYPE_STD_PU;
|
||||||
}
|
}
|
||||||
antenna_type_selected = _antenna;
|
antenna_type_selected = _antenna;
|
||||||
}
|
}
|
||||||
|
@ -499,9 +499,17 @@ STATIC void pybsleep_iopark (bool hibernate) {
|
|||||||
if (hibernate) {
|
if (hibernate) {
|
||||||
#endif
|
#endif
|
||||||
// park the antenna selection pins
|
// park the antenna selection pins
|
||||||
|
// (tri-stated with pull down enabled)
|
||||||
HWREG(0x4402E108) = 0x00000E61;
|
HWREG(0x4402E108) = 0x00000E61;
|
||||||
HWREG(0x4402E10C) = 0x00000E61;
|
HWREG(0x4402E10C) = 0x00000E61;
|
||||||
#if MICROPY_HW_ANTENNA_DIVERSITY
|
#if MICROPY_HW_ANTENNA_DIVERSITY
|
||||||
|
} else {
|
||||||
|
// park the antenna selection pins
|
||||||
|
// (tri-stated without changing the pull up/down resistors)
|
||||||
|
HWREG(0x4402E108) &= ~0x000000FF;
|
||||||
|
HWREG(0x4402E108) |= 0x00000C61;
|
||||||
|
HWREG(0x4402E10C) &= ~0x000000FF;
|
||||||
|
HWREG(0x4402E10C) |= 0x00000C61;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user