Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
LoRaMac-definitions.h
00001 /* 00002 / _____) _ | | 00003 ( (____ _____ ____ _| |_ _____ ____| |__ 00004 \____ \| ___ | (_ _) ___ |/ ___) _ \ 00005 _____) ) ____| | | || |_| ____( (___| | | | 00006 (______/|_____)_|_|_| \__)_____)\____)_| |_| 00007 (C)2013 Semtech 00008 00009 Description: LoRa MAC layer global definitions 00010 00011 License: Revised BSD License, see LICENSE.TXT file include in the project 00012 00013 Maintainer: Miguel Luis and Gregory Cristian 00014 */ 00015 #ifndef __LORAMAC_BOARD_H__ 00016 #define __LORAMAC_BOARD_H__ 00017 00018 /*! 00019 * Returns individual channel mask 00020 * 00021 * \param[IN] channelIndex Channel index 1 based 00022 * \retval channelMask 00023 */ 00024 #define LC( channelIndex ) ( uint16_t )( 1 << ( channelIndex - 1 ) ) 00025 00026 #if defined( USE_BAND_433 ) 00027 00028 /*! 00029 * LoRaMac maximum number of channels 00030 */ 00031 #define LORA_MAX_NB_CHANNELS 16 00032 00033 /*! 00034 * Minimal datarate that can be used by the node 00035 */ 00036 #define LORAMAC_TX_MIN_DATARATE DR_0 00037 00038 /*! 00039 * Maximal datarate that can be used by the node 00040 */ 00041 #define LORAMAC_TX_MAX_DATARATE DR_7 00042 00043 /*! 00044 * Minimal datarate that can be used by the node 00045 */ 00046 #define LORAMAC_RX_MIN_DATARATE DR_0 00047 00048 /*! 00049 * Maximal datarate that can be used by the node 00050 */ 00051 #define LORAMAC_RX_MAX_DATARATE DR_7 00052 00053 /*! 00054 * Default datarate used by the node 00055 */ 00056 #define LORAMAC_DEFAULT_DATARATE DR_0 00057 00058 /*! 00059 * Minimal Rx1 receive datarate offset 00060 */ 00061 #define LORAMAC_MIN_RX1_DR_OFFSET 0 00062 00063 /*! 00064 * Maximal Rx1 receive datarate offset 00065 */ 00066 #define LORAMAC_MAX_RX1_DR_OFFSET 5 00067 00068 /*! 00069 * Minimal Tx output power that can be used by the node 00070 */ 00071 #define LORAMAC_MIN_TX_POWER TX_POWER_M5_DBM 00072 00073 /*! 00074 * Maximal Tx output power that can be used by the node 00075 */ 00076 #define LORAMAC_MAX_TX_POWER TX_POWER_10_DBM 00077 00078 /*! 00079 * Default Tx output power used by the node 00080 */ 00081 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_10_DBM 00082 00083 /*! 00084 * LoRaMac TxPower definition 00085 */ 00086 #define TX_POWER_10_DBM 0 00087 #define TX_POWER_07_DBM 1 00088 #define TX_POWER_04_DBM 2 00089 #define TX_POWER_01_DBM 3 00090 #define TX_POWER_M2_DBM 4 00091 #define TX_POWER_M5_DBM 5 00092 00093 /*! 00094 * LoRaMac datarates definition 00095 */ 00096 #define DR_0 0 // SF12 - BW125 00097 #define DR_1 1 // SF11 - BW125 00098 #define DR_2 2 // SF10 - BW125 00099 #define DR_3 3 // SF9 - BW125 00100 #define DR_4 4 // SF8 - BW125 00101 #define DR_5 5 // SF7 - BW125 00102 #define DR_6 6 // SF7 - BW250 00103 #define DR_7 7 // FSK 00104 00105 /*! 00106 * Verification of default datarate 00107 */ 00108 #if ( LORAMAC_DEFAULT_DATARATE > DR_5 ) 00109 #error "A default DR higher than DR_5 may lead to connectivity loss." 00110 #endif 00111 00112 /*! 00113 * Second reception window channel definition. 00114 */ 00115 // Channel = { Frequency [Hz], Datarate } 00116 #define RX_WND_2_CHANNEL { 434665000, DR_0 } 00117 00118 /*! 00119 * LoRaMac maximum number of bands 00120 */ 00121 #define LORA_MAX_NB_BANDS 1 00122 00123 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff } 00124 #define BAND0 { 100, TX_POWER_10_DBM, 0, 0 } // 1.0 % 00125 00126 /*! 00127 * LoRaMac default channels 00128 */ 00129 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band } 00130 #define LC1 { 433175000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00131 #define LC2 { 433375000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00132 #define LC3 { 433575000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00133 00134 /*! 00135 * LoRaMac channels which are allowed for the join procedure 00136 */ 00137 #define JOIN_CHANNELS ( uint16_t )( LC( 1 ) | LC( 2 ) | LC( 3 ) ) 00138 00139 #elif defined( USE_BAND_470 ) 00140 00141 /*! 00142 * LoRaMac maximum number of channels 00143 */ 00144 #define LORA_MAX_NB_CHANNELS 96 00145 00146 /*! 00147 * Minimal datarate that can be used by the node 00148 */ 00149 #define LORAMAC_TX_MIN_DATARATE DR_0 00150 00151 /*! 00152 * Maximal datarate that can be used by the node 00153 */ 00154 #define LORAMAC_TX_MAX_DATARATE DR_5 00155 00156 /*! 00157 * Minimal datarate that can be used by the node 00158 */ 00159 #define LORAMAC_RX_MIN_DATARATE DR_0 00160 00161 /*! 00162 * Maximal datarate that can be used by the node 00163 */ 00164 #define LORAMAC_RX_MAX_DATARATE DR_5 00165 00166 /*! 00167 * Default datarate used by the node 00168 */ 00169 #define LORAMAC_DEFAULT_DATARATE DR_0 00170 00171 /*! 00172 * Minimal Rx1 receive datarate offset 00173 */ 00174 #define LORAMAC_MIN_RX1_DR_OFFSET 0 00175 00176 /*! 00177 * Maximal Rx1 receive datarate offset 00178 */ 00179 #define LORAMAC_MAX_RX1_DR_OFFSET 3 00180 00181 /*! 00182 * Minimal Tx output power that can be used by the node 00183 */ 00184 #define LORAMAC_MIN_TX_POWER TX_POWER_2_DBM 00185 00186 /*! 00187 * Maximal Tx output power that can be used by the node 00188 */ 00189 #define LORAMAC_MAX_TX_POWER TX_POWER_17_DBM 00190 00191 /*! 00192 * Default Tx output power used by the node 00193 */ 00194 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_14_DBM 00195 00196 /*! 00197 * LoRaMac TxPower definition 00198 */ 00199 #define TX_POWER_17_DBM 0 00200 #define TX_POWER_16_DBM 1 00201 #define TX_POWER_14_DBM 2 00202 #define TX_POWER_12_DBM 3 00203 #define TX_POWER_10_DBM 4 00204 #define TX_POWER_7_DBM 5 00205 #define TX_POWER_5_DBM 6 00206 #define TX_POWER_2_DBM 7 00207 00208 00209 /*! 00210 * LoRaMac datarates definition 00211 */ 00212 #define DR_0 0 // SF12 - BW125 | 00213 #define DR_1 1 // SF11 - BW125 | 00214 #define DR_2 2 // SF10 - BW125 | 00215 #define DR_3 3 // SF9 - BW125 | 00216 #define DR_4 4 // SF8 - BW125 | 00217 #define DR_5 5 // SF7 - BW125 | 00218 00219 /*! 00220 * Second reception window channel definition. 00221 */ 00222 // Channel = { Frequency [Hz], Datarate } 00223 #define RX_WND_2_CHANNEL { 505300000, DR_0 } 00224 00225 /*! 00226 * LoRaMac maximum number of bands 00227 */ 00228 #define LORA_MAX_NB_BANDS 1 00229 00230 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff } 00231 #define BAND0 { 1, TX_POWER_17_DBM, 0, 0 } // 100.0 % 00232 00233 #elif defined( USE_BAND_780 ) 00234 00235 /*! 00236 * LoRaMac maximum number of channels 00237 */ 00238 #define LORA_MAX_NB_CHANNELS 16 00239 00240 /*! 00241 * Minimal datarate that can be used by the node 00242 */ 00243 #define LORAMAC_TX_MIN_DATARATE DR_0 00244 00245 /*! 00246 * Maximal datarate that can be used by the node 00247 */ 00248 #define LORAMAC_TX_MAX_DATARATE DR_7 00249 00250 /*! 00251 * Minimal datarate that can be used by the node 00252 */ 00253 #define LORAMAC_RX_MIN_DATARATE DR_0 00254 00255 /*! 00256 * Maximal datarate that can be used by the node 00257 */ 00258 #define LORAMAC_RX_MAX_DATARATE DR_7 00259 00260 /*! 00261 * Default datarate used by the node 00262 */ 00263 #define LORAMAC_DEFAULT_DATARATE DR_0 00264 00265 /*! 00266 * Minimal Rx1 receive datarate offset 00267 */ 00268 #define LORAMAC_MIN_RX1_DR_OFFSET 0 00269 00270 /*! 00271 * Maximal Rx1 receive datarate offset 00272 */ 00273 #define LORAMAC_MAX_RX1_DR_OFFSET 5 00274 00275 /*! 00276 * Minimal Tx output power that can be used by the node 00277 */ 00278 #define LORAMAC_MIN_TX_POWER TX_POWER_M5_DBM 00279 00280 /*! 00281 * Maximal Tx output power that can be used by the node 00282 */ 00283 #define LORAMAC_MAX_TX_POWER TX_POWER_10_DBM 00284 00285 /*! 00286 * Default Tx output power used by the node 00287 */ 00288 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_10_DBM 00289 00290 /*! 00291 * LoRaMac TxPower definition 00292 */ 00293 #define TX_POWER_10_DBM 0 00294 #define TX_POWER_07_DBM 1 00295 #define TX_POWER_04_DBM 2 00296 #define TX_POWER_01_DBM 3 00297 #define TX_POWER_M2_DBM 4 00298 #define TX_POWER_M5_DBM 5 00299 00300 /*! 00301 * LoRaMac datarates definition 00302 */ 00303 #define DR_0 0 // SF12 - BW125 00304 #define DR_1 1 // SF11 - BW125 00305 #define DR_2 2 // SF10 - BW125 00306 #define DR_3 3 // SF9 - BW125 00307 #define DR_4 4 // SF8 - BW125 00308 #define DR_5 5 // SF7 - BW125 00309 #define DR_6 6 // SF7 - BW250 00310 #define DR_7 7 // FSK 00311 00312 /*! 00313 * Verification of default datarate 00314 */ 00315 #if ( LORAMAC_DEFAULT_DATARATE > DR_5 ) 00316 #error "A default DR higher than DR_5 may lead to connectivity loss." 00317 #endif 00318 00319 /*! 00320 * Second reception window channel definition. 00321 */ 00322 // Channel = { Frequency [Hz], Datarate } 00323 #define RX_WND_2_CHANNEL { 786000000, DR_0 } 00324 00325 /*! 00326 * LoRaMac maximum number of bands 00327 */ 00328 #define LORA_MAX_NB_BANDS 1 00329 00330 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff } 00331 #define BAND0 { 100, TX_POWER_10_DBM, 0, 0 } // 1.0 % 00332 00333 /*! 00334 * LoRaMac default channels 00335 */ 00336 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band } 00337 #define LC1 { 779500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00338 #define LC2 { 779700000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00339 #define LC3 { 779900000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00340 00341 /*! 00342 * LoRaMac channels which are allowed for the join procedure 00343 */ 00344 #define JOIN_CHANNELS ( uint16_t )( LC( 1 ) | LC( 2 ) | LC( 3 ) ) 00345 00346 #elif defined( USE_BAND_868 ) 00347 00348 /*! 00349 * LoRaMac maximum number of channels 00350 */ 00351 #define LORA_MAX_NB_CHANNELS 16 00352 00353 /*! 00354 * Minimal datarate that can be used by the node 00355 */ 00356 #define LORAMAC_TX_MIN_DATARATE DR_0 00357 00358 /*! 00359 * Maximal datarate that can be used by the node 00360 */ 00361 #define LORAMAC_TX_MAX_DATARATE DR_7 00362 00363 /*! 00364 * Minimal datarate that can be used by the node 00365 */ 00366 #define LORAMAC_RX_MIN_DATARATE DR_0 00367 00368 /*! 00369 * Maximal datarate that can be used by the node 00370 */ 00371 #define LORAMAC_RX_MAX_DATARATE DR_7 00372 00373 /*! 00374 * Default datarate used by the node 00375 */ 00376 #define LORAMAC_DEFAULT_DATARATE DR_0 00377 00378 /*! 00379 * Minimal Rx1 receive datarate offset 00380 */ 00381 #define LORAMAC_MIN_RX1_DR_OFFSET 0 00382 00383 /*! 00384 * Maximal Rx1 receive datarate offset 00385 */ 00386 #define LORAMAC_MAX_RX1_DR_OFFSET 5 00387 00388 /*! 00389 * Minimal Tx output power that can be used by the node 00390 */ 00391 #define LORAMAC_MIN_TX_POWER TX_POWER_02_DBM 00392 00393 /*! 00394 * Maximal Tx output power that can be used by the node 00395 */ 00396 #define LORAMAC_MAX_TX_POWER TX_POWER_20_DBM 00397 00398 /*! 00399 * Default Tx output power used by the node 00400 */ 00401 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_14_DBM 00402 00403 /*! 00404 * LoRaMac TxPower definition 00405 */ 00406 #define TX_POWER_20_DBM 0 00407 #define TX_POWER_14_DBM 1 00408 #define TX_POWER_11_DBM 2 00409 #define TX_POWER_08_DBM 3 00410 #define TX_POWER_05_DBM 4 00411 #define TX_POWER_02_DBM 5 00412 00413 /*! 00414 * LoRaMac datarates definition 00415 */ 00416 #define DR_0 0 // SF12 - BW125 00417 #define DR_1 1 // SF11 - BW125 00418 #define DR_2 2 // SF10 - BW125 00419 #define DR_3 3 // SF9 - BW125 00420 #define DR_4 4 // SF8 - BW125 00421 #define DR_5 5 // SF7 - BW125 00422 #define DR_6 6 // SF7 - BW250 00423 #define DR_7 7 // FSK 00424 00425 /*! 00426 * Verification of default datarate 00427 */ 00428 #if ( LORAMAC_DEFAULT_DATARATE > DR_5 ) 00429 #error "A default DR higher than DR_5 may lead to connectivity loss." 00430 #endif 00431 00432 /*! 00433 * Second reception window channel definition. 00434 */ 00435 // Channel = { Frequency [Hz], Datarate } 00436 #define RX_WND_2_CHANNEL { 869525000, DR_0 } 00437 00438 /*! 00439 * LoRaMac maximum number of bands 00440 */ 00441 #define LORA_MAX_NB_BANDS 5 00442 00443 /*! 00444 * LoRaMac EU868 default bands 00445 */ 00446 typedef enum 00447 { 00448 BAND_G1_0, 00449 BAND_G1_1, 00450 BAND_G1_2, 00451 BAND_G1_3, 00452 BAND_G1_4, 00453 }BandId_t; 00454 00455 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff } 00456 #define BAND0 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 % 00457 #define BAND1 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 % 00458 #define BAND2 { 1000, TX_POWER_14_DBM, 0, 0 } // 0.1 % 00459 #define BAND3 { 10 , TX_POWER_14_DBM, 0, 0 } // 10.0 % 00460 #define BAND4 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 % 00461 00462 /*! 00463 * LoRaMac default channels 00464 */ 00465 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band } 00466 #define LC1 { 868100000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 } 00467 #define LC2 { 868300000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 } 00468 #define LC3 { 868500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 } 00469 00470 /*! 00471 * LoRaMac channels which are allowed for the join procedure 00472 */ 00473 #define JOIN_CHANNELS ( uint16_t )( LC( 1 ) | LC( 2 ) | LC( 3 ) ) 00474 00475 #elif defined( USE_BAND_915 ) || defined( USE_BAND_915_HYBRID ) 00476 00477 /*! 00478 * LoRaMac maximum number of channels 00479 */ 00480 #define LORA_MAX_NB_CHANNELS 72 00481 00482 /*! 00483 * Minimal datarate that can be used by the node 00484 */ 00485 #define LORAMAC_TX_MIN_DATARATE DR_0 00486 00487 /*! 00488 * Maximal datarate that can be used by the node 00489 */ 00490 #define LORAMAC_TX_MAX_DATARATE DR_4 00491 00492 /*! 00493 * Minimal datarate that can be used by the node 00494 */ 00495 #define LORAMAC_RX_MIN_DATARATE DR_8 00496 00497 /*! 00498 * Maximal datarate that can be used by the node 00499 */ 00500 #define LORAMAC_RX_MAX_DATARATE DR_13 00501 00502 /*! 00503 * Default datarate used by the node 00504 */ 00505 #define LORAMAC_DEFAULT_DATARATE DR_0 00506 00507 /*! 00508 * Minimal Rx1 receive datarate offset 00509 */ 00510 #define LORAMAC_MIN_RX1_DR_OFFSET 0 00511 00512 /*! 00513 * Maximal Rx1 receive datarate offset 00514 */ 00515 #define LORAMAC_MAX_RX1_DR_OFFSET 3 00516 00517 /*! 00518 * Minimal Tx output power that can be used by the node 00519 */ 00520 #define LORAMAC_MIN_TX_POWER TX_POWER_10_DBM 00521 00522 /*! 00523 * Maximal Tx output power that can be used by the node 00524 */ 00525 #define LORAMAC_MAX_TX_POWER TX_POWER_30_DBM 00526 00527 /*! 00528 * Default Tx output power used by the node 00529 */ 00530 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_20_DBM 00531 00532 /*! 00533 * LoRaMac TxPower definition 00534 */ 00535 #define TX_POWER_30_DBM 0 00536 #define TX_POWER_28_DBM 1 00537 #define TX_POWER_26_DBM 2 00538 #define TX_POWER_24_DBM 3 00539 #define TX_POWER_22_DBM 4 00540 #define TX_POWER_20_DBM 5 00541 #define TX_POWER_18_DBM 6 00542 #define TX_POWER_16_DBM 7 00543 #define TX_POWER_14_DBM 8 00544 #define TX_POWER_12_DBM 9 00545 #define TX_POWER_10_DBM 10 00546 00547 /*! 00548 * LoRaMac datarates definition 00549 */ 00550 #define DR_0 0 // SF10 - BW125 | 00551 #define DR_1 1 // SF9 - BW125 | 00552 #define DR_2 2 // SF8 - BW125 +-> Up link 00553 #define DR_3 3 // SF7 - BW125 | 00554 #define DR_4 4 // SF8 - BW500 | 00555 #define DR_5 5 // RFU 00556 #define DR_6 6 // RFU 00557 #define DR_7 7 // RFU 00558 #define DR_8 8 // SF12 - BW500 | 00559 #define DR_9 9 // SF11 - BW500 | 00560 #define DR_10 10 // SF10 - BW500 | 00561 #define DR_11 11 // SF9 - BW500 | 00562 #define DR_12 12 // SF8 - BW500 +-> Down link 00563 #define DR_13 13 // SF7 - BW500 | 00564 #define DR_14 14 // RFU | 00565 #define DR_15 15 // RFU | 00566 00567 /*! 00568 * Second reception window channel definition. 00569 */ 00570 // Channel = { Frequency [Hz], Datarate } 00571 #define RX_WND_2_CHANNEL { 923300000, DR_8 } 00572 00573 /*! 00574 * LoRaMac maximum number of bands 00575 */ 00576 #define LORA_MAX_NB_BANDS 1 00577 00578 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff } 00579 #define BAND0 { 1, TX_POWER_20_DBM, 0, 0 } // 100.0 % 00580 00581 /*! 00582 * LoRaMac default channels 00583 */ 00584 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band } 00585 /* 00586 * US band channels are initialized using a loop in LoRaMacInit function 00587 * \code 00588 * // 125 kHz channels 00589 * for( uint8_t i = 0; i < LORA_MAX_NB_CHANNELS - 8; i++ ) 00590 * { 00591 * Channels[i].Frequency = 902.3e6 + i * 200e3; 00592 * Channels[i].DrRange.Value = ( DR_3 << 4 ) | DR_0; 00593 * Channels[i].Band = 0; 00594 * } 00595 * // 500 kHz channels 00596 * for( uint8_t i = LORA_MAX_NB_CHANNELS - 8; i < LORA_MAX_NB_CHANNELS; i++ ) 00597 * { 00598 * Channels[i].Frequency = 903.0e6 + ( i - ( LORA_MAX_NB_CHANNELS - 8 ) ) * 1.6e6; 00599 * Channels[i].DrRange.Value = ( DR_4 << 4 ) | DR_4; 00600 * Channels[i].Band = 0; 00601 * } 00602 * \endcode 00603 */ 00604 #else 00605 #error "Please define a frequency band in the compiler options." 00606 #endif 00607 00608 #endif // __LORAMAC_BOARD_H__
Generated on Tue Jul 12 2022 19:00:53 by
