Skip to content

Commit 80f588c

Browse files
jhirsinordicjm
authored andcommitted
samples: dect_phy: dect_shell: rx command changes
Following changes were done to dect rx command: - possibility to iterate all channels in a set band by giving channel 0 - new hook: --use_filter to enable RX filter. - new hook: --use_all_channels, channel access override to scan all channels. default without this hook mis to scan only allowed channels per ETSI EN 301 406-2. These changes also impact to dect mac beacon_scan command to have a support iterate all channels by giving channel 0. Also, this commit contains PR review changes from mac sample review. Signed-off-by: Jani Hirsimäki <[email protected]>
1 parent 6dffbd9 commit 80f588c

File tree

8 files changed

+239
-188
lines changed

8 files changed

+239
-188
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,16 @@ DECT NR+ samples
263263

264264
* :ref:`dect_shell_application` sample:
265265

266-
* A brief mac level sample on top of dect_phy api. New commands to create a periodic cluster beacon, scan for it, associate/disassociate a PT/client, and send data to a FT/beacon random access window. Note: this is just a sample/initials of a mac implementation and thus not a full MAC implementation and not fully compliant with dect nr+ mac spec (ETSI TS 103 636-4).
267-
* dect rssi_scan: In addition to default high/low rssi_scan: option for MAC spec like rssi_scan: busy/possible/free subslot count based RSSI scan.
266+
* Added:
267+
268+
* The ``dect mac`` command.
269+
A brief MAC-level sample on top of DECT PHY interface with new commands to create a periodic cluster beacon, scan for it, associate or disassociate a PT/client, and send data to a FT/beacon random access window.
270+
This is not a full MAC implementation and not fully compliant with DECT NR+ MAC specification (`ETSI TS 103 636-4`_).
271+
272+
* Updated:
273+
274+
* The ``dect rssi_scan`` command with busy/possible/free subslot count-based RSSI scan.
275+
* The ``dect rx`` command to provide the possibility to iterate all channels and to enable RX filter.
268276

269277
Edge Impulse samples
270278
--------------------

samples/dect/dect_phy/dect_shell/README.rst

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ Main command structure:
4545
rf_tool
4646
status
4747
rx
48-
mac
49-
beacon_scan
50-
beacon_start
51-
beacon_stop
52-
rach_tx
53-
associate
54-
dissociate
55-
status
48+
mac
49+
beacon_scan
50+
beacon_start
51+
beacon_stop
52+
rach_tx
53+
associate
54+
dissociate
55+
status
5656
5757
Application settings
5858
====================
@@ -118,13 +118,14 @@ Examples
118118
119119
dect rssi_scan stop
120120
121-
* Execute longer RSSI measurements on all permitted channels, and instead of default high/low RSSI value based verdict; use subslot count based verdict for BUSY/POSSIBLE/FREE and as a end results, see the verdict for the best channel:
121+
* Execute longer RSSI measurements on all permitted channels, and instead of default high/low RSSI value-based verdict, use subslot count-based verdict for BUSY/POSSIBLE/FREE and as an end result, see the verdict for the best channel:
122122

123123
.. code-block:: console
124124
125125
dect rssi_scan -c 0 --verdict_type_count -t 3000 -a
126126
127-
* Execute longer RSSI measurements on specific channel, and instead of default high/low RSSI value based verdict; use subslot count based verdict for BUSY/POSSIBLE/FREE. Additionally, print BUSY/POSSIBLE measurements:
127+
* Execute longer RSSI measurements on specific channel, and instead of default high/low RSSI value-based verdict, use subslot count-based verdict for BUSY/POSSIBLE/FREE.
128+
Additionally, print BUSY/POSSIBLE measurements:
128129

129130
.. code-block:: console
130131
@@ -437,16 +438,23 @@ Dect NR+ PHY MAC
437438

438439
DeSh command: ``dect mac``
439440

440-
This command demostrates basic sample of DECT NR+ MAC layer on top of PHY API based on ETSI TS 103 636-4 V1.4.8 (2024-01).
441-
With this command you can start a cluster beacon, scan for beacons, associate/dissociate, and send data to beacon random access RX window.
441+
This command demonstrates a basic sample of the DECT NR+ MAC layer on top of PHY API. It is based on MAC specification `ETSI TS 103 636-4`_.
442+
With this command, you can start a cluster beacon, scan for beacons, associate/dissociate, and send data to the beacon random access RX window.
442443

443-
Disclaimer: this is just a basic sample for initials and not a full MAC implementation, it does not support all the features of the DECT NR+ MAC layer and is not fully compliant with the MAC specification.
444-
For example cluster beaconing with RA allocation, and LMS implementations overall are not what is required by the MAC specification.
444+
.. note::
445+
This is just an initial basic sample and not a full MAC implementation.
446+
It does not support all the features of the DECT NR+ MAC layer and is not fully compliant with the MAC specification.
447+
For example, cluster beaconing with RA allocation and LMS implementations overall are not what is required by the specification.
448+
449+
The following abbreviations from MAC specification are used in the examples:
450+
451+
* FT: Fixed Termination point
452+
* PT: Portable Termination point
445453

