Skip to content

Commit 1e2ddc4

Browse files
jhirsirlubos
authored andcommitted
samples: dect_phy: dect_shell: sett: band 4 support
Doing PHY API initialization when changing from/to band 4. Additionally, removing free-ISM support. Note: band #4 support only with nRF9151 and modem mfw 1.0.2. Jira: MOSH-622 Signed-off-by: Jani Hirsimäki <[email protected]>
1 parent d1c785a commit 1e2ddc4

File tree

7 files changed

+49
-31
lines changed

7 files changed

+49
-31
lines changed

doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ DECT NR+ samples
309309
This is not a full MAC implementation and not fully compliant with DECT NR+ MAC specification (`ETSI TS 103 636-4`_).
310310
* The ``startup_cmd`` command.
311311
This command is used to store shell commands to be run sequentially after bootup.
312+
* Band 4 support for nRF9151 with modem firmware v1.0.2.
312313

313314
* Updated:
314315

samples/dect/dect_phy/dect_shell/README.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,17 @@ Examples
8484
8585
dect sett --tx_pwr -16
8686
87-
* Change the default band to ``2`` (has impact when automatic channel selection is used, in other words, the set channel is zero in ``dect rssi_scan`` or in ``dect mac beacon_start`` command):
87+
* Change the default band to ``2`` (has impact when automatic channel selection is used, in other words, when the set channel is zero in ``dect rssi_scan`` or in ``dect mac beacon_start`` command):
8888

8989
.. code-block:: console
9090
9191
dect sett -b 2
9292
93+
.. caution::
94+
There might be region-specific limitations for radio channel usage.
95+
See Regulations and Channel frequency sections of the :ref:`nrfxlib:nrf_modem_dect_phy` page for using different DECT NR+ radio bands and channels in different regions.
96+
Make sure to always measure the channel with the ``dect rssi_scan`` command before accessing the band.
97+
9398
RSSI measurement
9499
================
95100

