# How to add Dragino Lora/gps HAT to V3

**URL:** <https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120>\
**Category:** Dragino\
**Created:** [May 27, 2021, 6:01pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120 "2021-05-27T18:01:06Z")\
**Posts on this page:** 20\
**Page:** 5

<div class="post-metadata">

**Author:** ![mauriceatkinson](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/mauriceatkinson/32/35697_2.png) [@mauriceatkinson](https://www.thethingsnetwork.org/forum/u/mauriceatkinson)\
**Post date:** [May 4, 2022, 7:30pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120/82 "2022-05-04T19:30:41Z")

</div>

i will give them a try and let you know

---

<div class="post-metadata">

**Author:** ![bnnorman](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bnnorman/32/35697_2.png) [@bnnorman](https://www.thethingsnetwork.org/forum/u/bnnorman)\
**Post date:** [May 4, 2022, 7:53pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120/83 "2022-05-04T19:53:49Z")

</div>

One other thing, try installing pycrypto with pip. Not tried myself but the API looks to be the same. Changing the API will require changes to files in the LoRaWAN folder.

---

<div class="post-metadata">

**Author:** ![bnnorman](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bnnorman/32/35697_2.png) [@bnnorman](https://www.thethingsnetwork.org/forum/u/bnnorman)\
**Post date:** [May 4, 2022, 8:36pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120/84 "2022-05-04T20:36:43Z")

</div>

pycrypto installed with pip on my bullseye.

```auto
from Crypto.Cipher import AES 

```

worked ok but I haven’t tried it in anger.

---

<div class="post-metadata">

**Author:** ![mauriceatkinson](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/mauriceatkinson/32/35697_2.png) [@mauriceatkinson](https://www.thethingsnetwork.org/forum/u/mauriceatkinson)\
**Post date:** [May 6, 2022, 6:28pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120/85 "2022-05-06T18:28:10Z")

</div>

@bnnorman I encountered an issue with Bullseye so went back to my previously working software on buster but am encountering this error.

I cannot see what I am doing wrong, any ideas?

pi@unit002:~/dragino-1 $ sudo python3 test.py  
Mode ← SLEEP  
Mode ← FSK\_STDBY  
Traceback (most recent call last):  
File “test.py”, line 20, in   
D = Dragino(“dragino.toml”, logging\_level=logLevel)  
File “/home/pi/dragino-1/dragino/dragino.py”, line 85, in **init**  
super(Dragino, self). **init** () # LoRa init  
File “/home/pi/dragino-1/dragino/SX127x/LoRa.py”, line 100, in **init**  
self.rx\_chain\_calibration(calibration\_freq)  
File “/home/pi/dragino-1/dragino/SX127x/LoRa.py”, line 854, in rx\_chain\_calibration  
self.set\_mode(op\_mode\_bkup)  
File “/home/pi/dragino-1/dragino/SX127x/LoRa.py”, line 221, in set\_mode  
sys.stderr.write(“Mode ← %s\n” % MODE.lookup[mode])  
KeyError: 0  
pi@unit002:~/dragino-1 $

---

<div class="post-metadata">

**Author:** ![bnnorman](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bnnorman/32/35697_2.png) [@bnnorman](https://www.thethingsnetwork.org/forum/u/bnnorman)\
**Post date:** [May 6, 2022, 7:00pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120/86 "2022-05-06T19:00:58Z")

</div>

Hmm, I saw that error ages ago. Its in the original source ( ie not my code). It says mode is not in the lookup table/ dict. I would add a print statement just before line 221 to print both mode and MODE.lookup to find out if mode is invalid or MODE.lookup has been initialised. I’ m not at my desktop at the moment. Its feet up time for me.

---

<div class="post-metadata">

**Author:** ![bnnorman](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bnnorman/32/35697_2.png) [@bnnorman](https://www.thethingsnetwork.org/forum/u/bnnorman)\
**Post date:** [May 6, 2022, 7:36pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120/87 "2022-05-06T19:36:01Z")

</div>

The modes are listed in constants.py. It looks like the code is being asked to set a mode not in the MODE list in that file. I’d like to know what that mode is because the two mode changes at the start succeed. Does it happen all the time? Odd it worked ok before. Did you rebuild Buster or just put the working Buster SD back in?

---

<div class="post-metadata">

**Author:** ![bnnorman](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bnnorman/32/35697_2.png) [@bnnorman](https://www.thethingsnetwork.org/forum/u/bnnorman)\
**Post date:** [May 6, 2022, 7:58pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120/88 "2022-05-06T19:58:39Z")

</div>

Looking at LoRa.py line 854 I think op\_mode\_bkup is None. It is a copy of self.mode which is initialised to None although it should have been over-written by the two mode changes SLEEP and FSK\_STANDBY. As a quick workaround I suggest you change line 854 in LoRa.py to this.

```auto
if op_mode_bkup is not None:
     self.set_mode(op_mode_bkup)

```

If that works I’ll change the repo but I still don’t know why it is happening.

---

<div class="post-metadata">

**Author:** ![mauriceatkinson](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/mauriceatkinson/32/35697_2.png) [@mauriceatkinson](https://www.thethingsnetwork.org/forum/u/mauriceatkinson)\
**Post date:** [May 6, 2022, 9:43pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120/89 "2022-05-06T21:43:49Z")

</div>

@bnnorman that didnt make any difference. This is the change I made:  
# put back the saved parameters  
#self.set\_mode(op\_mode\_bkup)  
if op\_mode\_bkup is not None:  
self.set\_mode(op\_mode\_bkup)  
self.set\_register(REG.LORA.PA\_CONFIG, pa\_config\_bkup)  
self.set\_freq(freq\_bkup)

But I still received this error:  
pi@unit002:~/dragino-1 $ sudo ./test.py  
Mode ← SLEEP  
Mode ← FSK\_STDBY  
Traceback (most recent call last):  
File “./test.py”, line 20, in   
D = Dragino(“dragino.toml”, logging\_level=logLevel)  
File “/home/pi/dragino-1/dragino/dragino.py”, line 85, in **init**  
super(Dragino, self). **init** () # LoRa init  
File “/home/pi/dragino-1/dragino/SX127x/LoRa.py”, line 100, in **init**  
self.rx\_chain\_calibration(calibration\_freq)  
File “/home/pi/dragino-1/dragino/SX127x/LoRa.py”, line 856, in rx\_chain\_calibration  
self.set\_mode(op\_mode\_bkup)  
File “/home/pi/dragino-1/dragino/SX127x/LoRa.py”, line 221, in set\_mode  
sys.stderr.write(“Mode ← %s\n” % MODE.lookup[mode])  
KeyError: 0  
pi@unit002:~/dragino-1 $

---

<div class="post-metadata">

**Author:** ![bnnorman](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bnnorman/32/35697_2.png) [@bnnorman](https://www.thethingsnetwork.org/forum/u/bnnorman)\
**Post date:** [May 7, 2022, 6:04am UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120/90 "2022-05-07T06:04:00Z")

</div>

I trust your indentation was correct (none shown on the paste)

Ok, that tells me that ‘mode’ is not valid, I expected it to be None - so what value is it?

I have modified LoRa.py and added a try-except in set\_mode(). It should now print a message telling us what the invalid value of ‘mode’ being requested is and ignore the error (since it’s a request to set an invalid mode). But I don’t know what is causing it since I only saw that error a couple of times a long time ago and can’t debug until it re-appears.

Please download the update from github , try it and let me know what is printed this time. Note, since the error should not now now crash the code it should continue and,hopefully, work.

---

<div class="post-metadata">

**Author:** ![mauriceatkinson](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/mauriceatkinson/32/35697_2.png) [@mauriceatkinson](https://www.thethingsnetwork.org/forum/u/mauriceatkinson)\
**Post date:** [May 7, 2022, 7:31am UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120/91 "2022-05-07T07:31:09Z")

</div>

Yes the indentation was correct. I still get an error:

pi@unit002:~/dragino-1 $ sudo ./test.py  
Mode ← SLEEP  
Mode ← FSK\_STDBY  
set\_mode KeyError error mode requested was 0  
Mode ← SLEEP  
Traceback (most recent call last):  
File “./test.py”, line 20, in   
D = Dragino(“dragino.toml”, logging\_level=logLevel)  
File “/home/pi/dragino-1/dragino/dragino.py”, line 122, in **init**  
assert self.get\_agc\_auto\_on() == 1  
AssertionError  
pi@unit002:~/dragino-1 $

The log file shows:2022-05-07 08:27:50,078 - **init** - 78 - INFO - **init** starting  
2022-05-07 08:27:50,511 - setCacheDefaults - 413 - INFO - Setting default MAC values using user config values  
2022-05-07 08:27:50,511 - getFrequencyPlan - 342 - INFO - loading frequency plan  
2022-05-07 08:27:50,516 - getFrequencyPlan - 345 - INFO - Frequency Plan is EU\_863\_870\_TTN  
2022-05-07 08:27:50,516 - getFrequencyPlan - 354 - INFO - Frequency Plan loaded ok  
2022-05-07 08:27:50,516 - setCacheDefaults - 479 - INFO - MAC default settings finished  
2022-05-07 08:27:50,516 - **init** - 104 - DEBUG - Setting self.cache[fCntUp] to 0  
2022-05-07 08:27:50,517 - **init** - 104 - DEBUG - Setting self.cache[fCntDn] to 0  
2022-05-07 08:27:50,517 - **init** - 104 - DEBUG - Setting self.cache[rx1\_delay] to 5  
2022-05-07 08:27:50,517 - **init** - 104 - DEBUG - Setting self.cache[rx2\_delay] to 1  
2022-05-07 08:27:50,517 - **init** - 104 - DEBUG - Setting self.cache[rx1\_DR] to 3  
2022-05-07 08:27:50,517 - **init** - 104 - DEBUG - Setting self.cache[rx2\_DR] to 3  
2022-05-07 08:27:50,517 - **init** - 108 - INFO - missing TTN section key rx1\_freq\_fixed ignored  
2022-05-07 08:27:50,517 - **init** - 108 - INFO - missing TTN section key rx1\_frequency ignored  
2022-05-07 08:27:50,517 - **init** - 104 - DEBUG - Setting self.cache[rx2\_frequency] to 869.525  
2022-05-07 08:27:50,518 - **init** - 108 - INFO - missing TTN section key duty\_cycle ignored  
2022-05-07 08:27:50,518 - **init** - 104 - DEBUG - Setting self.cache[data\_rate] to 3  
2022-05-07 08:27:50,518 - **init** - 116 - DEBUG - Setting self.cache[devaddr] to [0, 0, 0, 0]  
2022-05-07 08:27:50,518 - **init** - 116 - DEBUG - Setting self.cache[deveui] to [228, 95, 1, 255, 255, 134, 124, 64]  
2022-05-07 08:27:50,518 - **init** - 119 - INFO - Missing OTAA TTN key nwkskey ignored  
2022-05-07 08:27:50,518 - **init** - 119 - INFO - Missing OTAA TTN key appskey ignored  
2022-05-07 08:27:50,518 - **init** - 116 - DEBUG - Setting self.cache[appeui] to [0, 0, 0, 0, 0, 0, 0, 0]  
2022-05-07 08:27:50,519 - **init** - 116 - DEBUG - Setting self.cache[appkey] to [238, 56, 238, 131, 116, 102, 149, 88, 244, 3, 222, 236, 27, 201, 252, 179]  
2022-05-07 08:27:50,519 - loadCache - 524 - INFO - Loading MAC settings  
2022-05-07 08:27:50,519 - loadCache - 542 - INFO - cached settings load failed Expecting value: line 1 column 602 (char 601). Saving current defaults  
2022-05-07 08:27:50,519 - saveCache - 489 - INFO - Saving MAC settings  
2022-05-07 08:27:50,520 - saveCache - 495 - INFO - Saving MAC settings failed Object of type bytearray is not JSON serializable.  
2022-05-07 08:27:50,521 - saveCache - 489 - INFO - Saving MAC settings  
2022-05-07 08:27:50,522 - saveCache - 495 - INFO - Saving MAC settings failed Object of type bytearray is not JSON serializable.  
2022-05-07 08:27:50,522 - **init** - 141 - INFO - **init** done  
2022-05-07 08:27:50,522 - **init** - 96 - WARNING - Not enabling GPS (see enableGPS param)

---

<div class="post-metadata">

**Author:** ![descartes](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/descartes/32/47220_2.png) [@descartes](https://www.thethingsnetwork.org/forum/u/descartes)\
**Post date:** [May 7, 2022, 8:14am UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120/92 "2022-05-07T08:14:00Z")

</div>

> [@mauriceatkinson](#):
>
> Yes the indentation was correct

Please please please use the \</\> tool on the toolbar, not only will it show the indentation but it will also put the long logs in to a scrolling box - please see [guidelines](https://www.thethingsnetwork.org/forum/t/how-do-i-format-my-forum-post-howto/8735)

---

<div class="post-metadata">

**Author:** ![bnnorman](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bnnorman/32/35697_2.png) [@bnnorman](https://www.thethingsnetwork.org/forum/u/bnnorman)\
**Post date:** [May 7, 2022, 8:44am UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120/94 "2022-05-07T08:44:03Z")

</div>

Ok so it was trying to set an invalid mode 0 and not None. So now we have to find out why.

I think the code in rx\_chain\_calibration is trying to set the invalid mode from op\_mode\_bkup but that should be SLEEP. So could you add the following line after 840 in LoRa.py

```auto
sys.stderr.write(f"backups op_mode_bkup {op_mode_bkup} pa_config_bkup {pa_config_bkup} \n")

```

I have included pa\_config\_bkup to save time, in case I need the info.

If need be I’ll add a trace output to find out where it is getting clobbered but I must say that if your system worked before then something must have changed to cause this grief…

---

<div class="post-metadata">

**Author:** ![mauriceatkinson](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/mauriceatkinson/32/35697_2.png) [@mauriceatkinson](https://www.thethingsnetwork.org/forum/u/mauriceatkinson)\
**Post date:** [May 7, 2022, 12:12pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120/96 "2022-05-07T12:12:47Z")

</div>

No still got errors. I am going back to basics and rebuilding the sd card as something is obviously wrong.

---

<div class="post-metadata">

**Author:** ![bnnorman](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bnnorman/32/35697_2.png) [@bnnorman](https://www.thethingsnetwork.org/forum/u/bnnorman)\
**Post date:** [May 7, 2022, 1:45pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120/97 "2022-05-07T13:45:40Z")

</div>

My feelings too.

What was the reported value of op\_mode\_bkup?

---

<div class="post-metadata">

**Author:** ![mauriceatkinson](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/mauriceatkinson/32/35697_2.png) [@mauriceatkinson](https://www.thethingsnetwork.org/forum/u/mauriceatkinson)\
**Post date:** [May 7, 2022, 2:56pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120/98 "2022-05-07T14:56:00Z")

</div>

I am getting this error after I have installed Buster and [GitHub - computenodes/dragino: LoRaWAN implementation in python](https://github.com/computenodes/LoRaWAN.git).  
I am installing a previous version of buster to see if this still happens

```auto
pi@unit002:~/LoRaWAN $ ./test.py
Mode <- SLEEP
Mode <- FSK_STDBY
Traceback (most recent call last):
  File "./test.py", line 19, in <module>
    D = Dragino("dragino.ini", logging_level=logLevel)
  File "/home/pi/LoRaWAN/dragino/dragino.py", line 56, in __init__
    super(Dragino, self). __init__ (logging_level < logging.INFO)
  File "/home/pi/LoRaWAN/dragino/SX127x/LoRa.py", line 100, in __init__
    self.rx_chain_calibration(calibration_freq)
  File "/home/pi/LoRaWAN/dragino/SX127x/LoRa.py", line 854, in rx_chain_calibration
    self.set_mode(op_mode_bkup)
  File "/home/pi/LoRaWAN/dragino/SX127x/LoRa.py", line 221, in set_mode
    sys.stderr.write("Mode <- %s\n" % MODE.lookup[mode])
KeyError: 0
pi@unit002:~/LoRaWAN $

```

---

<div class="post-metadata">

**Author:** ![mauriceatkinson](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/mauriceatkinson/32/35697_2.png) [@mauriceatkinson](https://www.thethingsnetwork.org/forum/u/mauriceatkinson)\
**Post date:** [May 7, 2022, 5:05pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120/99 "2022-05-07T17:05:10Z")

</div>

I am at a loss. I have reinstalled Buster and installed the software as instructed. However in running the test.py I get the following returned:

```auto
pi@unit002:~/dragino-1 $ sudo python3 ./test.py
Mode <- SLEEP
backups op_mode_bkup 0 pa_config_bkup 0
Mode <- FSK_STDBY
set_mode KeyError error mode requested was 0
Mode <- SLEEP
Traceback (most recent call last):
  File "./test.py", line 20, in <module>
    D = Dragino("dragino.toml", logging_level=logLevel)
  File "/home/pi/dragino-1/dragino/dragino.py", line 122, in __init__
    assert self.get_agc_auto_on() == 1
AssertionError
pi@unit002:~/dragino-1 $

```

The change you wanted made to LoRa.py is as follows:

```auto
 # backup some registers
        op_mode_bkup = self.get_mode()
        pa_config_bkup = self.get_register(REG.LORA.PA_CONFIG)
        freq_bkup = self.get_freq()
        sys.stderr.write(f"backups op_mode_bkup {op_mode_bkup} pa_config_bkup {pa_config_bkup} \n")

```

---

<div class="post-metadata">

**Author:** ![bnnorman](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bnnorman/32/35697_2.png) [@bnnorman](https://www.thethingsnetwork.org/forum/u/bnnorman)\
**Post date:** [May 7, 2022, 5:17pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120/100 "2022-05-07T17:17:24Z")

</div>

If you follow the code it starts with dragino.py

```auto
**dragino.py**
1 BOARD.setup in board_config.py is called to setup GPIO
2 init in LoRa.py is called using super(Dragino, self). __init__ ()

**LoRa.py**
3 sets mode to SLEEP (as seen on the terminal)
4 creates a back up of the SX1276 registers 
5 calls rx_chain_calibration
5a creates a backup of the current mode (op_mode_bkup) and pa_config and frequency
5b sets mode to FSK_STDBY (as seen on the terminal)
5c does some LO/HI frequency stuff
5c calls set_mode using the op_ mode_bkup

```

and there it crashes in set\_mode() because the value of op\_mode\_bkup is zero - not a valid value.

op\_mode\_bkup is obtained from get\_mode() which does an SPI xfer of the sx1276’s mode register.

I think the answer to the problem is in get\_mode(), I think the SPI transfer has returned zero.

Have you forgotten to enable SPI on the pi?

Look at the readme installation section item 6

---

<div class="post-metadata">

**Author:** ![bnnorman](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bnnorman/32/35697_2.png) [@bnnorman](https://www.thethingsnetwork.org/forum/u/bnnorman)\
**Post date:** [May 7, 2022, 5:46pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120/102 "2022-05-07T17:46:42Z")

</div>

That’s awkward.

I have added a check in (my dragino-1 repo) to LoRa.py to check the mode returned from the modem is not zero. If it is the code will now exit with a message and not try to carry on.

One other possibility here is that the chip select pin isn’t driving the NSS pin on the sx1276 (bad connection). This could account for the problem still being there whatever you do.

You could write a simple python test to toggle that pin (GPIO 02). Have you tried re-seating the dragino HAT?

---

<div class="post-metadata">

**Author:** ![mauriceatkinson](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/mauriceatkinson/32/35697_2.png) [@mauriceatkinson](https://www.thethingsnetwork.org/forum/u/mauriceatkinson)\
**Post date:** [May 7, 2022, 5:58pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120/103 "2022-05-07T17:58:55Z")

</div>

yes I get your new error message.

```auto
pi@unit002:~/dragino-1 $ sudo python3 test.py
Mode <- SLEEP
Unable to set modem mode. Have you enabled SPI as per the readme installation section?
pi@unit002:~/dragino-1 $

```

Yes I have reset the dragino, checked the pins, and checked spi setup and all looks OK.

Writing a python test is beyond me as I am only good at following instructions 🙂

---

<div class="post-metadata">

**Author:** ![bnnorman](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bnnorman/32/35697_2.png) [@bnnorman](https://www.thethingsnetwork.org/forum/u/bnnorman)\
**Post date:** [May 7, 2022, 6:37pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120/104 "2022-05-07T18:37:29Z")

</div>

HOW did you check the continuity between the Pi GPIO pins and the Dragino pins?

This should toggle the CS pin High then low with 1 second delay between.

```auto
import RPi.GPIO as GPIO
import time

GPIO.setwarnings (False)
GPIO.setmode(GPIO.BCM)
PIN = 2
GPIO.setup(PIN,GPIO.OUT)

while True:
    GPIO.output(PIN,True)
    time.sleep(1)
    GPIO.output(PIN,False)
    time.sleep(1)

```

You should see that changing the level on the NSS pin. If you don’t have a meter you could , if you have them, use an LED in series with a 300 ohm resistor to check for activity.

You could also monitor pin 10 (MOSI), 9 (MISO) and 11 (SCLK).

[Previous page](https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120.md?page=4)

[Next page](https://www.thethingsnetwork.org/forum/t/how-to-add-dragino-lora-gps-hat-to-v3/48120.md?page=6)