446454
Example: starting of cluster beacon and sending RA data to it
447455
-------------------------------------------------------------
448456

449-
* FT/Beacon device - start periodic cluster beacon TX at default band #1 and at the 1st free channel:
457+
* FT/Beacon device - Start periodic cluster beacon TX on default band 1 and on the first free channel:
450458

451459
.. code-block:: console
452460
@@ -627,7 +635,7 @@ Example: starting of cluster beacon and sending RA data to it
627635
short RD ID....................................27462 (0x6b46)
628636
band number....................................1
629637
630-
* PT/client side: Scan beacon:
638+
* PT/client side - Scan the beacon:
631639

632640
.. code-block:: console
633641
@@ -708,13 +716,13 @@ Example: starting of cluster beacon and sending RA data to it
708716
-----------------------------------------------------------------------------
709717
RX DONE.
710718
711-
* PT/client side: As an alternative to the previous command, and if you don't know in which channel beacon is running, you can scan all channels in a set band:
719+
* PT/client side - As an alternative to the previous command, and if you do not know in which channel the beacon is running, you can scan all channels in a set band:
712720

713721
.. code-block:: console
714722
715723
desh:~$ dect mac beacon_scan -c 0
716724
717-
* PT/client side: See that scanned beacon can be found from neighbor list:
725+
* PT/client side - Check that the scanned beacon is found from neighbor list:
718726

719727
.. code-block:: console
720728
@@ -732,7 +740,7 @@ Example: starting of cluster beacon and sending RA data to it
732740
channel: 1659
733741
last seen time: 17016336625
734742
735-
* PT/client side: Send association request to scanned beacon:
743+
* PT/client side - Send association request to the scanned beacon:
736744

737745
.. code-block:: console
738746
@@ -773,7 +781,7 @@ Example: starting of cluster beacon and sending RA data to it
773781
Received padding data, len 1, payload is not printed
774782
RX for Association Response completed.
775783
776-
* PT/client side: Send RA data to scanned beacon:
784+
* PT/client side - Send RA data to the scanned beacon:
777785

778786
.. code-block:: console
779787
@@ -787,7 +795,7 @@ Example: starting of cluster beacon and sending RA data to it
787795
Client TX to RACH started.
788796
Client data TX completed.
789797
790-
* FT/Beacon device: Observe that data was received:
798+
* FT/Beacon device - Observe that data was received:
791799

792800
.. code-block:: console
793801
@@ -816,7 +824,7 @@ Example: starting of cluster beacon and sending RA data to it
816824
Payload length: 0
817825
Received padding data, len 0, payload is not printed
818826
819-
* PT/client side: Send association release to scanned beacon:
827+
* PT/client side - Send association release to the scanned beacon:
820828

821829
.. code-block:: console
822830
@@ -830,7 +838,7 @@ Example: starting of cluster beacon and sending RA data to it
830838
Association Release TX started.
831839
TX for Association Release completed.
832840
833-
* FT/Beacon device: See that Association Release message was received:
841+
* FT/Beacon device - Observe that the association release message was received:
834842

835843
.. code-block:: console
836844
@@ -860,17 +868,14 @@ Example: starting of cluster beacon and sending RA data to it
860868
Payload length: 1
861869
Received padding data, len 1, payload is not printed
862870
863-
* FT/Beacon device: Stop beacon
871+
* FT/Beacon device - Stop the beacon:
864872

