LoRaWAN
(→Gateway Config) |
(→Overview) |
||
(未显示1个用户的4个中间版本) | |||
第2行: | 第2行: | ||
https://www.thethingsnetwork.org/docs/lorawan/ | https://www.thethingsnetwork.org/docs/lorawan/ | ||
+ | |||
+ | [http://murata.eetrend.com/article/2018-09/1002060.html 详解LoRaWAN协议] | ||
+ | |||
+ | <br><br> | ||
+ | |||
+ | == 基本设置 == | ||
+ | |||
+ | === Overview === | ||
+ | |||
+ | * SF_12 | ||
+ | * BW_125 (125KHz) | ||
+ | * CR_5 (CR 4/5) | ||
+ | * Explicit Header | ||
+ | * CRC_ON | ||
+ | |||
+ | [[文件:Sx1278-signal-bandwidth.png]] | ||
+ | |||
+ | <br> | ||
+ | |||
+ | === Preamble === | ||
+ | |||
+ | LoRa 数据包前导码,用于接收机辩识 rx data flow。内容固定,长度可选。 | ||
+ | |||
+ | 默认 12 个 symbol(Bytes?), 0x8 (RegPreambleLsb) + 4 | ||
+ | |||
+ | 可写 RegPreambleMsb 和 RegPreambleLsb 这两个寄存器,将其改为 6 +4 ~ 65535 +4 | ||
+ | |||
+ | 10 symbol 的短前导码,通信够用但具有更短的接收周期。。。 | ||
+ | |||
+ | 当前系统一般皆适用 12 (4 + 8) 的长度: | ||
+ | |||
+ | <source lang=bash> | ||
+ | ...... | ||
+ | ^$Get Preamble Length: state 0 | ||
+ | ^$Preamble Length: 8 | ||
+ | ...... | ||
+ | </source> | ||
+ | |||
+ | <br> | ||
+ | |||
+ | === Sync word === | ||
+ | |||
+ | * 0x12 by default | ||
+ | * 0x34 for LoRaWAN | ||
+ | |||
+ | 相关寄存器:RegSyncWord | ||
+ | |||
+ | <br> | ||
+ | |||
+ | === Header === | ||
+ | |||
+ | Explicit Header & Implicit Header | ||
+ | |||
+ | 可通过寄存器 RegModemConfig1 内的位 ImplicitHeaderModeOn 来控制 | ||
+ | |||
+ | |||
+ | '''Explicit Header:''' | ||
+ | |||
+ | Reset 默认的模式。其能提供的信息: | ||
+ | |||
+ | * Payload 长度 | ||
+ | * The forward error correction code rate | ||
+ | * The presence of an optional 16-bits CRC for the payload | ||
+ | |||
+ | The head is transmitted with maximum error correction code (4/8). It also has its own CRC to allow the receiver to discard invalid headers. | ||
+ | |||
+ | |||
+ | |||
+ | '''Implicit Header:''' | ||
+ | |||
+ | Header is removed from the LoRa Packet. | ||
+ | |||
+ | Payload, Coding Rate and CRC presence are fixed. | ||
+ | |||
+ | Be advantageous to reduce transmission time | ||
+ | |||
+ | <br><br> | ||
+ | |||
+ | === CRC === | ||
+ | |||
+ | RegPayloadCrcOn: RegModemConfig2[2:2] | ||
+ | |||
+ | * 0 ---> CRC disable | ||
+ | * 1 ---> CRC enable | ||
+ | |||
+ | |||
+ | In Implicit Header Mode: must be set on Tx and Rx side | ||
+ | |||
+ | In Explicit Header Mode: on the Tx side alone (recovered from the header in Rx side) | ||
+ | |||
+ | |||
+ | '''Explicit Header Mode Checking process:''' | ||
+ | |||
+ | Rx 用户负责检查 CrcOnPayload (RegHopChannel[6:6], CRC information extracted from the rx packet header) | ||
+ | |||
+ | 如果 CrcOnPayload == 1,需要检查 IRQ 标志位 PayloadCrcError,以确保没有 CRC 错误 | ||
+ | |||
+ | |||
+ | '''Implicit Header Mode 则直接去检查 IRQ 标志位 PayloadCrcError,以确保没有 CRC 错误''' | ||
<br><br> | <br><br> | ||
第91行: | 第190行: | ||
* [[SX127x]] | * [[SX127x]] | ||
+ | * [[SX126x]] | ||
* [[LoRa]] | * [[LoRa]] | ||
* [http://www.yidianzixun.com/article/0I1kkv1O?title_sn/0&s=3&appid=xiaomi&ver=4.5.5.0&utk=2tr9mcf3 LoRa要替代NB-IoT?470-510MHz背后的玄机] | * [http://www.yidianzixun.com/article/0I1kkv1O?title_sn/0&s=3&appid=xiaomi&ver=4.5.5.0&utk=2tr9mcf3 LoRa要替代NB-IoT?470-510MHz背后的玄机] | ||
第96行: | 第196行: | ||
* [https://baijiahao.baidu.com/s?id=1589115634160657203&wfr=spider&for=pc 一份征求意见稿 一片争议声 LoRa你现在还好吗?] | * [https://baijiahao.baidu.com/s?id=1589115634160657203&wfr=spider&for=pc 一份征求意见稿 一片争议声 LoRa你现在还好吗?] | ||
* https://blog.csdn.net/wang2425559/article/details/74929743 | * https://blog.csdn.net/wang2425559/article/details/74929743 | ||
+ | * https://github.com/CongducPham/LowCostLoRaGw/blob/master/gw_full_latest/README-NewCloud.md | ||
+ | |||
<br><br> | <br><br> |
2020年12月25日 (五) 16:04的最后版本
目录 |
[编辑] 1 Overview
https://www.thethingsnetwork.org/docs/lorawan/
[编辑] 2 基本设置
[编辑] 2.1 Overview
- SF_12
- BW_125 (125KHz)
- CR_5 (CR 4/5)
- Explicit Header
- CRC_ON
[编辑] 2.2 Preamble
LoRa 数据包前导码,用于接收机辩识 rx data flow。内容固定,长度可选。
默认 12 个 symbol(Bytes?), 0x8 (RegPreambleLsb) + 4
可写 RegPreambleMsb 和 RegPreambleLsb 这两个寄存器,将其改为 6 +4 ~ 65535 +4
10 symbol 的短前导码,通信够用但具有更短的接收周期。。。
当前系统一般皆适用 12 (4 + 8) 的长度:
...... ^$Get Preamble Length: state 0 ^$Preamble Length: 8 ......
[编辑] 2.3 Sync word
- 0x12 by default
- 0x34 for LoRaWAN
相关寄存器:RegSyncWord
[编辑] 2.4 Header
Explicit Header & Implicit Header
可通过寄存器 RegModemConfig1 内的位 ImplicitHeaderModeOn 来控制
Explicit Header:
Reset 默认的模式。其能提供的信息:
- Payload 长度
- The forward error correction code rate
- The presence of an optional 16-bits CRC for the payload
The head is transmitted with maximum error correction code (4/8). It also has its own CRC to allow the receiver to discard invalid headers.
Implicit Header:
Header is removed from the LoRa Packet.
Payload, Coding Rate and CRC presence are fixed.
Be advantageous to reduce transmission time
[编辑] 2.5 CRC
RegPayloadCrcOn: RegModemConfig2[2:2]
- 0 ---> CRC disable
- 1 ---> CRC enable
In Implicit Header Mode: must be set on Tx and Rx side
In Explicit Header Mode: on the Tx side alone (recovered from the header in Rx side)
Explicit Header Mode Checking process:
Rx 用户负责检查 CrcOnPayload (RegHopChannel[6:6], CRC information extracted from the rx packet header)
如果 CrcOnPayload == 1,需要检查 IRQ 标志位 PayloadCrcError,以确保没有 CRC 错误
Implicit Header Mode 则直接去检查 IRQ 标志位 PayloadCrcError,以确保没有 CRC 错误
[编辑] 3 Address
https://www.thethingsnetwork.org/docs/lorawan/address-space.html
[编辑] 4 Gateway Traffic
uplink, downlink, join
Time Frequency Mod. CR Data Rate Airtime (ms) cnt
[编辑] 5 Gateway Test
$ ./lora_gateway -d 5 -e 12 -c 125 -i 34 -h 2 -f -g 434.3
[编辑] 6 Gateway Config
basic_config_gw.sh:
- 生成 gateway_id.txt, gateway_id.md5
- 生成配置文件 gateway_conf.json
- 配置 WiFi
- 把 start_gw.sh 加到系统自启动脚本 /etc/rc.local 中
- 编译 lora_gateway
pi@raspberrypi:~/lora-gw/gw_full_latest $ ./scripts/test_gwid.sh Detecting gw id as 0000B827EF8855AA pi@raspberrypi:~/lora_gateway $ scripts/basic_config_gw.sh MKB827EF8855AA00 Taking provided address: MKB827EB8E763900 Keep a copy of /home/pi/lora_gateway/scripts/update_gw.sh mkdir: cannot create directory ‘/home/pi/scripts’: File exists Done Creating /home/pi/lora_gateway/gateway_id.txt file Writing 0000MKB827EF8855AA00 Done Creating /home/pi/lora_gateway/gateway_id.md5 file Done Replacing gw id in /home/pi/lora_gateway/gateway_conf.json Done Creating /home/pi/Dropbox/LoRa-test Done Creating log -> /home/pi/Dropbox/LoRa-test Done Setting gateway to run at boot Removing /home/pi/lora_gateway/scripts/start_gw.sh in /etc/rc.local if any Done Add /home/pi/lora_gateway/scripts/start_gw.sh in /etc/rc.local Done Compile lora_gateway executable ~/lora_gateway ~/lora_gateway rm *.o lora_*gateway You have a Raspberry 1 Compiling for Raspberry 1 g++ -DPABOOST -DMAX_DBM=20 -DRASPBERRY -DIS_RCV_GATEWAY -c lora_gateway.cpp -o lora_gateway.o g++ -c arduPi.cpp -o arduPi.o g++ -c SX1272.cpp -o SX1272.o g++ -lrt -lpthread lora_gateway.o arduPi.o SX1272.o -o lora_gateway ~/lora_gateway You should reboot your Raspberry Bye.
Refer to: Basic Config
$ sudo apt-get install jq $ sudo apt-get install python-pip $ sudo apt-get install python-dateutil python-crypto
[编辑] 7 Reference
- SX127x
- SX126x
- LoRa
- LoRa要替代NB-IoT?470-510MHz背后的玄机
- 更正说明:470-510MHz为授权频段
- 一份征求意见稿 一片争议声 LoRa你现在还好吗?
- https://blog.csdn.net/wang2425559/article/details/74929743
- https://github.com/CongducPham/LowCostLoRaGw/blob/master/gw_full_latest/README-NewCloud.md