samples/dect/dect_phy/dect_shell/src/dect/common/dect_common.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,6 @@ typedef struct {
196196

197197
/************************************************************************************************/
198198

199-
/* Not in dect specs. This sub GHz band only with custom modem */
200-
#define DECT_PHY_SUPPORTED_CHANNEL_BAND_868_FREE_ISM_MIN 479
201-
#define DECT_PHY_SUPPORTED_CHANNEL_BAND_868_FREE_ISM_MAX 485
202-
203199
/* Supported DECT bands. See ETSI TS 103 636-2 v1.3.1 Table 5.4.2-1. (3rd column) */
204200

205201
#define DECT_PHY_SUPPORTED_CHANNEL_BAND1_MIN 1657
@@ -208,7 +204,6 @@ typedef struct {
208204
#define DECT_PHY_SUPPORTED_CHANNEL_BAND2_MIN 1680
209205
#define DECT_PHY_SUPPORTED_CHANNEL_BAND2_MAX 1700
210206

211-
/* This sub GHz band only with custom modem */
212207
#define DECT_PHY_SUPPORTED_CHANNEL_BAND4_MIN 524
213208
#define DECT_PHY_SUPPORTED_CHANNEL_BAND4_MAX 552
214209

@@ -218,8 +213,6 @@ typedef struct {
218213
#define DECT_PHY_SUPPORTED_CHANNEL_BAND22_MIN 1691
219214
#define DECT_PHY_SUPPORTED_CHANNEL_BAND22_MAX 1711
220215

221-
#define DECT_PHY_BAND_IS_CUSTOM_LOW(x) (x == 4 || x == 868)
222-
223216
/************************************************************************************************/
224217

225218
#define US_TO_MODEM_TICKS(x) ((uint64_t)(((x) * NRF_MODEM_DECT_MODEM_TIME_TICK_RATE_KHZ) / 1000))

samples/dect/dect_phy/dect_shell/src/dect/common/dect_common_utils.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,6 @@ bool dect_common_utils_channel_is_supported(uint16_t band_nbr, uint16_t channel,
355355
} else if (band_nbr == 22) {
356356
return (channel >= DECT_PHY_SUPPORTED_CHANNEL_BAND22_MIN &&
357357
channel <= DECT_PHY_SUPPORTED_CHANNEL_BAND22_MAX);
358-
} else if (band_nbr == 868) {
359-
return (channel >= DECT_PHY_SUPPORTED_CHANNEL_BAND_868_FREE_ISM_MIN &&
360-
channel <= DECT_PHY_SUPPORTED_CHANNEL_BAND_868_FREE_ISM_MAX);
361358
} else {
362359
return false;
363360
}
@@ -375,8 +372,6 @@ uint16_t dect_common_utils_channel_max_on_band(uint16_t band_nbr)
375372
return DECT_PHY_SUPPORTED_CHANNEL_BAND9_MAX;
376373
} else if (band_nbr == 22) {
377374
return DECT_PHY_SUPPORTED_CHANNEL_BAND22_MAX;
378-
} else if (band_nbr == 868) {
379-
return DECT_PHY_SUPPORTED_CHANNEL_BAND_868_FREE_ISM_MAX;
380375
} else {
381376
return 0;
382377
}
@@ -394,8 +389,6 @@ uint16_t dect_common_utils_channel_min_on_band(uint16_t band_nbr)
394389
return DECT_PHY_SUPPORTED_CHANNEL_BAND9_MIN;
395390
} else if (band_nbr == 22) {
396391
return DECT_PHY_SUPPORTED_CHANNEL_BAND22_MIN;
397-
} else if (band_nbr == 868) {
398-
return DECT_PHY_SUPPORTED_CHANNEL_BAND_868_FREE_ISM_MIN;
399392
} else {
400393
return 0;
401394
}

samples/dect/dect_phy/dect_shell/src/dect/dect_phy_ctrl.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ static void dect_phy_ctrl_msgq_thread_handler(void)
185185
break;
186186
}
187187
case DECT_PHY_CTRL_OP_SETTINGS_UPDATED: {
188+
bool phy_api_reinit_needed = *((bool *)event.data);
189+
190+
if (phy_api_reinit_needed) {
191+
dect_phy_ctrl_phy_reinit();
192+
}
188193
if (ctrl_data.ext_cmd.sett_changed_cb != NULL) {
189194
ctrl_data.ext_cmd.sett_changed_cb();
190195
}
@@ -193,17 +198,21 @@ static void dect_phy_ctrl_msgq_thread_handler(void)
193198
case DECT_PHY_CTRL_OP_PHY_API_MDM_INITIALIZED: {
194199
struct dect_phy_common_op_initialized_params *params =
195200
(struct dect_phy_common_op_initialized_params *)event.data;
201+
char tmp_str[128] = {0};
196202

197203
if (params->temperature != NRF_MODEM_DECT_PHY_TEMP_NOT_MEASURED) {
198204
ctrl_data.last_valid_temperature = params->temperature;
199205
}
200206

201207
if (params->status) {
208+
dect_common_utils_modem_phy_err_to_string(
209+
params->status, params->temperature, tmp_str);
210+
202211
desh_error("(%s): init failed (time %llu, temperature %d, "
203-
"temp_limit %d): %d",
212+
"temp_limit %d): %d (%s)",
204213
(__func__), params->time, params->temperature,
205214
params->modem_configuration.temperature_limit,
206-
params->status);
215+
params->status, tmp_str);
207216
} else {
208217
if (ctrl_data.phy_api_init_count <= 1) {
209218
desh_print("DECT modem initialized:");
@@ -739,8 +748,13 @@ static void dect_phy_ctrl_phy_init(void)
739748

740749
ctrl_data.dect_phy_init_params.harq_rx_expiry_time_us =
741750
current_settings->harq.mdm_init_harq_expiry_time_us;
751+
742752
ctrl_data.dect_phy_init_params.harq_rx_process_count =
743753
current_settings->harq.mdm_init_harq_process_count;
754+
ctrl_data.dect_phy_init_params.reserved = 0;
755+
ctrl_data.dect_phy_init_params.band4_support =
756+
((current_settings->common.band_nbr == 4) ? 1 : 0);
757+
744758
if (ret) {
745759
printk("nrf_modem_dect_phy_callback_set returned: %i\n", ret);
746760
} else {

samples/dect/dect_phy/dect_shell/src/dect/dect_phy_shell.c

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,8 @@ static const char dect_phy_rf_tool_cmd_usage_str[] =
405405
" -c, --channel <int>, Channel. Default 1665.\n"
406406
" Ranges: band #1: 1657-1677 (only odd numbers as per\n"
407407
" ETSI EN 301 406-2, ch 4.3.2.3),\n"
408-
" band #2 1680-1700, band #9 1691-1711.\n"
408+
" band #2 1680-1700, band #4 524-552,\n"
409+
" band #9 1703-1711, band #22 1691-1711.\n"
409410
" -e --rx_exp_rssi_level <int>, Set expected RSSI level on RX (dBm).\n"
410411
" Default: from common rx settings.\n"
411412
" -p --tx_pwr <int>, TX power (dBm),\n"
@@ -1334,7 +1335,8 @@ static const char dect_phy_sett_cmd_usage_str[] =
13341335
" -b, --band_nbr <#>, Set used band.\n"
13351336
" Impacted on when a channel is set as zero\n"
13361337
" (e.g. in rssi_scan).\n"
1337-
" Default: band #1. Other supported bands are: 2, 9 and 22.\n"
1338+
" Default: band #1. Other supported bands are:\n"
1339+
" 2, 4, 9 and 22.\n"
13381340
" -d, --sche_delay <usecs>, Estimated scheduling delay (us).\n"
13391341
"RSSI measurement settings:\n"
13401342
" --rssi_scan_time <msecs>, Channel access: set the time (msec) that is used for\n"
@@ -1470,6 +1472,7 @@ static int dect_phy_sett_cmd(const struct shell *shell, size_t argc, char **argv
14701472

14711473
int long_index = 0;
14721474
int opt, tmp_value;
1475+
bool phy_api_reinit_needed = false;
14731476

14741477
if (argc < 2) {
14751478
goto show_usage;
@@ -1510,16 +1513,18 @@ static int dect_phy_sett_cmd(const struct shell *shell, size_t argc, char **argv
15101513
case 'b': {
15111514
tmp_value = atoi(optarg);
15121515
if (tmp_value == 1 || tmp_value == 2 || tmp_value == 4 || tmp_value == 9 ||
1513-
tmp_value == 22 || tmp_value == 868) {
1516+
tmp_value == 22) {
15141517
newsettings.common.band_nbr = tmp_value;
15151518
} else {
15161519
desh_error("Band #%d is not supported.", tmp_value);
15171520
return -EINVAL;
15181521
}
1519-
if (newsettings.common.band_nbr == 4 ||
1520-
newsettings.common.band_nbr == 868) {
1521-
desh_print("Custom low band chosen: "
1522-
"custom modem fw is needed to get it working.");
1522+
if ((newsettings.common.band_nbr == 4 &&
1523+
current_settings.common.band_nbr != 4) ||
1524+
(current_settings.common.band_nbr == 4 &&
1525+
newsettings.common.band_nbr != 4)) {
1526+
/* If changing to/from 4, we need dto reinit PHY API */
1527+
phy_api_reinit_needed = true;
15231528
}
15241529
break;
15251530
}
@@ -1604,7 +1609,8 @@ static int dect_phy_sett_cmd(const struct shell *shell, size_t argc, char **argv
16041609
}
16051610
case DECT_SHELL_SETT_RESET_ALL: {
16061611
dect_common_settings_defaults_set();
1607-
return 0;
1612+
phy_api_reinit_needed = true;
1613+
goto settings_updated;
16081614
}
16091615
case 'h':
16101616
goto show_usage;
@@ -1620,7 +1626,11 @@ static int dect_phy_sett_cmd(const struct shell *shell, size_t argc, char **argv
16201626
}
16211627

16221628
dect_common_settings_write(&newsettings);
1623-
dect_phy_ctrl_msgq_non_data_op_add(DECT_PHY_CTRL_OP_SETTINGS_UPDATED);
1629+
settings_updated:
1630+
dect_phy_ctrl_msgq_data_op_add(
1631+
DECT_PHY_CTRL_OP_SETTINGS_UPDATED,
1632+
(void *)&phy_api_reinit_needed,
1633+
sizeof(bool));
16241634
return 0;
16251635

16261636
show_usage:

samples/dect/dect_phy/dect_shell/src/dect/mac/dect_phy_mac_shell.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ static const char dect_phy_mac_beacon_scan_usage_str[] =
5555
"Options:\n"
5656
" -c <integer>, Channel nbr to be scanned for a beacon.\n"
5757
" Ranges: band #1: 1657-1677, band #2 1680-1700,\n"
58-
" band #9 1691-1711. Zero value: all in a set band.\n"
58+
" band #4 524-552, band #9 1703-1711,\n"
59+
" band #22 1691-1711. Zero value: all in a set band.\n"
5960
" Default: 1665.\n"
6061
" -t, --scan_time <integer>, Scanning duration in seconds (default: 4 "
6162
"seconds).\n"
@@ -186,7 +187,8 @@ static const char dect_phy_mac_beacon_start_cmd_usage_str[] =
186187
"Options:\n"
187188
" -c <integer>, Used channel for a beacon.\n"
188189
" Ranges: band #1: 1657-1677 (only odd numbers),\n"
189-
" band #2 1680-1700, band #9 1691-1711.\n"
190+
" band #2 1680-1700, band #4 524-552, band #9 1703-1711,\n"
191+
" band #22 1691-1711.\n"
190192
" Default: 0, i.e. automatic selection of\n"
191193
" free/possible channel on a set band.\n"
192194
" -p, --tx_pwr <dbm>, Set beacon broadcast power (dBm), default: -16.\n"
@@ -273,7 +275,7 @@ static const char dect_phy_mac_associate_cmd_usage_str[] =
273275
" -m, --tx_mcs <integer>, TX MCS (integer). Default: 0.\n"
274276
"Note: LBT (Listen Before Talk) is enabled as a default for a min period,\n"
275277
" but the LBT max RSSI threshold can be configured in settings\n"
276-
" (dect sett ----rssi_scan_busy_th <dbm>).\n";
278+
" (dect sett --rssi_scan_busy_th <dbm>).\n";
277279

278280
/* Specifying the expected options (both long and short): */
279281
static struct option long_options_associate[] = {{"tx_pwr", required_argument, 0, 'p'},
@@ -356,7 +358,7 @@ static const char dect_phy_mac_dissociate_cmd_usage_str[] =
356358
" -m, --tx_mcs <integer>, TX MCS (integer). Default: 0.\n"
357359
"Note: LBT (Listen Before Talk) is enabled as a default for a min period,\n"
358360
" but the LBT max RSSI threshold can be configured in settings\n"
359-
" (dect sett ----rssi_scan_busy_th <dbm>).\n";
361+
" (dect sett --rssi_scan_busy_th <dbm>).\n";
360362

361363
/* Specifying the expected options (both long and short): */
362364
static struct option long_options_dissociate[] = {
@@ -443,7 +445,7 @@ static const char dect_phy_mac_rach_tx_cmd_usage_str[] =
443445
" is encoded in JSON.\n"
444446
"Note: LBT (Listen Before Talk) is enabled as a default for a min period,\n"
445447
" but the LBT max RSSI threshold can be configured in settings\n"
446-
" (dect sett ----rssi_scan_busy_th <dbm>).\n";
448+
" (dect sett --rssi_scan_busy_th <dbm>).\n";
447449

448450
#define DECT_PHY_MAC_RACH_TX_DATA_JSON_OVERHEAD 30
449451

0 commit comments

Comments
 (0)