865-
+ .. code-block:: console
873+
.. code-block:: console
866874
867875
desh:~$ dect mac beacon_stop
868876
Stopping beacon.
869877
Beacon TX stopped, cause: User Initiated.
870878
871-
----
872-
873-
874879
Building
875880
********
876881

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

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ static struct dect_phy_ctrl_data {
5656
bool ext_command_running;
5757

5858
bool rx_cmd_on_going;
59+
uint16_t rx_cmd_current_channel;
5960
struct dect_phy_rx_cmd_params rx_cmd_params;
6061

6162
bool time_cmd;
@@ -358,7 +359,7 @@ static void dect_phy_ctrl_msgq_thread_handler(void)
358359
params->status, params->temperature, tmp_str);
359360
if (params->handle == DECT_PHY_COMMON_RSSI_SCAN_HANDLE) {
360361
dect_phy_scan_rssi_finished_handle(params->status);
361-
} else if (params->handle == DECT_PHY_COMMON_RX_CMD_HANDLE) {
362+
} else if (params->handle == ctrl_data.rx_cmd_params.handle) {
362363
dect_phy_api_scheduler_resume();
363364
desh_error("%s: cannot start RX: %s", __func__, tmp_str);
364365
ctrl_data.rx_cmd_on_going = false;
@@ -368,10 +369,17 @@ static void dect_phy_ctrl_msgq_thread_handler(void)
368369
}
369370
}
370371
} else {
371-
if (params->handle == DECT_PHY_COMMON_RX_CMD_HANDLE) {
372-
ctrl_data.rx_cmd_on_going = false;
373-
dect_phy_api_scheduler_resume();
374-
desh_print("RX DONE.");
372+
if (params->handle == ctrl_data.rx_cmd_params.handle) {
373+
struct dect_phy_rx_cmd_params copy_params =
374+
ctrl_data.rx_cmd_params;
375+
int err;
376+
377+
err = dect_phy_ctrl_rx_start(&copy_params, true);
378+
if (err) {
379+
ctrl_data.rx_cmd_on_going = false;
380+
dect_phy_api_scheduler_resume();
381+
desh_print("RX DONE.");
382+
}
375383
} else if (params->handle == DECT_PHY_COMMON_RSSI_SCAN_HANDLE) {
376384
dect_phy_scan_rssi_finished_handle(params->status);
377385
} else {
@@ -765,11 +773,11 @@ int dect_phy_ctrl_time_query(void)
765773
void dect_phy_ctrl_rx_stop(void)
766774
{
767775
ctrl_data.rx_cmd_on_going = false;
768-
(void)nrf_modem_dect_phy_rx_stop(DECT_PHY_COMMON_RX_CMD_HANDLE);
776+
(void)nrf_modem_dect_phy_rx_stop(ctrl_data.rx_cmd_params.handle);
769777
dect_phy_api_scheduler_resume();
770778
}
771779

772-
int dect_phy_ctrl_rx_start(struct dect_phy_rx_cmd_params *params)
780+
int dect_phy_ctrl_rx_start(struct dect_phy_rx_cmd_params *params, bool restart)
773781
{
774782
int err;
775783

@@ -778,7 +786,12 @@ int dect_phy_ctrl_rx_start(struct dect_phy_rx_cmd_params *params)
778786
return -EACCES;
779787
}
780788

781-
if (ctrl_data.rx_cmd_on_going) {
789+
if (restart && !ctrl_data.rx_cmd_on_going) {
790+
desh_warn("Cannot restart RX when RX is not on going.");
791+
return -EINVAL;
792+
}
793+
794+
if (ctrl_data.rx_cmd_on_going && !restart) {
782795
desh_error("rx cmd already on going.");
783796
return -EALREADY;
784797
}
@@ -787,15 +800,48 @@ int dect_phy_ctrl_rx_start(struct dect_phy_rx_cmd_params *params)
787800
dect_phy_api_scheduler_suspend();
788801
}
789802

803+
struct dect_phy_settings *current_settings = dect_common_settings_ref_get();
804+
805+
if (params->channel == 0) {
806+
if (restart) {
807+
uint16_t next_channel = dect_common_utils_get_next_channel_in_band_range(
808+
current_settings->common.band_nbr,
809+
ctrl_data.rx_cmd_current_channel,
810+
!params->ch_acc_use_all_channels);
811+
812+
if (next_channel) {
813+
ctrl_data.rx_cmd_current_channel = next_channel;
814+
} else {
815+
/* We are done */
816+
desh_print("All channels in band scanned.");
817+
return -ENODATA;
818+
}
819+
} else {
820+
/* All channels in a set band */
821+
ctrl_data.rx_cmd_current_channel =
822+
dect_common_utils_channel_min_on_band(
823+
current_settings->common.band_nbr);
824+
}
825+
} else {
826+
if (restart) {
827+
/* Cannot restart RX on a specific channel */
828+
return -EINVAL;
829+
}
830+
ctrl_data.rx_cmd_current_channel = params->channel;
831+
}
832+
790833
struct dect_phy_rssi_scan_params rssi_params = {
791-
.channel = params->channel,
834+
.channel = ctrl_data.rx_cmd_current_channel,
792835
.result_verdict_type = DECT_PHY_RSSI_SCAN_RESULT_VERDICT_TYPE_ALL,
793836
.busy_rssi_limit = params->busy_rssi_limit,
794837
.free_rssi_limit = params->free_rssi_limit,
795838
.interval_secs = params->rssi_interval_secs,
796839
};
797840

841+
798842
ctrl_data.rx_cmd_params = *params;
843+
params->channel = ctrl_data.rx_cmd_current_channel;
844+
799845
err = dect_phy_scan_rssi_data_init(&rssi_params);
800846
if (err) {
801847
desh_error("RSSI scan data init failed: err", err);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ int dect_phy_ctrl_msgq_data_op_add(uint16_t event_id, void *data, size_t data_si
4444

4545
void dect_phy_ctrl_status_get_n_print(void);
4646

47-
int dect_phy_ctrl_rx_start(struct dect_phy_rx_cmd_params *params);
47+
int dect_phy_ctrl_rx_start(struct dect_phy_rx_cmd_params *params, bool restart);
4848
void dect_phy_ctrl_rx_stop(void);
4949

5050
int dect_phy_ctrl_time_query(void);

0 commit comments

Comments
 (0)