Wiki source code of Change Gateway Power

Version 18.2 by Xiaoling on 2022/07/22 15:07

Hide last authors
Xiaoling 18.2 1 (% class="wikigeneratedid" %)
2 **Table of Contents:**
Edwin Chen 8.1 3
Xiaoling 18.2 4 {{toc/}}
5
6
7
8
9 = 1.  Overview =
10
11
Kilight Cao 9.1 12 In LoRaWAN protocol, the gateway transmit packet uses the output power base on the Power Index from the LoRaWAN server downlink. for example, the LoRaWAN server sends a downlink with this info "rf_power=14", gateway got this info and it will search the index for rf_power=14 and use the related rf setting to set output power. In some cases, the LoRaWAN server might set the rf-power to a quite low value ( for example 0dB) which is not practical for use. In such a case, the User can manually change the rf_power=0's rf settings to a higher power out. Below are the methods.
Edwin Chen 8.1 13
14
Xiaoling 18.2 15 = 2.  Change Power for Semtech UDP Paket forward connection =
Xiaoling 1.3 16
Xiaoling 4.1 17
Kilight Cao 9.1 18 In LoRaWAN protocol, the gateway output power refers to the downstream packets sent by Gateway. This output power is controlled by the LoRaWAN server.
Xiaoling 1.3 19
Kilight Cao 9.1 20 Gateway maintains a power index in the file: /etc/lora/global_conf.json for example:
Xiaoling 1.3 21
Edwin Chen 5.1 22
Xiaoling 1.3 23 (% class="box" %)
24 (((
25 "tx_lut_3": {
26 "desc": "TX gain table, index 3",        ~/~/ Index 3 refer to rf_power: 15dB. device will set the pa_gain,mix_gain,dig_gain 
27 "pa_gain": 2,                            ~/~/ to the value mentioned here so to generate 15dB output power.
28 "mix_gain": 10,
29 "rf_power": 15,
30 "dig_gain": 1
31 },
32 "tx_lut_4": {
33 "desc": "TX gain table, index 4",
34 "pa_gain": 2,
35 "mix_gain": 10,
36 "rf_power": 16,
37 "dig_gain": 0
38 )))
39
Edwin Chen 5.1 40
Xiaoling 18.2 41 (% style="color:red" %)**Note: If when lorawan server specifies a rf_power that is not listed above. gateway will choose the closest power. profile.**
Edwin Chen 6.1 42
Xiaoling 18.2 43
Kilight Cao 9.1 44 When the LoRaWAN server sends a downlink stream, the server will also ask the gateway to use rf_power as output. So users don't need to consider controlling on the gateway side.
Xiaoling 1.3 45
Kilight Cao 9.1 46 If users want to always use a higher power or a lower power. Users can modify the pa_gain,mix_gain, and dig_gain to specify rf_power to achieve this purpose. This is not recommended, because this might break the regulator for a specific country.
Xiaoling 1.3 47
Kilight Cao 9.1 48 Please note, that the global_conf.json file will be overwritten by the match region files in /etc/lora/cfg-30x when changing settings on the web. So the user needs to change the files in /etc/lora/cfg-cfg-30x instead of global_conf.json
Edwin Chen 7.1 49
50
Xiaoling 18.2 51 = 3.  Change Power for LoRaWAN Basic Station connection =
Edwin Chen 7.1 52
Kilight Cao 9.1 53
Kilight Cao 10.1 54 First, you need to find out what is the chip module of the gateway?
Kilight Cao 9.1 55
Kilight Cao 10.1 56 (% class="box infomessage" %)
57 (((
Xiaoling 18.2 58 **cat /var/iot/chip **
Kilight Cao 10.1 59 )))
60
Kilight Cao 12.1 61 [[image:image-20220623140335-1.png||height="241" width="378"]]
62
Kilight Cao 16.1 63 Gateways using the SX1301 LoRaWAN Concentrator are the [[LG308>>https://www.dragino.com/downloads/index.php?dir=LoRa_Gateway/LG308-LG301/&file=Datasheet_LG308_LoRaWAN_Gateway.pdf]] and [[DLOS8>>https://www.dragino.com/downloads/index.php?dir=LoRa_Gateway/DLOS8/&file=DLOS8_LoRaWAN_Gateway_User_Manual_v1.3.pdf]].
Kilight Cao 12.1 64
65
Xiaoling 18.2 66 (% style="color:blue" %)**SX1301 Change Power for LoRaWAN Basic Station Connection example:**
Kilight Cao 12.1 67
Kilight Cao 18.1 68 Gateway maintains a power index in the file: /etc/station/station-sx1301.conf
Kilight Cao 13.1 69
Kilight Cao 10.1 70 (% class="box" %)
71 (((
Kilight Cao 12.1 72 {
73 /* If slave-X.conf present this acts as default settings */
74 "SX1301_conf": { /* Actual channel plan is controlled by server */
75 "lorawan_public": true, /* is default */
76 "clksrc": 1, /* radio_1 provides clock to concentrator */
77 /* path to the SPI device, un-comment if not specified on the command line e.g., RADIODEV=/dev/spidev0.0 */
78 "device": "/dev/spidev1.0",
79 /* freq/enable provided by LNS - only HW specific settings listed here */
Kilight Cao 13.1 80
Kilight Cao 15.1 81 ~|<~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-(% style="color:red" %)Add parameters:"tx_gain_lut"  :  [ TX_GAIN_LUT, .. ]
Kilight Cao 13.1 82
Kilight Cao 12.1 83 "radio_0": {
84 "type": "SX1257",
85 "rssi_offset": -166.0,
86 "tx_enable": true,
87 "antenna_gain": 0
88 },
89 "radio_1": {
90 "type": "SX1257",
91 "rssi_offset": -166.0,
92 "tx_enable": false
93 }
94 /* chan_multiSF_X, chan_Lora_std, chan_FSK provided by LNS */
95 },
Kilight Cao 10.1 96 )))
Kilight Cao 13.1 97
Kilight Cao 15.1 98
Xiaoling 18.2 99 Add parameters:**"(% style="color:blue" %)tx_gain_lut": [ TX_GAIN_LUT, .. ](%%)**
100
Kilight Cao 14.1 101 (% class="box" %)
102 (((
103 {
104 /* If slave-X.conf present this acts as default settings */
105 "SX1301_conf": { /* Actual channel plan is controlled by server */
106 "lorawan_public": true, /* is default */
107 "clksrc": 1, /* radio_1 provides clock to concentrator */
108 /* path to the SPI device, un-comment if not specified on the command line e.g., RADIODEV=/dev/spidev0.0 */
109 "device": "/dev/spidev1.0",
110 /* freq/enable provided by LNS - only HW specific settings listed here */
111 "tx_gain_lut":[
Kilight Cao 18.1 112 {"rf_power": 12, "pa_gain": 2, "mix_gain": 11, "dig_gain": 2, "dac_gain": 3}, 
Kilight Cao 14.1 113 {"rf_power": 13, "pa_gain": 2, "mix_gain": 10, "dig_gain": 0, "dac_gain": 3},
114 {"rf_power": 14, "pa_gain": 2, "mix_gain": 12, "dig_gain": 2, "dac_gain": 3},
115 {"rf_power": 15, "pa_gain": 2, "mix_gain": 13, "dig_gain": 2, "dac_gain": 3},
Kilight Cao 18.1 116
117 /* Index 3 refer to rf_power: 15dB. device will set the pa_gain,mix_gain,dig_gain */
118
119 /* to the value mentioned here so as to generate 15dB output power.*/
Kilight Cao 14.1 120 {"rf_power": 16, "pa_gain": 2, "mix_gain": 13, "dig_gain": 1, "dac_gain": 3},
121 {"rf_power": 17, "pa_gain": 2, "mix_gain": 14, "dig_gain": 1, "dac_gain": 3},
122 {"rf_power": 18, "pa_gain": 2, "mix_gain": 15, "dig_gain": 2, "dac_gain": 3},
123 {"rf_power": 19, "pa_gain": 2, "mix_gain": 15, "dig_gain": 1, "dac_gain": 3},
124 {"rf_power": 20, "pa_gain": 2, "mix_gain": 15, "dig_gain": 1, "dac_gain": 3},
125 {"rf_power": 21, "pa_gain": 3, "mix_gain": 9, "dig_gain": 0, "dac_gain": 3},
126 {"rf_power": 22, "pa_gain": 3, "mix_gain": 10, "dig_gain": 0, "dac_gain": 3},
127 {"rf_power": 23, "pa_gain": 3, "mix_gain": 11, "dig_gain": 1, "dac_gain": 3},
128 {"rf_power": 24, "pa_gain": 3, "mix_gain": 12, "dig_gain": 0, "dac_gain": 3},
129 {"rf_power": 25, "pa_gain": 3, "mix_gain": 14, "dig_gain": 0, "dac_gain": 3},
130 {"rf_power": 26, "pa_gain": 3, "mix_gain": 14, "dig_gain": 0, "dac_gain": 3},
131 {"rf_power": 27, "pa_gain": 3, "mix_gain": 14, "dig_gain": 0, "dac_gain": 3}
132 ],
133 "radio_0": {
134 "type": "SX1257",
135 "rssi_offset": -166.0,
136 "tx_enable": true,
137 "antenna_gain": 0
138 },
139 "radio_1": {
140 "type": "SX1257",
141 "rssi_offset": -166.0,
142 "tx_enable": false
143 }
144 /* chan_multiSF_X, chan_Lora_std, chan_FSK provided by LNS */
145 },
146 )))
Kilight Cao 15.1 147
Xiaoling 18.2 148 See this link for more station configuration parameters: [[Concentrator Design (v1.5) - LoRa Basics™ StationLoRa Basics™ Station ~| DEVELOPER PORTAL (semtech.com)>>url:https://lora-developers.semtech.com/build/software/lora-basics/lora-basics-for-gateways/?url=gw_v1.5.html]]
Kilight Cao 18.1 149
Xiaoling 18.2 150
Kilight Cao 9.1 151 If users want to always use a higher power or a lower power. Users can modify the pa_gain,mix_gain, and dig_gain to specify rf_power to achieve this purpose. This is not recommended, because this might break the regulator for a specific country.
152
Xiaoling 18.2 153 (% style="color:red" %)**Note: When the Settings are complete, click "Save&Apply" on the gateway's Web UI**
Kilight Cao 18.1 154
155
Xiaoling 18.2 156 = 4.  Checking station Logs =
157
158
Kilight Cao 18.1 159 Run the command:
160
161 (% class="box infomessage" %)
162 (((
Xiaoling 18.2 163 **tail -f /var/iot/station.log**
Kilight Cao 18.1 164 )))
165
166 [[image:image-20220623145437-2.png||height="501" width="694"]]
167
Kilight Cao 9.1 168