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.
Fork of LoRaWAN-lib by
LoRaMac-board.h
00001 /* 00002 / _____) _ | | 00003 ( (____ _____ ____ _| |_ _____ ____| |__ 00004 \____ \| ___ | (_ _) ___ |/ ___) _ \ 00005 _____) ) ____| | | || |_| ____( (___| | | | 00006 (______/|_____)_|_|_| \__)_____)\____)_| |_| 00007 (C)2013 Semtech 00008 00009 Description: LoRa MAC layer board dependent 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_MIN_DATARATE DR_0 00037 00038 /*! 00039 * Minimal datarate that can be used by the node 00040 */ 00041 #define LORAMAC_MAX_DATARATE DR_7 00042 00043 /*! 00044 * Default datarate used by the node 00045 */ 00046 #define LORAMAC_DEFAULT_DATARATE DR_0 00047 00048 /*! 00049 * Minimal Rx1 receive datarate offset 00050 */ 00051 #define LORAMAC_MIN_RX1_DR_OFFSET 0 00052 00053 /*! 00054 * Maximal Rx1 receive datarate offset 00055 */ 00056 #define LORAMAC_MAX_RX1_DR_OFFSET 5 00057 00058 /*! 00059 * Minimal Tx output power that can be used by the node 00060 */ 00061 #define LORAMAC_MIN_TX_POWER TX_POWER_M5_DBM 00062 00063 /*! 00064 * Minimal Tx output power that can be used by the node 00065 */ 00066 #define LORAMAC_MAX_TX_POWER TX_POWER_10_DBM 00067 00068 /*! 00069 * Default Tx output power used by the node 00070 */ 00071 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_10_DBM 00072 00073 /*! 00074 * LoRaMac TxPower definition 00075 */ 00076 #define TX_POWER_10_DBM 0 00077 #define TX_POWER_07_DBM 1 00078 #define TX_POWER_04_DBM 2 00079 #define TX_POWER_01_DBM 3 00080 #define TX_POWER_M2_DBM 4 00081 #define TX_POWER_M5_DBM 5 00082 00083 /*! 00084 * LoRaMac datarates definition 00085 */ 00086 #define DR_0 0 // SF12 - BW125 00087 #define DR_1 1 // SF11 - BW125 00088 #define DR_2 2 // SF10 - BW125 00089 #define DR_3 3 // SF9 - BW125 00090 #define DR_4 4 // SF8 - BW125 00091 #define DR_5 5 // SF7 - BW125 00092 #define DR_6 6 // SF7 - BW250 00093 #define DR_7 7 // FSK 00094 00095 /*! 00096 * Second reception window channel definition. 00097 */ 00098 // Channel = { Frequency [Hz], Datarate } 00099 #define RX_WND_2_CHANNEL { 434665000, DR_0 } 00100 00101 /*! 00102 * LoRaMac maximum number of bands 00103 */ 00104 #define LORA_MAX_NB_BANDS 1 00105 00106 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff } 00107 #define BAND0 { 100, TX_POWER_10_DBM, 0, 0 } // 1.0 % 00108 00109 /*! 00110 * LoRaMac default channels 00111 */ 00112 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band } 00113 #define LC1 { 433175000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00114 #define LC2 { 433375000, { ( ( DR_7 << 4 ) | DR_0 ) }, 0 } 00115 #define LC3 { 433575000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00116 00117 #elif defined( USE_BAND_780 ) 00118 00119 /*! 00120 * LoRaMac maximum number of channels 00121 */ 00122 #define LORA_MAX_NB_CHANNELS 16 00123 00124 /*! 00125 * Minimal datarate that can be used by the node 00126 */ 00127 #define LORAMAC_MIN_DATARATE DR_0 00128 00129 /*! 00130 * Minimal datarate that can be used by the node 00131 */ 00132 #define LORAMAC_MAX_DATARATE DR_7 00133 00134 /*! 00135 * Default datarate used by the node 00136 */ 00137 #define LORAMAC_DEFAULT_DATARATE DR_0 00138 00139 /*! 00140 * Minimal Rx1 receive datarate offset 00141 */ 00142 #define LORAMAC_MIN_RX1_DR_OFFSET 0 00143 00144 /*! 00145 * Maximal Rx1 receive datarate offset 00146 */ 00147 #define LORAMAC_MAX_RX1_DR_OFFSET 5 00148 00149 /*! 00150 * Minimal Tx output power that can be used by the node 00151 */ 00152 #define LORAMAC_MIN_TX_POWER TX_POWER_M5_DBM 00153 00154 /*! 00155 * Minimal Tx output power that can be used by the node 00156 */ 00157 #define LORAMAC_MAX_TX_POWER TX_POWER_10_DBM 00158 00159 /*! 00160 * Default Tx output power used by the node 00161 */ 00162 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_10_DBM 00163 00164 /*! 00165 * LoRaMac TxPower definition 00166 */ 00167 #define TX_POWER_10_DBM 0 00168 #define TX_POWER_07_DBM 1 00169 #define TX_POWER_04_DBM 2 00170 #define TX_POWER_01_DBM 3 00171 #define TX_POWER_M2_DBM 4 00172 #define TX_POWER_M5_DBM 5 00173 00174 /*! 00175 * LoRaMac datarates definition 00176 */ 00177 #define DR_0 0 // SF12 - BW125 00178 #define DR_1 1 // SF11 - BW125 00179 #define DR_2 2 // SF10 - BW125 00180 #define DR_3 3 // SF9 - BW125 00181 #define DR_4 4 // SF8 - BW125 00182 #define DR_5 5 // SF7 - BW125 00183 #define DR_6 6 // SF7 - BW250 00184 #define DR_7 7 // FSK 00185 00186 /*! 00187 * Second reception window channel definition. 00188 */ 00189 // Channel = { Frequency [Hz], Datarate } 00190 #define RX_WND_2_CHANNEL { 786000000, DR_0 } 00191 00192 /*! 00193 * LoRaMac maximum number of bands 00194 */ 00195 #define LORA_MAX_NB_BANDS 1 00196 00197 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff } 00198 #define BAND0 { 100, TX_POWER_10_DBM, 0, 0 } // 1.0 % 00199 00200 /*! 00201 * LoRaMac default channels 00202 */ 00203 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band } 00204 #define LC1 { 779500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00205 #define LC2 { 779700000, { ( ( DR_7 << 4 ) | DR_0 ) }, 0 } 00206 #define LC3 { 779900000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00207 00208 /************************************************************************************/ 00209 /******** India Frequency Declaration Start **********/ 00210 /******** Added by: Sachin Pukale | 31.03.2016 **********/ 00211 /************************************************************************************/ 00212 #elif defined( USE_BAND_865 ) 00213 00214 /*! 00215 * LoRaMac maximum number of channels 00216 */ 00217 #define LORA_MAX_NB_CHANNELS 8 //SP: For 868 band it is 16 00218 00219 /*! 00220 * Minimal datarate that can be used by the node 00221 */ 00222 #define LORAMAC_MIN_DATARATE DR_0 00223 00224 /*! 00225 * Minimal datarate that can be used by the node 00226 */ 00227 #define LORAMAC_MAX_DATARATE DR_7 00228 00229 /*! 00230 * Default datarate used by the node 00231 */ 00232 #define LORAMAC_DEFAULT_DATARATE DR_0 00233 00234 /*! 00235 * Minimal Rx1 receive datarate offset 00236 */ 00237 #define LORAMAC_MIN_RX1_DR_OFFSET 0 00238 00239 /*! 00240 * Maximal Rx1 receive datarate offset 00241 */ 00242 #define LORAMAC_MAX_RX1_DR_OFFSET 5 00243 00244 /*! 00245 * LoRaMac TxPower definition 00246 */ 00247 //#define TC_POWER_27_DBM 0 //SP:Added support for 27dBM channel(Power = 500mW) 00248 //#define TX_POWER_20_DBM 0 00249 //#define TX_POWER_14_DBM 1 00250 //#define TX_POWER_11_DBM 2 //Dropped by Akshay for DSPLoRa Module 00251 #define TX_POWER_08_DBM 3 00252 #define TX_POWER_05_DBM 4 00253 #define TX_POWER_02_DBM 5 00254 00255 /*! 00256 * Minimal Tx output power that can be used by the node 00257 */ 00258 #define LORAMAC_MIN_TX_POWER TX_POWER_02_DBM 00259 00260 /*! 00261 * Minimal Tx output power that can be used by the node 00262 */ 00263 //#define LORAMAC_MAX_TX_POWER TX_POWER_20_DBM 00264 #define LORAMAC_MAX_TX_POWER TX_POWER_08_DBM 00265 00266 /*! 00267 * Default Tx output power used by the node 00268 */ 00269 //#define LORAMAC_DEFAULT_TX_POWER TX_POWER_20_DBM 00270 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_08_DBM 00271 00272 /*! 00273 * LoRaMac datarates definition 00274 */ 00275 #define DR_0 0 // SF12 - BW125 00276 #define DR_1 1 // SF11 - BW125 00277 #define DR_2 2 // SF10 - BW125 00278 #define DR_3 3 // SF9 - BW125 00279 #define DR_4 4 // SF8 - BW125 00280 #define DR_5 5 // SF7 - BW125 00281 #define DR_6 6 // SF7 - BW250 00282 #define DR_7 7 // FSK 00283 00284 /*! 00285 * Second reception window channel definition. 00286 */ 00287 // Channel = { Frequency [Hz], Datarate } 00288 #define RX_WND_2_CHANNEL { 866550000, DR_4 } //SP:Default Rate at SF8 for India 00289 00290 /*! 00291 * LoRaMac maximum number of bands 00292 */ 00293 #define LORA_MAX_NB_BANDS 1 //5 00294 00295 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff } 00296 //#define BAND0 { 100 , TX_POWER_20_DBM, 0, 0 } // 1.0 % 00297 #define BAND0 { 100 , TX_POWER_08_DBM, 0, 0 } // 1.0 % 00298 00299 /*! 00300 * LoRaMac default channels 00301 */ 00302 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band } 00303 #define LC1 { 865062500, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00304 #define LC2 { 865402500, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00305 #define LC3 { 865985000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00306 /************************************************************************************/ 00307 /******** India Frequency Declaration End **********/ 00308 /************************************************************************************/ 00309 00310 #elif defined( USE_BAND_868 ) 00311 00312 /*! 00313 * LoRaMac maximum number of channels 00314 */ 00315 #define LORA_MAX_NB_CHANNELS 16 00316 00317 /*! 00318 * Minimal datarate that can be used by the node 00319 */ 00320 #define LORAMAC_MIN_DATARATE DR_0 00321 00322 /*! 00323 * Minimal datarate that can be used by the node 00324 */ 00325 #define LORAMAC_MAX_DATARATE DR_7 00326 00327 /*! 00328 * Default datarate used by the node 00329 */ 00330 #define LORAMAC_DEFAULT_DATARATE DR_0 00331 00332 /*! 00333 * Minimal Rx1 receive datarate offset 00334 */ 00335 #define LORAMAC_MIN_RX1_DR_OFFSET 0 00336 00337 /*! 00338 * Maximal Rx1 receive datarate offset 00339 */ 00340 #define LORAMAC_MAX_RX1_DR_OFFSET 5 00341 00342 /*! 00343 * Minimal Tx output power that can be used by the node 00344 */ 00345 #define LORAMAC_MIN_TX_POWER TX_POWER_02_DBM 00346 00347 /*! 00348 * Minimal Tx output power that can be used by the node 00349 */ 00350 #define LORAMAC_MAX_TX_POWER TX_POWER_20_DBM 00351 00352 /*! 00353 * Default Tx output power used by the node 00354 */ 00355 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_14_DBM 00356 00357 /*! 00358 * LoRaMac TxPower definition 00359 */ 00360 #define TX_POWER_20_DBM 0 00361 #define TX_POWER_14_DBM 1 00362 #define TX_POWER_11_DBM 2 00363 #define TX_POWER_08_DBM 3 00364 #define TX_POWER_05_DBM 4 00365 #define TX_POWER_02_DBM 5 00366 00367 /*! 00368 * LoRaMac datarates definition 00369 */ 00370 #define DR_0 0 // SF12 - BW125 00371 #define DR_1 1 // SF11 - BW125 00372 #define DR_2 2 // SF10 - BW125 00373 #define DR_3 3 // SF9 - BW125 00374 #define DR_4 4 // SF8 - BW125 00375 #define DR_5 5 // SF7 - BW125 00376 #define DR_6 6 // SF7 - BW250 00377 #define DR_7 7 // FSK 00378 00379 /*! 00380 * Second reception window channel definition. 00381 */ 00382 // Channel = { Frequency [Hz], Datarate } 00383 #define RX_WND_2_CHANNEL { 869525000, DR_0 } 00384 00385 /*! 00386 * LoRaMac maximum number of bands 00387 */ 00388 #define LORA_MAX_NB_BANDS 5 00389 00390 /*! 00391 * LoRaMac EU868 default bands 00392 */ 00393 typedef enum 00394 { 00395 BAND_G1_0, 00396 BAND_G1_1, 00397 BAND_G1_2, 00398 BAND_G1_3, 00399 BAND_G1_4, 00400 }BandId_t; 00401 00402 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff } 00403 #define BAND0 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 % 00404 #define BAND1 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 % 00405 #define BAND2 { 1000, TX_POWER_14_DBM, 0, 0 } // 0.1 % 00406 #define BAND3 { 10 , TX_POWER_14_DBM, 0, 0 } // 10.0 % 00407 #define BAND4 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 % 00408 00409 /*! 00410 * LoRaMac default channels 00411 */ 00412 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band } 00413 #define LC1 { 868100000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 } 00414 #define LC2 { 868300000, { ( ( DR_6 << 4 ) | DR_0 ) }, 1 } 00415 #define LC3 { 868500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 } 00416 00417 #elif defined( USE_BAND_915 ) || defined( USE_BAND_915_HYBRID ) 00418 00419 /*! 00420 * LoRaMac maximum number of channels 00421 */ 00422 #define LORA_MAX_NB_CHANNELS 72 00423 00424 /*! 00425 * Minimal datarate that can be used by the node 00426 */ 00427 #define LORAMAC_MIN_DATARATE DR_0 00428 00429 /*! 00430 * Minimal datarate that can be used by the node 00431 */ 00432 #define LORAMAC_MAX_DATARATE DR_4 00433 00434 /*! 00435 * Default datarate used by the node 00436 */ 00437 #define LORAMAC_DEFAULT_DATARATE DR_0 00438 00439 /*! 00440 * Minimal Rx1 receive datarate offset 00441 */ 00442 #define LORAMAC_MIN_RX1_DR_OFFSET 0 00443 00444 /*! 00445 * Maximal Rx1 receive datarate offset 00446 */ 00447 #define LORAMAC_MAX_RX1_DR_OFFSET 3 00448 00449 /*! 00450 * Minimal Tx output power that can be used by the node 00451 */ 00452 #define LORAMAC_MIN_TX_POWER TX_POWER_10_DBM 00453 00454 /*! 00455 * Minimal Tx output power that can be used by the node 00456 */ 00457 #define LORAMAC_MAX_TX_POWER TX_POWER_30_DBM 00458 00459 /*! 00460 * Default Tx output power used by the node 00461 */ 00462 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_20_DBM 00463 00464 /*! 00465 * LoRaMac TxPower definition 00466 */ 00467 #define TX_POWER_30_DBM 0 00468 #define TX_POWER_28_DBM 1 00469 #define TX_POWER_26_DBM 2 00470 #define TX_POWER_24_DBM 3 00471 #define TX_POWER_22_DBM 4 00472 #define TX_POWER_20_DBM 5 00473 #define TX_POWER_18_DBM 6 00474 #define TX_POWER_16_DBM 7 00475 #define TX_POWER_14_DBM 8 00476 #define TX_POWER_12_DBM 9 00477 #define TX_POWER_10_DBM 10 00478 00479 /*! 00480 * LoRaMac datarates definition 00481 */ 00482 #define DR_0 0 // SF10 - BW125 | 00483 #define DR_1 1 // SF9 - BW125 | 00484 #define DR_2 2 // SF8 - BW125 +-> Up link 00485 #define DR_3 3 // SF7 - BW125 | 00486 #define DR_4 4 // SF8 - BW500 | 00487 #define DR_5 5 // RFU 00488 #define DR_6 6 // RFU 00489 #define DR_7 7 // RFU 00490 #define DR_8 8 // SF12 - BW500 | 00491 #define DR_9 9 // SF11 - BW500 | 00492 #define DR_10 10 // SF10 - BW500 | 00493 #define DR_11 11 // SF9 - BW500 | 00494 #define DR_12 12 // SF8 - BW500 +-> Down link 00495 #define DR_13 13 // SF7 - BW500 | 00496 #define DR_14 14 // RFU | 00497 #define DR_15 15 // RFU | 00498 00499 /*! 00500 * Second reception window channel definition. 00501 */ 00502 // Channel = { Frequency [Hz], Datarate } 00503 #define RX_WND_2_CHANNEL { 923300000, DR_8 } 00504 00505 /*! 00506 * LoRaMac maximum number of bands 00507 */ 00508 #define LORA_MAX_NB_BANDS 1 00509 00510 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff } 00511 #define BAND0 { 1, TX_POWER_20_DBM, 0, 0 } // 100.0 % 00512 00513 /*! 00514 * LoRaMac default channels 00515 */ 00516 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band } 00517 /* 00518 * US band channels are initialized using a loop in LoRaMacInit function 00519 * \code 00520 * // 125 kHz channels 00521 * for( uint8_t i = 0; i < LORA_MAX_NB_CHANNELS - 8; i++ ) 00522 * { 00523 * Channels[i].Frequency = 902.3e6 + i * 200e3; 00524 * Channels[i].DrRange.Value = ( DR_3 << 4 ) | DR_0; 00525 * Channels[i].Band = 0; 00526 * } 00527 * // 500 kHz channels 00528 * for( uint8_t i = LORA_MAX_NB_CHANNELS - 8; i < LORA_MAX_NB_CHANNELS; i++ ) 00529 * { 00530 * Channels[i].Frequency = 903.0e6 + ( i - ( LORA_MAX_NB_CHANNELS - 8 ) ) * 1.6e6; 00531 * Channels[i].DrRange.Value = ( DR_4 << 4 ) | DR_4; 00532 * Channels[i].Band = 0; 00533 * } 00534 * \endcode 00535 */ 00536 #else 00537 #error "Please define a frequency band in the compiler options." 00538 #endif 00539 00540 #endif // __LORAMAC_BOARD_H__
Generated on Tue Jul 12 2022 21:21:12 by
1.7.2
