Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.94 KB | None | 0 0
  1. # LoRaWAN 1.1
  2.  
  3. ## Message Format
  4.  
  5. ### Radio PHY Layer
  6.  
  7. * Preamble
  8. - LoRa modulation: sync word (8 symbols)
  9. - Public networks: `0x34`
  10. - Private networks: `0x12`
  11. - FSK modulation: sync word `0xC194C1` (3 bytes)
  12. * PHDR - physical header (FEC coding rate 4/8)
  13. - Payload length
  14. - Payload FEC coding rate (4/5, 4/6, 4/7, 4/8)
  15. - Payload CRC on/off
  16. * PHDR_CRC - CRC of physical header
  17. * PHYPayload - physical payload
  18. * CRC - physical payload CRC (only in uplink messages)
  19.  
  20. ### LoRaWAN - PHYPayload
  21.  
  22. * MHDR: MAC header (1 byte)
  23. - MType: message type and payload format (3 bits)
  24. - `000` JoinRequest
  25. - `001` JoinAccept
  26. - `010` MACPayload - uplink - unconfirmed
  27. - `011` MACPayload - downlink - unconfirmed
  28. - `100` MACPayload - uplink - confirmed
  29. - `101` MACPayload - downlink - confirmed
  30. - `110` RejoinRequest
  31. - `111` Proprietary (usually just dropped)
  32. - Reserved (2 bits)
  33. - Major: LoRaWAN version (currently `00` - LoRaWAN R1) (2 bits)
  34. * Payload: Payload as indicated by MType (JoinRequest, JoinAccept, MACPayload, RejoinRequest)
  35. * MIC: Message Integrity Code (in JoinAccept the MIC is in the Payload) (4 bytes)
  36. - Uplink: with DevAddr, FCnt, SNwkSIntKey, FNwkSIntKey, FCnt of confirmed downlink (if Ack), DataRate, Channel
  37. - Downlink: with DevAddr, FCnt, SNwkSIntKey, FCnt of confirmed uplink (if Ack)
  38.  
  39. ### LoRaWAN - MACPayload
  40.  
  41. Maximum total length: region-specific
  42.  
  43. * FHDR:
  44. * DevAddr (4 bytes)
  45. * FCtrl (1 byte)
  46. * ADR (1 bit)
  47. * ADRACKReq (uplink only; 1 bit)
  48. * ACK (1 bit)
  49. - See **Confirmed messages**
  50. * FPending (downlink only; 1 bit)
  51. - Device responds with uplink only once
  52. * ClassB (uplink only; 1 bit)
  53. - Indicates that device is in Class B mode
  54. * FOptsLen (4 bits)
  55. * FCnt (2 bytes)
  56. - strictly increasing until next JoinAccept
  57. - FCntUp (incr on each uplink)
  58. - NFCntDown (LoRaWAN 1.1; incr on each downlink where FPort == 0)
  59. - AFCntDown (LoRaWAN 1.1; incr on each downlink where FPort != 0)
  60. - Full width: 32 bits; packet contains 16 lsb
  61. - FCnt are reset to 0 on JoinAccept; ABP devices never reset
  62. * FOpts - optional
  63. - If present, FPort can not be 0
  64. - If present, MAC commands can not be in payload
  65. - Encrypted; MIC is calculated after encryption
  66. - with NwkSEncKey
  67. * FPort - optional
  68. - Must be present if FRMPayload present
  69. - FPort 0 means that FRMPayload contains only MAC commands
  70. - FPort 1..223 is application payload
  71. - FPort 224 is test protocol
  72. - Any other FPort should not be transmitted
  73. * FRMPayload - optional
  74. - Encrypted; MIC is calculated after encryption
  75. - FPort 0: with NwkSEncKey
  76. - Other: with AppSKey
  77.  
  78. ### LoRaWAN - JoinRequest
  79.  
  80. * JoinEUI
  81. * DevEUI
  82. * DevNonce
  83. - strictly increasing, can only be reset when JoinEUI or NwkKey and AppKey changed
  84. - device and server keep track of latest
  85.  
  86. ### LoRaWAN - JoinAccept
  87.  
  88. * JoinNonce
  89. - strictly increasing, can only be reset when JoinEUI or NwkKey and AppKey changed
  90. - device and server keep track of latest
  91. * Home_NetID
  92. * DevAddr
  93. * DLSettings
  94. * OptNeg
  95. - 0 indicates LoRaWAN 1.0
  96. - 1 indicates LoRaWAN 1.1 or later
  97. * RX1DROffset
  98. * RX2DR
  99. * RxDelay
  100. * CFList (optional)
  101. * CFListType (optional)
  102.  
  103. ### LoRaWAN - RejoinRequest
  104.  
  105. * DevEUI
  106. * NetID (type 0+2)
  107. * JoinEUI (type 1)
  108. * RJCount0 (type 0+2)
  109. - strictly increasing until next JoinAccept
  110. * RJCount1 (type 1)
  111. - strictly increasing, can only be reset when JoinEUI changed
  112.  
  113. ## Beacon Message Format
  114.  
  115. ### Radio PHY Layer
  116.  
  117. * Preamble
  118. - LoRa modulation: sync word (8 symbols)
  119. - Public networks: `0x34`
  120. - Private networks: `0x12`
  121. - FSK modulation: sync word `0xC194C1` (3 bytes)
  122. * BCNPayload
  123.  
  124. ### Beacon Frame
  125.  
  126. * Time - seconds since GPS epoch (4 bytes lsb)
  127. * Time CRC
  128. * InfoDesc
  129. - 0-2 GPS info, transmitted on antenna N (N=0,1,2)
  130. - Mulit-antenna gateways transmit different frames on each antenna
  131. - 3-127 Reserved
  132. - 128-255 Network-specific
  133. * latitude (3 bytes) + longitude (3 bytes)
  134. - signed 24 bit
  135.  
  136. ## Device
  137.  
  138. ### Class A
  139.  
  140. * Random uplink
  141. - time: random, but not before previous receive windows expired
  142. - an uplink message is retransmitted until a downlink is received in one of the windows, or max NbTrans times.
  143. - for confirmed uplink messages, downlink needs Ack set
  144. - for class B and C, downlink needs to be unicast
  145. - If more than NbTrans uplink messages are received by the network server, the network server may treat this as a replay attack
  146. - frequency: random frequency from join/mac-configurable channel list
  147. - by default: region-specific channel list
  148. * Scheduled downlink windows
  149. - If network server uses both windows, payload must be identical
  150. - Device only opens window 2 if no valid downlink in window 1
  151. - Receive window 1
  152. - time: join/mac-configurable `receive_delay_1` after uplink ended (±20µs)
  153. - by default: 1s
  154. - frequency: function of uplink frequency, region-specific
  155. - data rate: function of uplink data rate and mac-configuration, region-specific
  156. - by default: equal to uplink data rate
  157. - Receive window 2
  158. - time: join/mac-configurable `receive_delay_2` after uplink ended (±20µs)
  159. - by default: `receive_delay_1` + 1s
  160. - frequency: join/mac-configurable
  161. - by default: region-specific
  162. - data rate: join/mac-configurable
  163. - by default: region-specific
  164. * Confirmed messages
  165. - If a confirmed uplink is received by the network server
  166. - The network server responds to the message with a downlink that has the Ack bit set in FCtrl
  167. - If a confirmed downlink is received by a device
  168. - The device sends the next uplink with the Ack bit set in FCtrl
  169. - An Ack is only sent once
  170. - If the network server receives the next uplink without an Ack bit
  171. - The network server informs the application server
  172. * Adaptive Data Rate (ADR)
  173. - With ADR the network server controls the data rate and transmission power of a device
  174. - If ADR is possible, the ADR bit is set in FCtrl
  175. - If the ADR bit is not set in uplink FCtrl, the network server does not do ADR
  176. - If the ADR bit is not set in downlink FCtrl, the device can decide what to do
  177. - Default transmission power: maximum allowed
  178. - Default data rate:
  179. - Device behavior:
  180. - if ADR is applied and data rate or transmission power is optimized
  181. - on every sent uplink that increments the FCnt, increment `ADR_ACK_CNT`
  182. - on every received downlink, reset `ADR_ACK_CNT`
  183. - if `ADR_ACK_CNT` greater than or equal to `ADR_ACK_LIMIT`
  184. - set the ADRACKReq bit in FCtrl`
  185. - if `ADR_ACK_CNT` greater than or equal to `ADR_ACK_LIMIT + ADR_ACK_DELAY`
  186. - step up transmission power until maximum
  187. - if transmission power equal to maximum
  188. - step down data rate until minimum
  189. - if data rate equal to minimum
  190. - re-enable all default channels
  191.  
  192. MAC Commands
  193.  
  194. * Never visible to the application layer or application server
  195. * CID + optional Payload
  196. * Acknowledged in order
  197. * MAC has priority over data payload
  198. * NS must consider max payload size at device DataRate before sending MAC commands
  199.  
  200. MAC State
  201.  
  202. * LoRaWAN version
  203. * Device class
  204. * Regional version
  205. * Region/Frequency Plan
  206. * Max EIRP
  207. * Dwell time uplink+downlink on/off
  208. * ADR-DataRate (desired+acked)
  209. * ADR-TxPower (desired+acked)
  210. * `ADR_ACK_LIMIT`, `ADR_ACK_DELAY`
  211. * Channels (desired+acked)
  212. - on/off
  213. - frequency
  214. - data rate range
  215. * RX1 DR Offset (desired+acked)
  216. * RX2 DR (desired+acked)
  217. * RX2 Frequency (desired+acked)
  218. * NbTrans
  219. * RX1 Delay
  220. * Rejoin-counter
  221. * Rejoin-timer
  222.  
  223. Fixed Device Registration
  224.  
  225. * LoRaWAN version
  226. * JoinEUI
  227. * DevEUI
  228. * AppKey
  229. * NwkKey + derived JSIntKey and JSEncKey
  230. * AppKey
  231.  
  232. Activated Device state
  233.  
  234. * DevAddr
  235. - Allocated by the network server
  236. * NwkSEncKey, SNwkSIntKey, FNwkSIntKey
  237. * AppSKey
  238. * Previous device state is kept until RekeyInd MAC received
  239.  
  240. * Counters
  241. * Keys
  242.  
  243. ### Class B
  244.  
  245. * Extends Class A
  246. * All gateways synchronously transmit "beacons" every `beacon_period` of 128s
  247. - Every 128s since GPS epoch
  248. - Account for TBeaconDelay
  249. * The 3.000s before the beacon is `beacon_guard`, no downlink pings can be sent
  250. * The `beacon_window` of 122.880s after the (`beacon_start` + `beacon_reserved` (2.120s)) can be used for downlink pings
  251. * There are 4096 ping slots of 30ms in the `beacon_window`
  252. - Device gets a pseudo-random slot number in each `beacon_window` - generated from time and DevAddr
  253. * Any gateway can transmit a downlink ping to an end-device in a "ping-slot"
  254.  
  255. Global state
  256.  
  257. * Beacon frequency
  258. - Default: PHY
  259. - US/CN: Frequency hopping
  260.  
  261. Device state (additional to Class A)
  262.  
  263. * Gateways of last uplink
  264. * Ping-slot periodicity (decided by device)
  265. * Ping-slot frequency (decided by network server)
  266. - Default: PHY
  267. - US/CN: Frequency hopping
  268. * Ping-slot data rate (decided by network server)
  269.  
  270. Multicast downlink
  271.  
  272. * No MAC commands
  273. * Ack=0
  274. * AdrAckReq=0
  275. * MType=unconfirmed down
  276.  
  277. Beacon
  278.  
  279. ### Class C
  280.  
  281. * Extends Class A
  282. * Continuously listening on RX2, except during TX or RX1
  283.  
  284. Device state (additional to Class A)
  285.  
  286. * Gateways of last uplink
  287.  
  288. ## Network Server
  289.  
  290. ## Application Server
  291.  
  292. ## Join Server
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement