diff --git a/content/tutorials/expansionboards/pygate.md b/content/tutorials/expansionboards/pygate.md index fe2d541..a375eed 100644 --- a/content/tutorials/expansionboards/pygate.md +++ b/content/tutorials/expansionboards/pygate.md @@ -10,6 +10,12 @@ A USB connection is recommended for the initial firmware update of the Pycom dev The Pygate board can have the PyEthernet adapter connected which allows an Ethernet connection. The PyEthernet also supports PoE. Please check the separate [page and warning for PoE-NI!](/tutorials/all/poe) +What is discussed in this example: +1. [Setup](#setup) +2. [TTN](#example-ttn-wifi) +3. [Config file](#config-file) +4. [Logs expalantion](#pygate-logs) + ## Setup To connect your Pygate to a LoRa server, please follow these steps: @@ -345,3 +351,58 @@ machine.pygate_init(buf) } ``` +> Note: You can add the GPS coordinates to your Pygate by including the following lines in the `'gateway_conf'` object of the config file. +>``` +>"fake_gps": true, +>"ref_latitude": lat, +>"ref_longitude": lon, +>"ref_altitude": z +>``` + +## Pygate logs + +Disambiguation of the Pygate logs: + +1. By default the Pygate will print a status overview every 30 seconds (set by `stat_interval` in the config file). It will give an overview of what happened in the last 30 seconds. look sort of like this: + + ```python + [epoch time] lorapf: INFO_ [main] report + ##### [Date] [Time] GMT ##### + ### [UPSTREAM] ### + RF packets received by concentrator: 4 # <-- Amount of LoRa packets received from nodes + CRC_OK: 75.00%, CRC_FAIL: 25.00%, NO_CRC: 0.00% # <-- Redundancy check + RF packets forwarded: 3 (69 bytes) # <-- Actual LoRa packets forwarded to TTN + PUSH_DATA datagrams sent: 4 (728 bytes) # <-- Packets forwarded to TTN (1 status update packet) + PUSH_DATA acknowledged: 100.00% # <-- Acknowledgments received from TTN + ### [DOWNSTREAM] ### + PULL_DATA sent: 3 (100.00% acknowledged) # <-- Checked TTN for Downlink packets this amount + PULL_RESP(onse) datagrams received: 0 (0 bytes) # <-- Actual downlink packets available from TTN + RF packets sent to concentrator: 0 (0 bytes) # <-- LoRa downlink packets actually sent out + TX errors: 0 # <-- Amount of errors when sending LoRa packets to nodes, if there are any TX errors, they will be explained below + ### [JIT] ### # <-- Just In Time TX scheduling + [jit] queue is empty + ### [GPS] ### # <-- GPS sync + GPS sync is disabled + ##### END ##### + ``` + + + +2. Now for the actual logs in between there are a number of variants and are structured like the first line: + ```python + [epoch time] lorapf: LEVEL_ [method] arguments + [epoch time] lorapf: INFO_ [up ] received pkt from mote: {redacted}, RSSI -51.0 # <-- Properly received packet from node + + [epoch time] lorapf: WARN_ [up ] PUSH_ACK recieve timeout 0 # <-- No acknowledgement received from TTN + [epoch time] lorapf: WARN_ [up ] PUSH_ACK recieve timeout 1 # <-- No acknowledgement received from TTN, second try + [epoch time] lorapf: WARN_ [up ] ignored out-of sync PUSH_ACK packet {redacted} # <-- out of sync acknowledgement from TTN + [epoch time] lorapf: INFO_ jitqueue: Current concentrator {redacted} # <-- sceduled a downlink packet + [epoch time] lorapf: WARN_ jitqueue: IGNORED: not REJECTED, already too late to send it {redacted} # <-- downlink LoRa packet received too late, but sent anyways + ``` + + Print level can be set custom using `machine.pygate_debug_level(level)` and are set as following: + * `DEBUG`: 4 + * `INFO`: 3 + * `WARNING`: 2 + * `ERROR`: 1 +