diff --git a/content/firmwareapi/pycom/expansionboards/pygate.md b/content/firmwareapi/pycom/expansionboards/pygate.md index 8ac672c..7950938 100644 --- a/content/firmwareapi/pycom/expansionboards/pygate.md +++ b/content/firmwareapi/pycom/expansionboards/pygate.md @@ -12,17 +12,17 @@ The Pygate is an 8-channel LoRaWAN gateway. Connect a WiPy, Gpy or LoPy4 board t ## Methods -#### machine.pygate\_init(buff) +### machine.pygate_init(buff) This function is used to initialize the Pygate - `buff`: the data contents of the gateway global config json file -#### machine.pygate\_deinit() +### machine.pygate_deinit() This shuts down the concentrator. -#### machine.callback(trigger, handler=None, arg=None) +### machine.callback(trigger, handler=None, arg=None) - `trigger`: A trigger event(s) for invoking the callback function `handler`, the triggers/events are: @@ -36,6 +36,13 @@ This shuts down the concentrator. - `arg`: Optional argument to be passed to the callback function. -#### machine.events() +### machine.events() Get the Pygate events + +### machine.pygate_reset() + +Hard-reset (power cycle) the Pygate and development module inserted. + +> To use this functionality, you will need to update the Pygate firmware. Go to [update firmware](/updatefirmware/expansionboard/) to do so. + diff --git a/content/tutorials/networks/lora/_index.md b/content/tutorials/networks/lora/_index.md index d61d496..a8b2125 100644 --- a/content/tutorials/networks/lora/_index.md +++ b/content/tutorials/networks/lora/_index.md @@ -23,3 +23,4 @@ When using Lora, **Always** connect the appropriate LoRa antenna to your device. * **Lopy to Lopy** You are also able to connect two devices to each other using LoRa frequencies. We have one example explaining more about that * [Lopy to Lopy](../lora/module-module/) +* **Pygate** Go to the [Expansionboard tutorials](/tutorials/expansionboards/pygate/) for the Pygate tutorial \ No newline at end of file diff --git a/content/tutorials/networks/lora/lorawan-abp.md b/content/tutorials/networks/lora/lorawan-abp.md index 208bf35..e181cb5 100644 --- a/content/tutorials/networks/lora/lorawan-abp.md +++ b/content/tutorials/networks/lora/lorawan-abp.md @@ -8,7 +8,10 @@ aliases: ABP stands for Authentication By Personalisation. It means that the encryption keys are configured manually on the device and can start sending frames to the Gateway without needing a 'handshake' procedure to exchange the keys (such as the one performed during an OTAA join procedure). -The example below attempts to get any data received after sending the frame. Keep in mind that the Gateway might not be sending any data back, therefore we make the socket non-blocking before attempting to receive, in order to prevent getting stuck waiting for a packet that will never arrive. +The example below attempts to get any data received after sending the frame. Keep in mind that the Gateway might not be sending any data back, therefore we make the socket non-blocking before attempting to receive, in order to prevent getting stuck waiting for a packet that will never arrive. I + +> **Note for US915 / AU915 regions:** if you are planning to send packets to a Pygate (or any other 8-channel gateway) with the supplied configuration file, you will need to define the correct uplink channels. These regions support up to 64 uplink channels, meaning the node can transmit on a channel that is not received. Uncomment the respective sections in the example below to select the correct uplink channels. + ```python @@ -30,6 +33,15 @@ dev_addr = struct.unpack(">l", ubinascii.unhexlify('00000005'))[0] nwk_swkey = ubinascii.unhexlify('2B7E151628AED2A6ABF7158809CF4F3C') app_swkey = ubinascii.unhexlify('2B7E151628AED2A6ABF7158809CF4F3C') +# Uncomment for US915 / AU915 & Pygate +# for i in range(0,8): +# lora.remove_channel(i) +# for i in range(16,65): +# lora.remove_channel(i) +# for i in range(66,72): +# lora.remove_channel(i) + + # join a network using ABP (Activation By Personalization) lora.join(activation=LoRa.ABP, auth=(dev_addr, nwk_swkey, app_swkey)) @@ -54,4 +66,3 @@ s.setblocking(False) data = s.recv(64) print(data) ``` - diff --git a/content/tutorials/networks/lora/lorawan-otaa.md b/content/tutorials/networks/lora/lorawan-otaa.md index a64bc50..fa27ed6 100644 --- a/content/tutorials/networks/lora/lorawan-otaa.md +++ b/content/tutorials/networks/lora/lorawan-otaa.md @@ -20,6 +20,8 @@ import binascii print(binascii.hexlify(LoRa().mac()).upper()) ``` +> **Note for US915 / AU915 regions:** if you are planning to send packets to a Pygate (or any other 8-channel gateway) with the supplied configuration file, you will need to define the correct uplink channels. These regions support up to 64 uplink channels, meaning the node can transmit on a channel that is not received. Uncomment the respective sections in the example below to select the correct uplink channels. + ```python from network import LoRa @@ -41,6 +43,14 @@ app_key = ubinascii.unhexlify('11B0282A189B75B0B4D2D8C7FA38548B') #uncomment to use LoRaWAN application provided dev_eui #dev_eui = ubinascii.unhexlify('70B3D549938EA1EE') +# Uncomment for US915 / AU915 & Pygate +# for i in range(0,8): +# lora.remove_channel(i) +# for i in range(16,65): +# lora.remove_channel(i) +# for i in range(66,72): +# lora.remove_channel(i) + # join a network using OTAA (Over the Air Activation) #uncomment below to use LoRaWAN application provided dev_eui lora.join(activation=LoRa.OTAA, auth=(app_eui, app_key), timeout=0) @@ -72,4 +82,4 @@ s.setblocking(False) # get any data received (if any...) data = s.recv(64) print(data) -``` +``` \ No newline at end of file