Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Donald Chen
pc-ble-driver-connectivity-fw
Commits
ae754489
Commit
ae754489
authored
Feb 11, 2019
by
Donald Chen
Browse files
pa/lna active
parent
92f843de
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
ae754489
**/_build
**/ses/Output
components/softdevice/common/nrf_sdh_ble.c
View file @
ae754489
This diff is collapsed.
Click to expand it.
examples/connectivity/ble_connectivity/main.c
View file @
ae754489
...
...
@@ -230,27 +230,6 @@ void pin_to_default(uint8_t pin)
}
#endif
#if defined(BOARD_PCA10056)
static
void
pa_lna_passthrough
(
void
)
{
#define PA_RX_EN_PIN 38 //p1.06
#define PA_TX_EN_PIN 37 //p1.05
#define PA_MODE_PIN 36 //p1.04
#define ANT_SEL_PIN 34 //p1.02
//configure PA-LNA pins as outputs
nrf_gpio_cfg_output
(
PA_RX_EN_PIN
);
nrf_gpio_cfg_output
(
PA_TX_EN_PIN
);
nrf_gpio_cfg_output
(
PA_MODE_PIN
);
nrf_gpio_cfg_output
(
ANT_SEL_PIN
);
//set PA-LNA pins for bypass mode, using the internal antenna
nrf_gpio_pin_clear
(
PA_RX_EN_PIN
);
nrf_gpio_pin_clear
(
PA_TX_EN_PIN
);
nrf_gpio_pin_set
(
PA_MODE_PIN
);
nrf_gpio_pin_set
(
ANT_SEL_PIN
);
}
#endif
/**@brief Main function of the connectivity application. */
int
main
(
void
)
...
...
@@ -258,10 +237,6 @@ int main(void)
CoreDebug
->
DEMCR
|=
CoreDebug_DEMCR_TRCENA_Msk
;
DWT
->
CTRL
|=
DWT_CTRL_CYCCNTENA_Msk
;
#if defined(BOARD_PCA10056)
pa_lna_passthrough
();
#endif
uint32_t
err_code
=
NRF_SUCCESS
;
APP_ERROR_CHECK
(
NRF_LOG_INIT
(
timestamp
,
64000000
));
...
...
examples/connectivity/ble_connectivity/pa_lna.c
0 → 100644
View file @
ae754489
#include <stdint.h>
#include <string.h>
#include "pa_lna.h"
#include "ble.h"
#include "ble_gap.h"
#include "nrf_gpio.h"
#if defined(PA_LNA_ACTIVE)
#pragma message("pa/lna: active")
static
void
pa_lna_assist
(
uint32_t
gpio_pa_pin
,
uint32_t
gpio_lna_pin
)
{
static
const
uint32_t
gpio_toggle_ch
=
0
;
static
const
uint32_t
ppi_set_ch
=
0
;
static
const
uint32_t
ppi_clr_ch
=
1
;
// Configure SoftDevice PA/LNA assist
ble_opt_t
opt
;
ret_code_t
err_code
;
memset
(
&
opt
,
0
,
sizeof
(
ble_opt_t
));
// Common PA/LNA config
opt
.
common_opt
.
pa_lna
.
gpiote_ch_id
=
gpio_toggle_ch
;
// GPIOTE channel
opt
.
common_opt
.
pa_lna
.
ppi_ch_id_clr
=
ppi_clr_ch
;
// PPI channel for pin clearing
opt
.
common_opt
.
pa_lna
.
ppi_ch_id_set
=
ppi_set_ch
;
// PPI channel for pin setting
// PA config
opt
.
common_opt
.
pa_lna
.
pa_cfg
.
active_high
=
1
;
// Set the pin to be active high
opt
.
common_opt
.
pa_lna
.
pa_cfg
.
enable
=
1
;
// Enable toggling
opt
.
common_opt
.
pa_lna
.
pa_cfg
.
gpio_pin
=
gpio_pa_pin
;
// The GPIO pin to toggle
// LNA config
opt
.
common_opt
.
pa_lna
.
lna_cfg
.
active_high
=
1
;
// Set the pin to be active high
opt
.
common_opt
.
pa_lna
.
lna_cfg
.
enable
=
1
;
// Enable toggling
opt
.
common_opt
.
pa_lna
.
lna_cfg
.
gpio_pin
=
gpio_lna_pin
;
// The GPIO pin to toggle
err_code
=
sd_ble_opt_set
(
BLE_COMMON_OPT_PA_LNA
,
&
opt
);
APP_ERROR_CHECK
(
err_code
);
}
void
pa_lna_init
(
void
)
{
//must run after softdevice is initialized
//Set PA-LNA Mode Pin: Low for Normal operation
nrf_gpio_cfg_output
(
PA_MODE_PIN
);
nrf_gpio_pin_clear
(
PA_MODE_PIN
);
//Set PA-lNA Antenna Select Pin: high for internal antenna
nrf_gpio_cfg_output
(
ANT_SEL_PIN
);
nrf_gpio_pin_set
(
ANT_SEL_PIN
);
//Setup PA-LNA TX and RX control pins with the SoftDevice
pa_lna_assist
(
PA_TX_EN_PIN
,
PA_RX_EN_PIN
);
//Set TX powerfor scan responses
sd_ble_gap_tx_power_set
(
BLE_GAP_TX_POWER_ROLE_SCAN_INIT
,
0
,
RADIO_TXPOWER_TXPOWER_Neg12dBm
);
//Set TX power for advertisements
sd_ble_gap_tx_power_set
(
BLE_GAP_TX_POWER_ROLE_ADV
,
0
,
RADIO_TXPOWER_TXPOWER_Neg12dBm
);
//Tx power for connections inherit the scan or advertising powers
}
#elif defined(PA_LNA_PASSTHROUGH)
#pragma message("pa/lna: passthrough")
void
pa_lna_init
(
void
)
{
//configure PA-LNA pins as outputs
nrf_gpio_cfg_output
(
PA_RX_EN_PIN
);
nrf_gpio_cfg_output
(
PA_TX_EN_PIN
);
nrf_gpio_cfg_output
(
PA_MODE_PIN
);
nrf_gpio_cfg_output
(
ANT_SEL_PIN
);
//set PA-LNA pins for bypass mode, using the internal antenna
nrf_gpio_pin_clear
(
PA_RX_EN_PIN
);
nrf_gpio_pin_clear
(
PA_TX_EN_PIN
);
nrf_gpio_pin_set
(
PA_MODE_PIN
);
nrf_gpio_pin_set
(
ANT_SEL_PIN
);
}
#else
#pragma message("pa/lna: n/a")
void
pa_lna_init
(
void
)
{
//nothing to do
}
#endif
\ No newline at end of file
examples/connectivity/ble_connectivity/pa_lna.h
0 → 100644
View file @
ae754489
#ifndef PA_LNA_H__
#define PA_LNA_H__
#define PA_RX_EN_PIN 38 //p1.06
#define PA_TX_EN_PIN 37 //p1.05
#define PA_MODE_PIN 36 //p1.04
#define ANT_SEL_PIN 34 //p1.02
//define PA_LNA_ACTIVE or PA_LNA_PASSTHROUGH
#define PA_LNA_ACTIVE
void
pa_lna_init
(
void
);
#endif
\ No newline at end of file
examples/connectivity/ble_connectivity/pca10056/ser_s140_hci/armgcc/Makefile
View file @
ae754489
...
...
@@ -85,10 +85,11 @@ SRC_FILES += \
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_clock.c
\
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_power_clock.c
\
$(SDK_ROOT)/modules/nrfx/drivers/src/prs/nrfx_prs.c
\
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_qspi.c
\
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_qspi.c
\
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_uart.c
\
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_uarte.c
\
$(PROJ_DIR)/main.c
\
$(PROJ_DIR)/pa_lna.c
\
$(SDK_ROOT)/external/segger_rtt/SEGGER_RTT.c
\
$(SDK_ROOT)/external/segger_rtt/SEGGER_RTT_Syscalls_GCC.c
\
$(SDK_ROOT)/external/segger_rtt/SEGGER_RTT_printf.c
\
...
...
@@ -141,6 +142,7 @@ INC_FOLDERS += \
$(SDK_ROOT)/modules/nrfx/drivers/
include
\
$(SDK_ROOT)/external/fprintf
\
$(SDK_ROOT)/components/libraries/log/src
\
$(PROJ_DIR)
\
# Libraries common to all targets
LIB_FILES
+=
\
...
...
examples/connectivity/ble_connectivity/pca10056/ser_s140_hci/ses/ble_connectivity_s140_hci_pca10056.emProject
View file @
ae754489
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment