Skip to content

Commit 41747c9

Browse files
author
Arto Kinnunen
authored
Merge pull request #13444 from artokin/nanostack_release_12_4_0_fea_wisun
[feature-wisun] Nanostack release v12.4.0
2 parents 3ab72c7 + 12bfd83 commit 41747c9

File tree

107 files changed

+5010
-422
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+5010
-422
lines changed

components/802.15.4_RF/atmel-rf-driver/source/AT86RF215Reg.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ extern "C" {
9797
// RF_PAC
9898
#define TXPWR 0x1F
9999
#define TXPWR_11 (11 << 0)
100+
#define TXPWR_0 (0 << 0)
101+
#define TXPWR_31 (31 << 0)
102+
100103

101104
// RF_PADFE
102105
#define PADFE 0xC0
@@ -165,6 +168,9 @@ extern "C" {
165168
#define SR_2 (2 << 0)
166169
#define SR_1 (1 << 0)
167170

171+
// BBC_FSKPHRTX
172+
#define DW (1 << 2)
173+
168174
// BBC_OFDMPHRTX
169175
#define MCS 0x07
170176
#define MCS_0 (0 << 0)

components/802.15.4_RF/atmel-rf-driver/source/NanostackRfPhyAT86RF215.cpp

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ static int rf_set_fsk_symbol_rate_configuration(uint32_t symbol_rate, rf_modules
103103
static int rf_configure_by_ofdm_bandwidth_option(uint8_t option, uint32_t data_rate, rf_modules_e module);
104104
static void rf_calculate_symbol_rate(uint32_t baudrate, phy_modulation_e modulation);
105105
static void rf_conf_set_cca_threshold(uint8_t percent);
106+
static bool rf_conf_set_tx_power(uint8_t percent);
106107
// Defined register read/write functions
107108
#define rf_read_bbc_register(x, y) rf_read_rf_register(x, (rf_modules_e)(y + 2))
108109
#define rf_read_common_register(x) rf_read_rf_register(x, COMMON)
@@ -134,7 +135,10 @@ static uint8_t bbc0_irq_mask = 0;
134135
static uint8_t bbc1_irq_mask = 0;
135136

136137
static bool rf_update_config = false;
138+
static bool rf_update_tx_power = false;
137139
static int8_t cca_threshold = -80;
140+
static uint8_t rf_tx_power = TXPWR_31;
141+
static bool data_whitening_enabled = true;
138142
static bool cca_enabled = true;
139143
static uint32_t rf_symbol_rate;
140144

@@ -303,9 +307,25 @@ static int8_t rf_extension(phy_extension_type_e extension_type, uint8_t *data_pt
303307
case PHY_EXTENSION_SET_CCA_THRESHOLD:
304308
rf_conf_set_cca_threshold(*data_ptr);
305309
break;
310+
case PHY_EXTENSION_SET_TX_POWER:
311+
if (*data_ptr > 100) {
312+
return -1;
313+
}
314+
rf_update_tx_power = rf_conf_set_tx_power(*data_ptr);
315+
if (rf_update_tx_power && (rf_state == RF_IDLE)) {
316+
rf_receive(rf_rx_channel, rf_module);
317+
}
318+
break;
306319
case PHY_EXTENSION_SET_CHANNEL_CCA_THRESHOLD:
307320
cca_threshold = (int8_t) *data_ptr; // *NOPAD*
308321
break;
322+
case PHY_EXTENSION_SET_DATA_WHITENING:
323+
data_whitening_enabled = (bool) *data_ptr; // *NOPAD*
324+
rf_update_config = true;
325+
if (rf_state == RF_IDLE) {
326+
rf_receive(rf_rx_channel, rf_module);
327+
}
328+
break;
309329
case PHY_EXTENSION_SET_802_15_4_MODE:
310330
mac_mode = (phy_802_15_4_mode_t) *data_ptr; // *NOPAD*
311331
if (mac_mode == IEEE_802_15_4_2011) {
@@ -418,6 +438,12 @@ static void rf_init_registers(rf_modules_e module)
418438
rf_write_bbc_register_field(BBC_AFC0, module, AFEN0, 0);
419439
// Enable FSK
420440
if (phy_current_config.modulation == M_2FSK) {
441+
// Enable or disable data whitening
442+
if (data_whitening_enabled) {
443+
rf_write_bbc_register_field(BBC_FSKPHRTX, module, DW, DW);
444+
} else {
445+
rf_write_bbc_register_field(BBC_FSKPHRTX, module, DW, 0);
446+
}
421447
rf_write_bbc_register_field(BBC_PC, module, PT, BB_MRFSK);
422448
// Set bandwidth time product
423449
rf_write_bbc_register_field(BBC_FSKC0, module, BT, BT_20);
@@ -474,8 +500,10 @@ static void rf_init_registers(rf_modules_e module)
474500
// Enable external front end with configuration 3
475501
rf_write_rf_register_field(RF_PADFE, module, PADFE, RF_FEMODE3);
476502
// Output power at 900MHz: 0 dBm with FSK/QPSK, less than -5 dBm with OFDM
477-
rf_write_rf_register_field(RF_PAC, module, TXPWR, TXPWR_11);
503+
rf_tx_power = TXPWR_11;
478504
}
505+
// Set TX output power
506+
rf_write_rf_register_field(RF_PAC, module, TXPWR, rf_tx_power);
479507
// Enable analog voltage regulator
480508
rf_write_rf_register_field(RF_AUXS, module, AVEN, AVEN);
481509
// Disable filtering FCS
@@ -695,7 +723,7 @@ static void rf_handle_rx_start(void)
695723

696724
static void rf_receive(uint16_t rx_channel, rf_modules_e module)
697725
{
698-
if ((receiver_enabled == true) && (rf_update_config == false) && (rx_channel == rf_rx_channel)) {
726+
if ((receiver_enabled == true) && (rf_update_config == false) && (rf_update_tx_power == false) && (rx_channel == rf_rx_channel)) {
699727
return;
700728
}
701729
TEST_RX_DONE
@@ -706,6 +734,12 @@ static void rf_receive(uint16_t rx_channel, rf_modules_e module)
706734
rf_init_registers(module);
707735
rf_change_state(RF_TXPREP, module);
708736
}
737+
if (rf_update_tx_power == true) {
738+
rf_update_tx_power = false;
739+
rf_change_state(RF_TRX_OFF, module);
740+
rf_write_rf_register_field(RF_PAC, module, TXPWR, rf_tx_power);
741+
rf_change_state(RF_TXPREP, module);
742+
}
709743
if (rx_channel != rf_rx_channel) {
710744
rf_change_state(RF_TXPREP, module);
711745
rf_set_channel(rx_channel, module);
@@ -1170,6 +1204,17 @@ static void rf_conf_set_cca_threshold(uint8_t percent)
11701204
cca_threshold = MIN_CCA_THRESHOLD + (step * percent) / 100;
11711205
}
11721206

1207+
static bool rf_conf_set_tx_power(uint8_t percent)
1208+
{
1209+
uint8_t step = (TXPWR_31 - TXPWR_0);
1210+
uint8_t new_value = TXPWR_0 + (step * percent) / 100;
1211+
if (rf_tx_power != new_value) {
1212+
rf_tx_power = new_value;
1213+
return true;
1214+
}
1215+
return false;
1216+
}
1217+
11731218
static void rf_calculate_symbol_rate(uint32_t baudrate, phy_modulation_e modulation)
11741219
{
11751220
uint8_t bits_in_symbols = 4;

components/802.15.4_RF/stm-s2lp-rf-driver/source/NanostackRfPhys2lp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1328,7 +1328,7 @@ NanostackRfPhys2lp::NanostackRfPhys2lp(PinName spi_sdi, PinName spi_sdo, PinName
13281328
#ifdef AT24MAC
13291329
_mac(i2c_sda, i2c_scl),
13301330
#endif //AT24MAC
1331-
_mac_addr(), _rf(NULL), _mac_set(false),
1331+
_mac_addr(), _rf(NULL), _test_pins(NULL), _mac_set(false),
13321332
_spi_sdi(spi_sdi), _spi_sdo(spi_sdo), _spi_sclk(spi_sclk), _spi_cs(spi_cs), _spi_sdn(spi_sdn),
13331333
_spi_gpio0(spi_gpio0), _spi_gpio1(spi_gpio1), _spi_gpio2(spi_gpio2), _spi_gpio3(spi_gpio3)
13341334
{

features/frameworks/mbed-trace/README.md

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The purpose of the library is to provide a light, simple and general tracing sol
2626
* The trace function uses `stdout` as the default output target because it goes directly to serial port in mbed-os.
2727
* The trace function produces traces like: `[<levl>][grp ]: msg`. This provides an easy way to detect trace prints and separate traces from normal prints (for example with _regex_).
2828
* This approach requires a `sprintf` implementation (`stdio.h`). The memory consumption is pretty high, but it allows an efficient way to format traces.
29-
* The solution is not Interrupt safe. (PRs are more than welcome.)
29+
* The solution is not Interrupt safe. ([PRs](https://github.com/ARMmbed/mbed-trace/pulls) are more than welcome.)
3030
* The solution is not thread safe by default. Thread safety for the actual trace calls can be enabled by providing wait and release callback functions that use mutexes defined by the application.
3131

3232
## Examples of traces
@@ -43,7 +43,7 @@ The purpose of the library is to provide a light, simple and general tracing sol
4343
### Prerequisites
4444

4545
* Initialize the serial port so that `stdout` works. You can verify that the serial port works using the `printf()` function.
46-
* if you want to redirect the traces somewhere else, see the [trace API](https://github.com/ARMmbed/mbed-trace/blob/master/mbed-trace/mbed_trace.h#L245).
46+
* If you want to redirect the traces somewhere else, see the [trace API](https://github.com/ARMmbed/mbed-trace/blob/master/mbed-trace/mbed_trace.h#L245).
4747
* To enable the tracing API:
4848
* With yotta: set `YOTTA_CFG_MBED_TRACE` to 1 or true. Setting the flag to 0 or false disables tracing.
4949
* [With mbed OS 5](#enabling-the-tracing-api-in-mbed-os-5)
@@ -54,7 +54,7 @@ The purpose of the library is to provide a light, simple and general tracing sol
5454
* If thread safety is needed, configure the wait and release callback functions before initialization to enable the protection. Usually, this needs to be done only once in the application's lifetime.
5555
* If [helping functions](#helping-functions) are used the mutex must be **recursive** (counting) so it can be acquired from a single thread repeatedly.
5656
* Call the trace initialization (`mbed_trace_init`) once before using any other APIs. It allocates the trace buffer and initializes the internal variables.
57-
* Define `TRACE_GROUP` in your source code (not in the header!) to use traces. It is a 1-4 characters long char-array (for example `#define TRACE_GROUP "APPL"`). This will be printed on every trace line.
57+
* Define `TRACE_GROUP` in your **source code (not in the header)** to use traces. It is a 1-4 characters long char-array (for example `#define TRACE_GROUP "APPL"`). This will be printed on every trace line.
5858

5959
### Enabling the tracing API in mbed OS 5
6060

@@ -72,7 +72,7 @@ To do so, add the following to your mbed_app.json:
7272
}
7373
```
7474

75-
Don't forget to fulfill the other [prerequisites](#prerequisites)!
75+
Do not forget to fulfill the other [prerequisites](#prerequisites)!
7676

7777
([Click here for more information on the configuration system](https://docs.mbed.com/docs/mbed-os-api/en/latest/config_system/))
7878

@@ -204,6 +204,52 @@ int main(void){
204204
}
205205
```
206206
207+
## Run-time trace group filtering
208+
209+
The trace groups you have defined using the `TRACE_GROUP` macro in your .c/.cpp files can be used to control tracing at run-time.
210+
211+
| Function | Explanation |
212+
|-----------------------------------|--------------------------------------------------------------|
213+
|`mbed_trace_include_filters_get()` | Get the exclusion filter list string. |
214+
|`mbed_trace_include_filters_set()` | Set trace list to include only the traces matching the list. |
215+
|`mbed_trace_exclude_filters_get()` | Get the inclusion filter list string. |
216+
|`mbed_trace_exclude_filters_set()` | Set trace list to exclude the traces matching the list. |
217+
218+
The filter list is a null terminated string of comma (`,`) separated trace group names. The default maximum length of the string is 24 characters, including the terminating null. Length can be changed by defining the macro `DEFAULT_TRACE_FILTER_LENGTH`. Exclude and include filters can be combined freely as they both have their own filtering list.
219+
220+
The matching is done simply using `strstr()` from C standard libraries.
221+
222+
### Examples of trace group filtering
223+
224+
Assuming we have 4 modules called "MAIN", "HELP", "CALC" and "PRNT" we could use the filters in the following ways.
225+
226+
#### Inclusion filter
227+
228+
To include only "MAIN" and "CALC" traces to the trace prints, we can do:
229+
230+
```
231+
mbed_trace_include_filters_set("MAIN,CALC");
232+
```
233+
234+
This would print out only the traces from "MAIN" and "CALC", since they are the trace groups matching the filter list. Trace groups "HELP" and "PRNT" would not be printed out at all.
235+
236+
## Exclusion filter
237+
238+
```
239+
mbed_trace_exclude_filters_set("HELP,PRNT");
240+
```
241+
242+
This would exclue trace groups "HELP" and "PRNT" out of trace printing, thus leaving only prints from "MAIN" and "CALC" visible in the tracing.
243+
244+
### Reset filter
245+
246+
```
247+
mbed_trace_include_filters_set(NULL);
248+
```
249+
250+
This would reset the inclusion filters back to nothing and assuming no exclusion filter is in place either, all trace groups prints would get printed.
251+
252+
207253
## Unit tests
208254
209255
To run unit tests:

features/frameworks/nanostack-libservice/mbed-client-libservice/ns_list.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,18 @@
2323
extern "C" {
2424
#endif
2525

26+
/** \defgroup ns_list Linked list support library.
27+
*
28+
* The ns_list.h file provides a doubly-linked list/queue, providing O(1)
29+
* performance for all insertion/removal operations, and access to either
30+
* end of the list.
31+
*
32+
* See \ref ns_list.h for documentation.
33+
*/
34+
2635
/** \file
27-
* \brief Linked list support library
36+
* \ingroup ns_list
37+
* \brief Linked list support library.
2838
*
2939
* The ns_list.h file provides a doubly-linked list/queue, providing O(1)
3040
* performance for all insertion/removal operations, and access to either

features/nanostack/sal-stack-nanostack-eventloop/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright (c) 2019 ARM Limited
2+
# SPDX-License-Identifier: Apache-2.0
13
# Define compiler toolchain with CC or PLATFORM variables
24
# Example (GCC toolchains)
35
# make PLATFORM=arm-linux-gnueabi-

0 commit comments

Comments
 (0)