前言

Packet Forwarder 的使用,编译运行都很傻瓜化,最关键的是 conf 配置文件的配置,发现许多朋友都在这边栽过跟头,小能手分享了一个配置文件示例。

小能手整理了 LoRa Gateway 的开发笔记系列,详细可点此查看

1 编译

通过查看 Makefile 文件,可以发现就2个对象。

make all
make clean

2 配置

2.1 几个配置文件介绍

目录下可能会存在几个配置文件:

配置文件作用
debug_conf.json调试采用的配置,如果有它就忽略其他配置文件
local_conf.json针对单个网关的配置信息,比如 MAC 地址,或者特定频点。一般配置 “SX1301_conf”、“gateway_conf” 中的部分字段。
global_conf.json某一类网关的通用配置,一般产品批量是定型下来

它们的解析和参数覆盖优先级如下:

debug_conf.json
local_conf.json
global_conf.json

2.2 global_conf.json

这个文件相当关键,频点是否正确就看它。发现许多朋友都在这边栽过跟头。

官方给了几个参考,位于 \packet_forwarder\lora_pkt_fwd\cfg\:

* global_conf.json.PCB_E286.EU868.*: to be used for Semtech reference design
  board with PCB name PCB_E286 (also called Gateway Board v1.0 (no FPGA)).
  Configured for Europe 868MHz channels.
* global_conf.json.PCB_E336.EU868.*:to be used for Semtech reference design
  board with PCB name PCB_E336 (also called Gateway Board v1.5 (with FPGA)).
  Configured for Europe 868MHz channels.
* global_conf.json.US902.*: to be used for Semtech reference design v1.0 or
  v1.5. (No calibration done for RSSI offset and TX gains yet).
  Configured for US 902MHz channels.
  
Beside board related flavours, there are "features" flavours named "basic",
"gps", "beacon".
* global_conf.json.*.basic: to be used for basic packet forwarder usage, with
no GPS.
* global_conf.json.*.gps: to be used when the platform has a GPS receiver.
* global_conf.json.*.beacon: to be used when the platform has a GPS receiver
and we want the packet forwarder to emit beacons for synchronized networks.

本能手以 470.3~471.7 定义了一个范例 conf 文件,详细见:https://github.com/twowinter/packet_forwarder/blob/master/lora_pkt_fwd/cfg/global_conf.json.CN470.basic

3 运行

    ./update_gwid.sh local_conf.json    (可选)
    ./lora_pkt_fwd

update_gwid.sh 这个脚本,会根据设备的 MAC 地址生成一个 ID 写入到 local_conf.json 中。

要停止程序,Ctrl+C。

END


Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