Skip to content

Commit 9eada28

Browse files
author
Jarkko Paso
committed
WS: Store RF configuration
1 parent 35145a3 commit 9eada28

File tree

3 files changed

+48
-5
lines changed

3 files changed

+48
-5
lines changed

nanostack/platform/arm_hal_phy.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ typedef enum phy_modulation_e {
131131
M_OQPSK, ///< OQPSK
132132
M_BPSK, ///< BPSK
133133
M_GFSK, ///< GFSK
134+
M_2FSK, ///< 2FSK
134135
M_UNDEFINED ///< UNDEFINED
135136
} phy_modulation_e;
136137

source/6LoWPAN/ws/ws_common.c

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ int8_t ws_common_regulatory_domain_config(protocol_interface_info_entry_t *cur)
7474
} else if (cur->ws_info->hopping_schdule.operating_class == 3) {
7575
cur->ws_info->hopping_schdule.ch0_freq = 8701;
7676
cur->ws_info->hopping_schdule.channel_spacing = CHANNEL_SPACING_100;
77-
cur->ws_info->hopping_schdule.number_of_channels = 59;
77+
cur->ws_info->hopping_schdule.number_of_channels = 55;
7878
} else if (cur->ws_info->hopping_schdule.operating_class == 4) {
79-
cur->ws_info->hopping_schdule.ch0_freq = 8701;
79+
cur->ws_info->hopping_schdule.ch0_freq = 8702;
8080
cur->ws_info->hopping_schdule.channel_spacing = CHANNEL_SPACING_200;
81-
cur->ws_info->hopping_schdule.number_of_channels = 30;
81+
cur->ws_info->hopping_schdule.number_of_channels = 27;
8282
} else {
8383
return -1;
8484
}
@@ -132,9 +132,51 @@ int8_t ws_common_regulatory_domain_config(protocol_interface_info_entry_t *cur)
132132
// Note: doesn't work for Brazil region
133133
ws_generate_channel_list(cur->ws_info->hopping_schdule.channel_mask, cur->ws_info->hopping_schdule.number_of_channels, cur->ws_info->hopping_schdule.regulatory_domain);
134134

135+
136+
phy_rf_channel_configuration_s rf_configs;
137+
rf_configs.channel_0_center_frequency = (uint32_t)cur->ws_info->hopping_schdule.ch0_freq*100000;
138+
if (CHANNEL_SPACING_100 == cur->ws_info->hopping_schdule.channel_spacing) {
139+
rf_configs.channel_spacing = 100000;
140+
} else if (CHANNEL_SPACING_200 == cur->ws_info->hopping_schdule.channel_spacing) {
141+
rf_configs.channel_spacing = 200000;
142+
} else if (CHANNEL_SPACING_250 == cur->ws_info->hopping_schdule.channel_spacing) {
143+
rf_configs.channel_spacing = 250000;
144+
} else if (CHANNEL_SPACING_400 == cur->ws_info->hopping_schdule.channel_spacing) {
145+
rf_configs.channel_spacing = 400000;
146+
} else if (CHANNEL_SPACING_600 == cur->ws_info->hopping_schdule.channel_spacing) {
147+
rf_configs.channel_spacing = 600000;
148+
}
149+
150+
if (OPERATING_MODE_1a == cur->ws_info->hopping_schdule.operating_mode) {
151+
rf_configs.datarate = 50000;
152+
rf_configs.modulation_index = MODULATION_INDEX_0_5;
153+
} else if (OPERATING_MODE_1b == cur->ws_info->hopping_schdule.operating_mode) {
154+
rf_configs.datarate = 50000;
155+
rf_configs.modulation_index = MODULATION_INDEX_1_0;
156+
} else if (OPERATING_MODE_2a == cur->ws_info->hopping_schdule.operating_mode) {
157+
rf_configs.datarate = 100000;
158+
rf_configs.modulation_index = MODULATION_INDEX_0_5;
159+
} else if (OPERATING_MODE_2b == cur->ws_info->hopping_schdule.operating_mode) {
160+
rf_configs.datarate = 100000;
161+
rf_configs.modulation_index = MODULATION_INDEX_1_0;
162+
} else if (OPERATING_MODE_3 == cur->ws_info->hopping_schdule.operating_mode) {
163+
rf_configs.datarate = 150000;
164+
rf_configs.modulation_index = MODULATION_INDEX_0_5;
165+
} else if (OPERATING_MODE_4a == cur->ws_info->hopping_schdule.operating_mode) {
166+
rf_configs.datarate = 200000;
167+
rf_configs.modulation_index = MODULATION_INDEX_0_5;
168+
} else if (OPERATING_MODE_4b == cur->ws_info->hopping_schdule.operating_mode) {
169+
rf_configs.datarate = 200000;
170+
rf_configs.modulation_index = MODULATION_INDEX_1_0;
171+
} else if (OPERATING_MODE_5 == cur->ws_info->hopping_schdule.operating_mode) {
172+
rf_configs.datarate = 300000;
173+
rf_configs.modulation_index = MODULATION_INDEX_0_5;
174+
}
175+
135176
mlme_set_t set_request;
136177
// Set RF configuration
137-
phy_rf_channel_configuration_s rf_configs;
178+
rf_configs.number_of_channels = cur->ws_info->hopping_schdule.number_of_channels;
179+
rf_configs.modulation = M_2FSK;
138180
set_request.attr = macRfConfiguration;
139181
set_request.value_pointer = &rf_configs;
140182
set_request.value_size = sizeof(phy_rf_channel_configuration_s);

test/nanostack/unittest/mac/mac_mlme/test_mac_mlme.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ bool test_mac_mlme_set_req()
569569
uint8_t val[1];
570570
set.value_pointer = &val;
571571

572-
set.attr = 0xfb;
572+
set.attr = 0xf0;
573573
set.value_size = 0;
574574
if (-1 != mac_mlme_set_req(&setup, &set)) {
575575
return false;

0 commit comments

Comments
 (0)