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-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 #warning temproray set define USE_BAND_868 00020 #define USE_BAND_868 00021 /*! 00022 * Returns individual channel mask 00023 * 00024 * \param[IN] channelIndex Channel index 1 based 00025 * \retval channelMask 00026 */ 00027 #define LC( channelIndex ) ( uint16_t )( 1 << ( channelIndex - 1 ) ) 00028 00029 #if defined( USE_BAND_433 ) 00030 00031 /*! 00032 * LoRaMac maximum number of channels 00033 */ 00034 #define LORA_MAX_NB_CHANNELS 16 00035 00036 /*! 00037 * Minimal datarate that can be used by the node 00038 */ 00039 #define LORAMAC_MIN_DATARATE DR_0 00040 00041 /*! 00042 * Minimal datarate that can be used by the node 00043 */ 00044 #define LORAMAC_MAX_DATARATE DR_7 00045 00046 /*! 00047 * Default datarate used by the node 00048 */ 00049 #define LORAMAC_DEFAULT_DATARATE DR_0 00050 00051 /*! 00052 * Minimal Rx1 receive datarate offset 00053 */ 00054 #define LORAMAC_MIN_RX1_DR_OFFSET 0 00055 00056 /*! 00057 * Maximal Rx1 receive datarate offset 00058 */ 00059 #define LORAMAC_MAX_RX1_DR_OFFSET 5 00060 00061 /*! 00062 * Minimal Tx output power that can be used by the node 00063 */ 00064 #define LORAMAC_MIN_TX_POWER TX_POWER_M5_DBM 00065 00066 /*! 00067 * Minimal Tx output power that can be used by the node 00068 */ 00069 #define LORAMAC_MAX_TX_POWER TX_POWER_10_DBM 00070 00071 /*! 00072 * Default Tx output power used by the node 00073 */ 00074 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_10_DBM 00075 00076 /*! 00077 * LoRaMac TxPower definition 00078 */ 00079 #define TX_POWER_10_DBM 0 00080 #define TX_POWER_07_DBM 1 00081 #define TX_POWER_04_DBM 2 00082 #define TX_POWER_01_DBM 3 00083 #define TX_POWER_M2_DBM 4 00084 #define TX_POWER_M5_DBM 5 00085 00086 /*! 00087 * LoRaMac datarates definition 00088 */ 00089 #define DR_0 0 // SF12 - BW125 00090 #define DR_1 1 // SF11 - BW125 00091 #define DR_2 2 // SF10 - BW125 00092 #define DR_3 3 // SF9 - BW125 00093 #define DR_4 4 // SF8 - BW125 00094 #define DR_5 5 // SF7 - BW125 00095 #define DR_6 6 // SF7 - BW250 00096 #define DR_7 7 // FSK 00097 00098 /*! 00099 * Second reception window channel definition. 00100 */ 00101 // Channel = { Frequency [Hz], Datarate } 00102 #define RX_WND_2_CHANNEL { 434665000, DR_0 } 00103 00104 /*! 00105 * LoRaMac maximum number of bands 00106 */ 00107 #define LORA_MAX_NB_BANDS 1 00108 00109 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff } 00110 #define BAND0 { 100, TX_POWER_10_DBM, 0, 0 } // 1.0 % 00111 00112 /*! 00113 * LoRaMac default channels 00114 */ 00115 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band } 00116 #define LC1 { 433175000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00117 #define LC2 { 433375000, { ( ( DR_7 << 4 ) | DR_0 ) }, 0 } 00118 #define LC3 { 433575000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00119 00120 #elif defined( USE_BAND_780 ) 00121 00122 /*! 00123 * LoRaMac maximum number of channels 00124 */ 00125 #define LORA_MAX_NB_CHANNELS 16 00126 00127 /*! 00128 * Minimal datarate that can be used by the node 00129 */ 00130 #define LORAMAC_MIN_DATARATE DR_0 00131 00132 /*! 00133 * Minimal datarate that can be used by the node 00134 */ 00135 #define LORAMAC_MAX_DATARATE DR_7 00136 00137 /*! 00138 * Default datarate used by the node 00139 */ 00140 #define LORAMAC_DEFAULT_DATARATE DR_0 00141 00142 /*! 00143 * Minimal Rx1 receive datarate offset 00144 */ 00145 #define LORAMAC_MIN_RX1_DR_OFFSET 0 00146 00147 /*! 00148 * Maximal Rx1 receive datarate offset 00149 */ 00150 #define LORAMAC_MAX_RX1_DR_OFFSET 5 00151 00152 /*! 00153 * Minimal Tx output power that can be used by the node 00154 */ 00155 #define LORAMAC_MIN_TX_POWER TX_POWER_M5_DBM 00156 00157 /*! 00158 * Minimal Tx output power that can be used by the node 00159 */ 00160 #define LORAMAC_MAX_TX_POWER TX_POWER_10_DBM 00161 00162 /*! 00163 * Default Tx output power used by the node 00164 */ 00165 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_10_DBM 00166 00167 /*! 00168 * LoRaMac TxPower definition 00169 */ 00170 #define TX_POWER_10_DBM 0 00171 #define TX_POWER_07_DBM 1 00172 #define TX_POWER_04_DBM 2 00173 #define TX_POWER_01_DBM 3 00174 #define TX_POWER_M2_DBM 4 00175 #define TX_POWER_M5_DBM 5 00176 00177 /*! 00178 * LoRaMac datarates definition 00179 */ 00180 #define DR_0 0 // SF12 - BW125 00181 #define DR_1 1 // SF11 - BW125 00182 #define DR_2 2 // SF10 - BW125 00183 #define DR_3 3 // SF9 - BW125 00184 #define DR_4 4 // SF8 - BW125 00185 #define DR_5 5 // SF7 - BW125 00186 #define DR_6 6 // SF7 - BW250 00187 #define DR_7 7 // FSK 00188 00189 /*! 00190 * Second reception window channel definition. 00191 */ 00192 // Channel = { Frequency [Hz], Datarate } 00193 #define RX_WND_2_CHANNEL { 786000000, DR_0 } 00194 00195 /*! 00196 * LoRaMac maximum number of bands 00197 */ 00198 #define LORA_MAX_NB_BANDS 1 00199 00200 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff } 00201 #define BAND0 { 100, TX_POWER_10_DBM, 0, 0 } // 1.0 % 00202 00203 /*! 00204 * LoRaMac default channels 00205 */ 00206 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band } 00207 #define LC1 { 779500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00208 #define LC2 { 779700000, { ( ( DR_7 << 4 ) | DR_0 ) }, 0 } 00209 #define LC3 { 779900000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00210 00211 #elif defined( USE_BAND_868 ) 00212 00213 /*! 00214 * LoRaMac maximum number of channels 00215 */ 00216 #define LORA_MAX_NB_CHANNELS 16 00217 00218 /*! 00219 * Minimal datarate that can be used by the node 00220 */ 00221 #define LORAMAC_MIN_DATARATE DR_0 00222 00223 /*! 00224 * Minimal datarate that can be used by the node 00225 */ 00226 #define LORAMAC_MAX_DATARATE DR_7 00227 00228 /*! 00229 * Default datarate used by the node 00230 */ 00231 #define LORAMAC_DEFAULT_DATARATE DR_0 00232 00233 /*! 00234 * Minimal Rx1 receive datarate offset 00235 */ 00236 #define LORAMAC_MIN_RX1_DR_OFFSET 0 00237 00238 /*! 00239 * Maximal Rx1 receive datarate offset 00240 */ 00241 #define LORAMAC_MAX_RX1_DR_OFFSET 5 00242 00243 /*! 00244 * Minimal Tx output power that can be used by the node 00245 */ 00246 #define LORAMAC_MIN_TX_POWER TX_POWER_02_DBM 00247 00248 /*! 00249 * Minimal Tx output power that can be used by the node 00250 */ 00251 #define LORAMAC_MAX_TX_POWER TX_POWER_20_DBM 00252 00253 /*! 00254 * Default Tx output power used by the node 00255 */ 00256 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_14_DBM 00257 00258 /*! 00259 * LoRaMac TxPower definition 00260 */ 00261 #define TX_POWER_20_DBM 0 00262 #define TX_POWER_14_DBM 1 00263 #define TX_POWER_11_DBM 2 00264 #define TX_POWER_08_DBM 3 00265 #define TX_POWER_05_DBM 4 00266 #define TX_POWER_02_DBM 5 00267 00268 /*! 00269 * LoRaMac datarates definition 00270 */ 00271 #define DR_0 0 // SF12 - BW125 00272 #define DR_1 1 // SF11 - BW125 00273 #define DR_2 2 // SF10 - BW125 00274 #define DR_3 3 // SF9 - BW125 00275 #define DR_4 4 // SF8 - BW125 00276 #define DR_5 5 // SF7 - BW125 00277 #define DR_6 6 // SF7 - BW250 00278 #define DR_7 7 // FSK 00279 00280 /*! 00281 * Second reception window channel definition. 00282 */ 00283 // Channel = { Frequency [Hz], Datarate } 00284 #define RX_WND_2_CHANNEL { 869525000, DR_0 } 00285 00286 /*! 00287 * LoRaMac maximum number of bands 00288 */ 00289 #define LORA_MAX_NB_BANDS 5 00290 00291 /*! 00292 * LoRaMac EU868 default bands 00293 */ 00294 typedef enum 00295 { 00296 BAND_G1_0, 00297 BAND_G1_1, 00298 BAND_G1_2, 00299 BAND_G1_3, 00300 BAND_G1_4, 00301 }BandId_t; 00302 00303 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff } 00304 #define BAND0 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 % 00305 #define BAND1 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 % 00306 #define BAND2 { 1000, TX_POWER_14_DBM, 0, 0 } // 0.1 % 00307 #define BAND3 { 10 , TX_POWER_14_DBM, 0, 0 } // 10.0 % 00308 #define BAND4 { 100 , TX_POWER_14_DBM, 0, 0 } // 1.0 % 00309 00310 /*! 00311 * LoRaMac default channels 00312 */ 00313 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band } 00314 #define LC1 { 868100000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 } 00315 #define LC2 { 868300000, { ( ( DR_6 << 4 ) | DR_0 ) }, 1 } 00316 #define LC3 { 868500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 1 } 00317 #define LC4 { 867100000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00318 #define LC5 { 867300000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00319 #define LC6 { 867500000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00320 #define LC7 { 867700000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00321 #define LC8 { 867900000, { ( ( DR_5 << 4 ) | DR_0 ) }, 0 } 00322 #define LC9 { 868800000, { ( ( DR_7 << 4 ) | DR_7 ) }, 2 } 00323 00324 #elif defined( USE_BAND_915 ) || defined( USE_BAND_915_HYBRID ) 00325 00326 /*! 00327 * LoRaMac maximum number of channels 00328 */ 00329 #define LORA_MAX_NB_CHANNELS 72 00330 00331 /*! 00332 * Minimal datarate that can be used by the node 00333 */ 00334 #define LORAMAC_MIN_DATARATE DR_0 00335 00336 /*! 00337 * Minimal datarate that can be used by the node 00338 */ 00339 #define LORAMAC_MAX_DATARATE DR_4 00340 00341 /*! 00342 * Default datarate used by the node 00343 */ 00344 #define LORAMAC_DEFAULT_DATARATE DR_0 00345 00346 /*! 00347 * Minimal Rx1 receive datarate offset 00348 */ 00349 #define LORAMAC_MIN_RX1_DR_OFFSET 0 00350 00351 /*! 00352 * Maximal Rx1 receive datarate offset 00353 */ 00354 #define LORAMAC_MAX_RX1_DR_OFFSET 3 00355 00356 /*! 00357 * Minimal Tx output power that can be used by the node 00358 */ 00359 #define LORAMAC_MIN_TX_POWER TX_POWER_10_DBM 00360 00361 /*! 00362 * Minimal Tx output power that can be used by the node 00363 */ 00364 #define LORAMAC_MAX_TX_POWER TX_POWER_30_DBM 00365 00366 /*! 00367 * Default Tx output power used by the node 00368 */ 00369 #define LORAMAC_DEFAULT_TX_POWER TX_POWER_20_DBM 00370 00371 /*! 00372 * LoRaMac TxPower definition 00373 */ 00374 #define TX_POWER_30_DBM 0 00375 #define TX_POWER_28_DBM 1 00376 #define TX_POWER_26_DBM 2 00377 #define TX_POWER_24_DBM 3 00378 #define TX_POWER_22_DBM 4 00379 #define TX_POWER_20_DBM 5 00380 #define TX_POWER_18_DBM 6 00381 #define TX_POWER_16_DBM 7 00382 #define TX_POWER_14_DBM 8 00383 #define TX_POWER_12_DBM 9 00384 #define TX_POWER_10_DBM 10 00385 00386 /*! 00387 * LoRaMac datarates definition 00388 */ 00389 #define DR_0 0 // SF10 - BW125 | 00390 #define DR_1 1 // SF9 - BW125 | 00391 #define DR_2 2 // SF8 - BW125 +-> Up link 00392 #define DR_3 3 // SF7 - BW125 | 00393 #define DR_4 4 // SF8 - BW500 | 00394 #define DR_5 5 // RFU 00395 #define DR_6 6 // RFU 00396 #define DR_7 7 // RFU 00397 #define DR_8 8 // SF12 - BW500 | 00398 #define DR_9 9 // SF11 - BW500 | 00399 #define DR_10 10 // SF10 - BW500 | 00400 #define DR_11 11 // SF9 - BW500 | 00401 #define DR_12 12 // SF8 - BW500 +-> Down link 00402 #define DR_13 13 // SF7 - BW500 | 00403 #define DR_14 14 // RFU | 00404 #define DR_15 15 // RFU | 00405 00406 /*! 00407 * Second reception window channel definition. 00408 */ 00409 // Channel = { Frequency [Hz], Datarate } 00410 #define RX_WND_2_CHANNEL { 923300000, DR_8 } 00411 00412 /*! 00413 * LoRaMac maximum number of bands 00414 */ 00415 #define LORA_MAX_NB_BANDS 1 00416 00417 // Band = { DutyCycle, TxMaxPower, LastTxDoneTime, TimeOff } 00418 #define BAND0 { 1, TX_POWER_20_DBM, 0, 0 } // 100.0 % 00419 00420 /*! 00421 * LoRaMac default channels 00422 */ 00423 // Channel = { Frequency [Hz], { ( ( DrMax << 4 ) | DrMin ) }, Band } 00424 /* 00425 * US band channels are initialized using a loop in LoRaMacInit function 00426 * \code 00427 * // 125 kHz channels 00428 * for( uint8_t i = 0; i < LORA_MAX_NB_CHANNELS - 8; i++ ) 00429 * { 00430 * Channels[i].Frequency = 902.3e6 + i * 200e3; 00431 * Channels[i].DrRange.Value = ( DR_3 << 4 ) | DR_0; 00432 * Channels[i].Band = 0; 00433 * } 00434 * // 500 kHz channels 00435 * for( uint8_t i = LORA_MAX_NB_CHANNELS - 8; i < LORA_MAX_NB_CHANNELS; i++ ) 00436 * { 00437 * Channels[i].Frequency = 903.0e6 + ( i - ( LORA_MAX_NB_CHANNELS - 8 ) ) * 1.6e6; 00438 * Channels[i].DrRange.Value = ( DR_4 << 4 ) | DR_4; 00439 * Channels[i].Band = 0; 00440 * } 00441 * \endcode 00442 */ 00443 #else 00444 #error "Please define a frequency band in the compiler options." 00445 #endif 00446 00447 #endif // __LORAMAC_BOARD_H__
Generated on Wed Jul 13 2022 23:48:00 by
1.7.2