You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2023/09/11 13:39:04 UTC
[mynewt-nimble] branch master updated (3a161c8e -> 492629e9)
This is an automated email from the ASF dual-hosted git repository.
janc pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
from 3a161c8e Apache NimBLE 1.6.0 release
new b2b28243 nimble/ll: Add DTM extension for unmodulated carrier
new 492629e9 apps/dtm: Fix handling of unmodulated carrier
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
apps/dtm/src/main.c | 102 +------------------------
nimble/controller/include/controller/ble_phy.h | 3 +
nimble/controller/src/ble_ll_dtm.c | 24 +++++-
nimble/drivers/dialog_cmac/src/ble_phy.c | 8 ++
nimble/drivers/nrf5x/src/ble_phy.c | 16 ++++
5 files changed, 53 insertions(+), 100 deletions(-)
[mynewt-nimble] 02/02: apps/dtm: Fix handling of unmodulated carrier
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit 492629e9772c4c8172a17d4ce2519bea18c0b437
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Wed Aug 9 11:59:01 2023 +0200
apps/dtm: Fix handling of unmodulated carrier
We now provide unmodulated carrier via DTM extension (payload=255).
Previously implemented command was never upstream and thus was not
working.
---
apps/dtm/src/main.c | 102 ++--------------------------------------------------
1 file changed, 3 insertions(+), 99 deletions(-)
diff --git a/apps/dtm/src/main.c b/apps/dtm/src/main.c
index e5e0689c..11f41160 100644
--- a/apps/dtm/src/main.c
+++ b/apps/dtm/src/main.c
@@ -105,7 +105,7 @@ cmd_tx_test(int argc, char **argv)
}
params.payload = parse_arg_uint8("payload", &rc);
- if ((rc != 0) || ((params.payload > 7))) {
+ if ((rc != 0) || ((params.payload > 7 && params.payload != 255))) {
console_printf("invalid 'payload' parameter\n");
return rc;
}
@@ -205,75 +205,6 @@ cmd_set_antenna(int argc, char **argv)
return 0;
}
-#define BLE_HCI_OCF_VS_TEST_CARRIER (0x0020)
-
-static bool tx_carrier_running = false;
-
-static int
-cmd_tx_carrier(int argc, char **argv)
-{
- uint8_t cmd[2];
- int rc;
-
- rc = parse_arg_all(argc - 1, argv + 1);
- if (rc != 0) {
- return rc;
- }
-
- if (tx_carrier_running) {
- console_printf("TX carrier already started\n");
- return 0;
- }
-
- cmd[0] = 1;
- cmd[1] = parse_arg_uint8("channel", &rc);
- if ((rc != 0) || (cmd[1] > 39)) {
- console_printf("invalid channel\n");
- return rc;
- }
-
- rc = ble_hs_hci_send_vs_cmd(BLE_HCI_OCF_VS_TEST_CARRIER, &cmd, sizeof(cmd),
- NULL, 0);
- if (rc) {
- console_printf("failed to start TX carrier\n");
- return rc;
- }
-
- console_printf("TX carrier started\n");
- tx_carrier_running = true;
- return 0;
-}
-
-static int
-cmd_stop_carrier(int argc, char **argv)
-{
- uint8_t cmd[2];
- int rc;
-
- rc = parse_arg_all(argc - 1, argv + 1);
- if (rc != 0) {
- return rc;
- }
-
- if (!tx_carrier_running) {
- console_printf("TX carrier not started\n");
- return 0;
- }
- cmd[0] = 0;
- cmd[1] = 0;
-
- rc = ble_hs_hci_send_vs_cmd(BLE_HCI_OCF_VS_TEST_CARRIER, &cmd, sizeof(cmd),
- NULL, 0);
- if (rc) {
- console_printf("failed to stop TX carrier\n");
- return rc;
- }
-
- console_printf("TX carrier stopped\n");
- tx_carrier_running = false;
- return 0;
-}
-
static const struct shell_param cmd_rx_test_params[] = {
{"channel", "RX channel, usage: =[0-39]"},
{"phy", "usage: =[1M|2M], default: 1M"},
@@ -288,10 +219,10 @@ static const struct shell_cmd_help cmd_rx_test_help = {
};
static const struct shell_param cmd_tx_test_params[] = {
- {"channel", "RX channel, usage: =[0-39]"},
+ {"channel", "TX channel, usage: =[0-39]"},
{"phy", "usage: =[1M|2M], default: 1M"},
{"data_length", "usage: =[0-255], default: 0"},
- {"payload", "usage: =[0-7]"},
+ {"payload", "usage: =[0-7, 255]"},
{NULL}
};
@@ -329,23 +260,6 @@ static const struct shell_cmd_help cmd_set_antenna_help = {
.params = cmd_set_antenna_params,
};
-static const struct shell_param cmd_tx_carrier_params[] = {
- {"channel", "TX channel, usage: =[0-39]"},
- {NULL}
-};
-
-static const struct shell_cmd_help cmd_tx_carrier_help = {
- .summary = "TX unmodulated carrier",
- .usage = NULL,
- .params = cmd_tx_carrier_params,
-};
-
-static const struct shell_cmd_help cmd_stop_carrier_help = {
- .summary = "stop TX unmodulated carrier",
- .usage = NULL,
- .params = NULL,
-};
-
static const struct shell_cmd dtm_commands[] = {
{
.sc_cmd = "rx-test",
@@ -372,16 +286,6 @@ static const struct shell_cmd dtm_commands[] = {
.sc_cmd_func = cmd_set_antenna,
.help = &cmd_set_antenna_help,
},
- {
- .sc_cmd = "tx-carrier",
- .sc_cmd_func = cmd_tx_carrier,
- .help = &cmd_tx_carrier_help,
- },
- {
- .sc_cmd = "stop-carrier",
- .sc_cmd_func = cmd_stop_carrier,
- .help = &cmd_stop_carrier_help,
- },
{ }
};
[mynewt-nimble] 01/02: nimble/ll: Add DTM extension for unmodulated carrier
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit b2b28243f95731b867bdcf4b37b4e665fb29f898
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Wed Aug 9 11:58:42 2023 +0200
nimble/ll: Add DTM extension for unmodulated carrier
This may be useful for HW validation. Implemented for nRF5x driver
based on Nordic DTM sample.
---
nimble/controller/include/controller/ble_phy.h | 3 +++
nimble/controller/src/ble_ll_dtm.c | 24 +++++++++++++++++++++++-
nimble/drivers/dialog_cmac/src/ble_phy.c | 8 ++++++++
nimble/drivers/nrf5x/src/ble_phy.c | 16 ++++++++++++++++
4 files changed, 50 insertions(+), 1 deletion(-)
diff --git a/nimble/controller/include/controller/ble_phy.h b/nimble/controller/include/controller/ble_phy.h
index ab96cb9c..fe700442 100644
--- a/nimble/controller/include/controller/ble_phy.h
+++ b/nimble/controller/include/controller/ble_phy.h
@@ -238,6 +238,9 @@ static inline int ble_ll_phy_to_phy_mode(int phy, int phy_options)
#if MYNEWT_VAL(BLE_LL_DTM)
void ble_phy_enable_dtm(void);
void ble_phy_disable_dtm(void);
+#if MYNEWT_VAL(BLE_LL_DTM_EXTENSIONS)
+int ble_phy_dtm_carrier(uint8_t rf_channel);
+#endif
#endif
#ifdef __cplusplus
diff --git a/nimble/controller/src/ble_ll_dtm.c b/nimble/controller/src/ble_ll_dtm.c
index 07e25fe2..c57a1357 100644
--- a/nimble/controller/src/ble_ll_dtm.c
+++ b/nimble/controller/src/ble_ll_dtm.c
@@ -342,6 +342,18 @@ ble_ll_dtm_tx_create_ctx(uint8_t packet_payload, uint8_t len,
case 0x07:
byte_pattern = 0xAA;
break;
+#if MYNEWT_VAL(BLE_LL_DTM_EXTENSIONS)
+ case 0xff:
+ ble_ll_tx_power_set(g_ble_ll_tx_power);
+ rc = ble_phy_dtm_carrier(channel_rf_to_index[rf_channel]);
+ if (rc) {
+ return 1;
+ }
+
+ /* this is special as it doesn't involve scheduling */
+ g_ble_ll_dtm_ctx.active = 1;
+ return 0;
+#endif
default:
return 1;
}
@@ -478,10 +490,20 @@ ble_ll_dtm_tx_test(uint8_t tx_chan, uint8_t len, uint8_t packet_payload,
return BLE_ERR_INV_HCI_CMD_PARMS;
}
- if (tx_chan > 0x27 || packet_payload > 0x07) {
+ if (tx_chan > 0x27) {
return BLE_ERR_INV_HCI_CMD_PARMS;
}
+ if (packet_payload > 0x07) {
+#if MYNEWT_VAL(BLE_LL_DTM_EXTENSIONS)
+ if (packet_payload != 255) {
+ return BLE_ERR_INV_HCI_CMD_PARMS;
+ }
+#else
+ return BLE_ERR_INV_HCI_CMD_PARMS;
+#endif
+ }
+
if (ble_ll_dtm_tx_create_ctx(packet_payload, len, tx_chan, phy_mode,
interval, pkt_count)) {
return BLE_ERR_UNSPECIFIED;
diff --git a/nimble/drivers/dialog_cmac/src/ble_phy.c b/nimble/drivers/dialog_cmac/src/ble_phy.c
index 938455bb..d146e07e 100644
--- a/nimble/drivers/dialog_cmac/src/ble_phy.c
+++ b/nimble/drivers/dialog_cmac/src/ble_phy.c
@@ -1796,4 +1796,12 @@ ble_phy_disable_dtm(void)
{
g_ble_phy_data.phy_whitening = 1;
}
+
+#if MYNEWT_VAL(BLE_LL_DTM_EXTENSIONS)
+int
+ble_phy_dtm_carrier(uint8_t rf_channel)
+{
+ return 1;
+}
+#endif
#endif
diff --git a/nimble/drivers/nrf5x/src/ble_phy.c b/nimble/drivers/nrf5x/src/ble_phy.c
index 481ed619..cea18144 100644
--- a/nimble/drivers/nrf5x/src/ble_phy.c
+++ b/nimble/drivers/nrf5x/src/ble_phy.c
@@ -2286,6 +2286,22 @@ void ble_phy_disable_dtm(void)
/* Enable whitening */
NRF_RADIO->PCNF1 |= RADIO_PCNF1_WHITEEN_Msk;
}
+
+#if MYNEWT_VAL(BLE_LL_DTM_EXTENSIONS)
+int
+ble_phy_dtm_carrier(uint8_t rf_channel)
+{
+ /* based on Nordic DTM sample */
+ ble_phy_disable();
+ ble_phy_enable_dtm();
+ ble_phy_mode_apply(BLE_PHY_MODE_1M);
+ nrf_radio_shorts_enable(NRF_RADIO, NRF_RADIO_SHORT_READY_START_MASK);
+ NRF_RADIO->FREQUENCY = g_ble_phy_chan_freq[rf_channel];
+ nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_TXEN);
+
+ return 0;
+}
+#endif
#endif
void