How to add Dragino Lora/gps HAT to V3

@Jeff-UK That was going to be my first question too.
@mauriceatkinson That snippet of the log file simply indicates the device hasn’t joined yet, it would have a devaddr if it had.

I would need to see ALL the log file for the session (get rid of previous stuff and start clean)

In the past, before I got my gateway back on V3, I had a similar problem. My transmissions were seen 11Km away but the replies well, probably bounced off some buildings and went into space. Fixed as soon as my gateway was back up and running.

My project is on hold for the moment - the local council are not the fastest at implementing anything so it’s been about 5 months since I last revisited this code and am a tad rusty.

@Jeff-UK the sensor and the ttn gateway are in adjoining rooms. The rssi is -51

@bnnorman see below the test.log

2023-02-26 18:00:45,367 - __init__ - 78 - INFO - __init__ starting
2023-02-26 18:00:45,796 - setCacheDefaults - 413 - INFO - Setting default MAC values using user config values
2023-02-26 18:00:45,796 - getFrequencyPlan - 342 - INFO - loading frequency plan
2023-02-26 18:00:45,796 - getFrequencyPlan - 345 - INFO - Frequency Plan is EU_863_870_TTN
2023-02-26 18:00:45,797 - getFrequencyPlan - 354 - INFO - Frequency Plan loaded ok
2023-02-26 18:00:45,797 - setCacheDefaults - 479 - INFO - MAC default settings finished
2023-02-26 18:00:45,797 - __init__ - 104 - DEBUG - Setting self.cache[fCntUp] to 0
2023-02-26 18:00:45,797 - __init__ - 104 - DEBUG - Setting self.cache[fCntDn] to 0
2023-02-26 18:00:45,797 - __init__ - 104 - DEBUG - Setting self.cache[rx1_delay] to 5
2023-02-26 18:00:45,798 - __init__ - 104 - DEBUG - Setting self.cache[rx2_delay] to 1
2023-02-26 18:00:45,798 - __init__ - 104 - DEBUG - Setting self.cache[rx1_DR] to 3
2023-02-26 18:00:45,798 - __init__ - 104 - DEBUG - Setting self.cache[rx2_DR] to 3
2023-02-26 18:00:45,798 - __init__ - 108 - INFO - missing TTN section key rx1_freq_fixed ignored
2023-02-26 18:00:45,798 - __init__ - 108 - INFO - missing TTN section key rx1_frequency ignored
2023-02-26 18:00:45,798 - __init__ - 104 - DEBUG - Setting self.cache[rx2_frequency] to 869.525
2023-02-26 18:00:45,798 - __init__ - 108 - INFO - missing TTN section key duty_cycle ignored
2023-02-26 18:00:45,799 - __init__ - 104 - DEBUG - Setting self.cache[data_rate] to 3
2023-02-26 18:00:45,799 - __init__ - 116 - DEBUG - Setting self.cache[devaddr] to [0, 0, 0, 0]
2023-02-26 18:00:45,799 - __init__ - 116 - DEBUG - Setting self.cache[deveui] to [228, 95, 1, 255, 255, 134, 124, 64]
2023-02-26 18:00:45,799 - __init__ - 119 - INFO - Missing OTAA TTN key nwkskey ignored
2023-02-26 18:00:45,799 - __init__ - 119 - INFO - Missing OTAA TTN key appskey ignored
2023-02-26 18:00:45,799 - __init__ - 116 - DEBUG - Setting self.cache[appeui] to [0, 0, 0, 0, 0, 0, 0, 0]
2023-02-26 18:00:45,799 - __init__ - 116 - DEBUG - Setting self.cache[appkey] to [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
2023-02-26 18:00:45,800 - loadCache - 524 - INFO - Loading MAC settings
2023-02-26 18:00:45,800 - loadCache - 542 - INFO - cached settings load failed [Errno 2] No such file or directory: 'cache.json'. Saving current defaults
2023-02-26 18:00:45,800 - saveCache - 489 - INFO - Saving MAC settings
2023-02-26 18:00:45,801 - saveCache - 495 - INFO - Saving MAC settings failed Object of type bytearray is not JSON serializable.
2023-02-26 18:00:45,801 - saveCache - 489 - INFO - Saving MAC settings
2023-02-26 18:00:45,802 - saveCache - 495 - INFO - Saving MAC settings failed Object of type bytearray is not JSON serializable.
2023-02-26 18:00:45,803 - __init__ - 141 - INFO - __init__ done
2023-02-26 18:00:45,803 - __init__ - 96 - WARNING - Not enabling GPS (see enableGPS param)
2023-02-26 18:00:45,804 - __init__ - 133 - INFO - __init__ done
2023-02-26 18:00:45,804 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:00:45,804 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:00:45,804 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:00:45,805 - join - 484 - INFO - Performing OTAA Join
2023-02-26 18:00:45,805 - getJoinSettings - 230 - DEBUG - using join settings: freq 868.5 sf 9 bw 7
2023-02-26 18:00:45,805 - configureRadio - 173 - INFO -  freq=868.5 sf=9 bw=7
2023-02-26 18:00:45,807 - _tryToJoin - 497 - INFO - trying to join TTN
2023-02-26 18:00:45,807 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:00:45,807 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:00:45,807 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:00:45,807 - _tryToJoin - 507 - DEBUG - App key = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
2023-02-26 18:00:45,807 - _tryToJoin - 508 - DEBUG - App eui = [0, 0, 0, 0, 0, 0, 0, 0]
2023-02-26 18:00:45,808 - _tryToJoin - 509 - DEBUG - Dev eui = [228, 95, 1, 255, 255, 134, 124, 64]
2023-02-26 18:00:45,808 - _tryToJoin - 510 - DEBUG - Devnonce= [231, 156]
2023-02-26 18:00:45,809 - _tryToJoin - 521 - DEBUG - sending packet [0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 124, 134, 255, 255, 1, 95, 228, 231, 156, 190, 168, 14, 231]
2023-02-26 18:00:45,810 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:00:45,810 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:00:45,810 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:00:47,812 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:00:47,813 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:00:47,813 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:00:49,815 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:00:49,816 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:00:49,816 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:00:51,819 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:00:51,819 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:00:51,819 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:00:53,822 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:00:53,822 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:00:53,822 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:00:55,825 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:00:55,825 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:00:55,825 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:00:57,828 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:00:57,828 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:00:57,828 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:00:59,831 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:00:59,831 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:00:59,831 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:01,834 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:01,834 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:01,835 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:03,837 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:03,838 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:03,838 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:05,840 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:05,841 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:05,841 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:07,843 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:07,844 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:07,844 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:09,846 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:09,847 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:09,847 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:11,849 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:11,850 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:11,850 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:13,852 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:13,853 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:13,853 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:15,855 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:15,856 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:15,856 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:17,859 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:17,859 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:17,859 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:19,862 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:19,862 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:19,862 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:21,865 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:21,865 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:21,865 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:23,868 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:23,868 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:23,868 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:25,871 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:25,871 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:25,871 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:27,874 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:27,874 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:27,874 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:29,877 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:29,877 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:29,878 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:31,880 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:31,880 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:31,881 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:33,883 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:33,883 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:33,884 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:35,886 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:35,886 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:35,887 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:37,889 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:37,889 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:37,890 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:39,892 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:39,893 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:39,893 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:41,895 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:41,896 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:41,896 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:43,898 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:43,899 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:43,899 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:45,901 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:45,902 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:45,902 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:47,904 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:47,905 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:47,905 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:49,907 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:49,908 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:49,908 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:51,910 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:51,911 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:51,911 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:53,914 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:53,914 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:53,914 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:55,917 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:55,917 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:55,917 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:57,920 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:57,920 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:57,920 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:01:59,923 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:01:59,923 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:01:59,923 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:01,926 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:01,926 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:01,927 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:03,929 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:03,929 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:03,930 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:05,932 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:05,933 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:05,933 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:07,935 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:07,936 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:07,936 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:09,938 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:09,939 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:09,939 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:11,941 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:11,942 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:11,942 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:13,944 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:13,945 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:13,945 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:15,948 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:15,948 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:15,948 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:17,951 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:17,951 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:17,951 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:19,954 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:19,954 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:19,954 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:21,957 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:21,957 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:21,958 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:23,960 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:23,961 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:23,961 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:25,963 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:25,964 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:25,964 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:27,967 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:27,967 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:27,967 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:29,970 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:29,970 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:29,971 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:31,973 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:31,973 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:31,974 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:33,976 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:33,976 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:33,977 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:35,979 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:35,979 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:35,980 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:37,982 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:37,983 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:37,983 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:39,985 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:39,986 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:39,986 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:41,988 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:41,989 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:41,989 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:43,991 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:43,992 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:43,992 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:45,994 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:45,995 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:45,995 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:47,997 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:47,998 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:47,998 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:50,000 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:50,001 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:50,001 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:52,003 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:52,004 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:52,004 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:54,007 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:54,007 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:54,007 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:56,010 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:56,010 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:56,010 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:02:58,013 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:02:58,013 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:02:58,013 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:03:00,016 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:03:00,016 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:03:00,016 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:03:02,019 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:03:02,019 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:03:02,020 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:03:04,022 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:03:04,023 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:03:04,023 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:03:06,025 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:03:06,026 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:03:06,026 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:03:08,028 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:03:08,029 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:03:08,029 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:03:10,032 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:03:10,032 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:03:10,032 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:03:12,035 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:03:12,035 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:03:12,035 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:03:14,038 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:03:14,038 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:03:14,038 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:03:16,040 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:03:16,040 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:03:16,040 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:03:18,043 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:03:18,043 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:03:18,043 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:03:20,046 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:03:20,046 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:03:20,046 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:03:22,049 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:03:22,049 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:03:22,049 - registered - 564 - DEBUG - devaddr not assigned 
2023-02-26 18:03:24,052 - registered - 550 - INFO - checking if already registered.
2023-02-26 18:03:24,052 - registered - 556 - INFO - devaddr [0, 0, 0, 0] len 4.
2023-02-26 18:03:24,052 - registered - 564 - DEBUG - devaddr not assigned

Most common reasons for nodes not joining, the RSSI is to high causing channel bleed and overloading the RX front-end. Move the node 10m to 15km from the gateway and preferably if the distance is short have a brick wall inbetween. RSSI need to be below -60 or so preferably.

@Johan_Scheepers thanks for info. The sensor was about 500m away from the gateway today and it was still not working. I brought it indoors to debug.

Look for RSSI values from -65 to -95, reality is -50 to -112 ‘should’ be ok but helps eliminate any uncertainty.

How is node configured/registered in TTN console - RX1 & Rx2 windows set the same both ends?

How are the gateway connected to the internet? If the latency is to high the downlink arrives after the node have stop listening for it.

I would check this to make sure it is acceptable.

my rak 7268v2 gateway is connected to my home router via ethernet. The internet speedtest shows 92mbps download and upload speed with ping time of 12ms. The internet looks good to me

@mauriceatkinson

Ref this entry …

2023-02-26 18:00:45,801 - saveCache - 495 - INFO - Saving MAC settings failed Object of type bytearray is not JSON serializable.

Something is corrupted here. this is raised by the json.dumps() call, I think.The cache contains the MAC settings for joining and caches the devaddr when joined. This hasn’t happened because of the corruption.

I’m guessing that something in your Dragino.toml file is causing this.

Ok, so in the file dragino/MAChandler.py at line 484 you will find the method saveCache(self). If you put a print statement as below and re attempt we should get an idea what is blowing it up.

def saveCache(self):
        """
        MAC commands received from TTN alter device behaviour
        """
        try:
            self.logger.info("Saving MAC settings")
            print("CACHE:",self.cache)   # <---------------- Add this line

``

Alternatively let us see your dragino.toml config file.

Regards

see dragino.toml file below

# dragino.toml
#
# The [TTN] section here contains only default starting values/keys for which are used to create cache.json, if it doesn't exist,
# when the code first runs.
#
# After joining TTN, cache.json is updated with the TTN supplied devaddr and keys etc.
#
#
# if auth_mode="OTAA":-
# If cache.json does not exist the code will try to send a JOIN_REQUEST only if devaddr = [0x00, 0x00,x00,x00]
# However, if cache.json exists the code will use the values therein and not try to send a JOIN_REQUEST
#
# if auth_mode="ABP":-
# you must provide all the TTN keys etc in the [TTN.ABP] section


[GPSD]
	threaded=true		# non-blocking operation get_gps() will return last cached valid reading
	threadLoopDelay=0.5	# number of seconds to check GPS for a valid reading

[TTN]
	# uplink frequency is randomly selected
	# warning MOST values may be modified by downlink MAC commands
	# from the server and will be cached
	
	mac_cache="cache.json"
	device_class="A"			# class B & C not yet supported

	frequency_plan = "EU_863_870_TTN"


	# radio settings
	max_power = 0x0F  			# can be changed by MAC command linkADR
	output_power = 0x0E			# current level
	sync_word = 0x34
	rx_crc = true
	
	# if the device does not recieve a msg in RX1 or RX2 then
	# send the same message again
	# TTN ignores repeated messages
	
	join_retries = 3
	join_timeout = 10	# time to wait after tx before next retry

	# initial data rate setting
	# MAC commands may change this
	
	data_rate = 3
	
	# RX1 is normally the same as the uplink settings
	# but can be changed by MAC commands
	rx1_delay=5
	rx1_DR=3
	
	
	# In EU RX2 is normally a fixed frequency & datarate
	# but can be modified by MAC commands
	rx2_DR=3
	rx2_frequency=869.525
	rx2_delay=1				# follows from end of rx1_delay
	
	rx_window=1				# duration of receive windows
	
	# these are updated on each transaction and cached by MAChandler
	fCntUp=0				# initial uplink message frame counters
	fCntDn=0				# set by TTN server

	auth_mode = "OTAA"

	# if not using ABP or OTAA you can omit the unused section
    # keys are MSB first order
	
	[TTN.OTAA]
		# received session key values are stored by MAChandler
		# enter your OTAA keys here
		deveui = [0xe4,0x5f,0x01,0xff,0xff,0x86,0x7c,0x40]
		appeui = [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
		appkey = [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01]
		devaddr= [0x00, 0x00, 0x00, 0x00] # not joined
	[TTN.ABP]
		# enter your device ABP key values below
		devaddr = [0x00,0x00,0x00,0x00]
		nwskey = [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
		appskey = [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
		appkey = [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
		appeui = [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00] 
		deveui = [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]

# frequency plans
# max of 16 channels supported in some regions.
# read the LoRaWAN Regional Parameters Specification if you want to create
# your own frequency plan - provided it works in a similar way
# the US902-928 plan uses 71 uplink channels but only 8 downlink channels

[EU_863_870_TTN]

	max_channels=8
	max_dr_offset=5 # see rx1_DR_offset_table
	max_dr_index=7	# see data_rates list
	
	# ref LoRa Alliance specification Physical Layer para 7.1
	#
    # In UK join frequencies are a restricted selection of lora_tx_freqs
	lora_join_freqs=[868.1,868.3,868.5]
	lora_tx_freqs = [868.1,868.3,868.5,867.1,867.3,867.5,868.7,867.9]
    # in UK the RX1 frequency is the same as the TX freq but that
	# may not be the case in your frequency plan
	lora_rx1_freqs=[868.1,868.3,868.5,867.1,867.3,867.5,868.7,867.9]

	TXPower=[20,14,11,8,5,2] # 6->15 are RFU

	# all the possible bandwidths however only 125 & 250 are used. See data_rates
	# the radio method set_bw(index) uses the position of the value (0..9)
	# TOML doesn't like mixed int and float
	bandwidths=[7.8, 10.4, 15.6, 20.8, 31.25, 41.7, 62.5, 125.0, 250.0, 500.0] # kHz
	
	# DR0 to DR6 (sf,bw) where bw is 0-9 (see bandwidths above)
	data_rates=[[12,7],[11,7],[10,7],[9,7],[8,7],[7,7],[7,8]]

	sf_range=[7,12]

	duty_cycle_range=[0.1,1.0]	# min/max all floats
	
	# ETSI sub bands
	# These sub bands have different maxEIRP and Duty Cycles though TTN only uses
	# the first entry
	# (minFreq,maxFreq,maxDC)
	duty_cycle_table=[[863.0,868.0,1.0],[868.0,868.6,1.0],[868.7,869.2,0.1],[869.4,869.65,10.0],[869.7,870.0,1.0]]
	
	# rows range DR0 to DR7
	# columns are offsets 0..5
	DR_offset_table=[
		[0,0,0,0,0,0],
		[1,0,0,0,0,0],
		[2,1,0,0,0,0],
		[3,2,1,0,0,0],
		[4,3,2,1,0,0],
		[5,4,3,2,1,0],
		[6,5,4,3,2,1],
		[7,6,5,4,3,2]
	]
	
	# EIRP db settings
	maxEIRP=[8,10,12,13,14,16,18,20,21,24,26,27,29,30,33,36]

[AU_915_928_FSB_2]

	max_channels=8
	max_dr_offset=5 # see rx1_DR_offset_table
	max_dr_index=14	# see data_rates list

	# ref LoRa Alliance specification Physical Layer para 7.1
	#
    # In UK join frequencies are a restricted selection of lora_tx_freqs
	lora_join_freqs = [916.8,917.0,917.2,917.4,917.6,917.8,918.0,918.2]
	lora_tx_freqs = [916.8,917.0,917.2,917.4,917.6,917.8,918.0,918.2]

    # in UK the RX1 frequency is the same as the TX freq but that
	# may not be the case in your frequency plan
	lora_rx1_freqs=[923.3,923.9,924.5,925.1,925.7,926.3,926.9,927.5]

	TXPower=[20,14,11,8,5,2] # 6->15 are RFU

	# all the possible bandwidths however only 125 & 250 are used. See data_rates
	# the radio method set_bw(index) uses the position of the value (0..9)
	# TOML doesn't like mixed int and float
	bandwidths=[7.8, 10.4, 15.6, 20.8, 31.25, 41.7, 62.5, 125.0, 250.0, 500.0] # kHz

	# DR0 to DR6 (sf,bw) where bw is 0-9 (see bandwidths above)
	data_rates=[
			[12,7],  # ch 0
			[11,7],
			[10,7],
			[9,7],
			[8,7],
			[7,7],
			[8,9],
			[8,9,],	#rfu
			[12,9],
			[11,9],
			[10,9],
			[9,9],  # ch11 RX2/RX1
			[8,9],
			[7,9],
			[7,9],   #rfu
			[7,9],   #rfu
			]

	sf_range=[7,12]

	# no limit in Australia
	duty_cycle_range=[0.0,100.0]	# min/max all floats, the code does not enforce

	# ETSI sub bands
	# These sub bands have different maxEIRP and Duty Cycles though TTN only uses
	# the first entry
	# in AUSTRALIA there is no duty cycle limit
	# (minFreq,maxFreq,maxDC)
	duty_cycle_table=[[916.8,918.2,100.0]] # the code checks but does not enforce

	# rows range DR0 to DR7
	# columns are offsets 0..5
	DR_offset_table=[
	   [8,8,8,8,8,8],
	   [9,8,8,8,8,8],
	   [10,9,8,8,8,8],
	   [11,10,9,8,8,8],
	   [12,11,10,9,8,8],
	   [13,12,11,10,9,8],
	   [13,13,12,11,10,9],
	   [9,8,8,8,8,8]
	]


	# EIRP db settings
	maxEIRP=[8,10,12,13,14,16,18,20,21,24,26,27,29,30,33,36]

Is anybody using a decent replacement for the Dragino lora/gps hat for the pi? It is no longer available to buy so looking for something new.

I made one with just an RFM95 on a breadboard HAT - no GPS - it works. Check board_config.py for CS & DIOx pins. The DTOverlay determines the SPI pins IIRC

The wiring is simple, it’s just SPI but they chose BCOM pin 2 for the CS.

I made a KiCAD pcb design (not actual PCB) for a dragino with GPS. This will give you the pins.

Without GPS you only need RST,MOSI,MISO,SCK,DIO0,DIO1,DIO2,NSS

1 Like

Not in Aus but Raspberry Pi LoRa/GPS HAT - RobotShop is expecting 868 versions in on 12th Sept. So ought to be available. They are being made by seedstudio.

I thought the sx127x would run at any frequency 100-1000mhz so I don’t know why they are sold as 868 maybe its just marketting.

1 Like

RF components on the output side usually - 868 & 915 are generally close enough for a non-optimal board.

Uputronics have a board for both full size & zero formats:

Totally recommended.

1 Like

I might buy one…next month…to investigate it.

I am seeing a reoccurrence of this issue again. Last time I changed the dragino board and the problem resolved itself. I have now changed out two dragino boards and the problem still occurs running the ./test.py command. Of course it could be two faulty boards but these were both new and working ok before suddenly stopped with this error.

any ideas much appreciated!!

pi@unit003:~/water-quality-lorawan-dragino-pi/dragino $ ./test.py
Mode <- SLEEP
Mode <- FSK_STDBY
Traceback (most recent call last):
  File "./test.py", line 20, in <module>
    D = Dragino("dragino.toml", logging_level=logLevel)
  File "/home/pi/water-quality-lorawan-dragino-pi/dragino/dragino/dragino.py", line 85, in __init__
    super(Dragino, self).__init__() # LoRa init
  File "/home/pi/water-quality-lorawan-dragino-pi/dragino/dragino/SX127x/LoRa.py", line 100, in __init__
    self.rx_chain_calibration(calibration_freq)
  File "/home/pi/water-quality-lorawan-dragino-pi/dragino/dragino/SX127x/LoRa.py", line 854, in rx_chain_calibration
    self.set_mode(op_mode_bkup)
  File "/home/pi/water-quality-lorawan-dragino-pi/dragino/dragino/SX127x/LoRa.py", line 221, in set_mode
    sys.stderr.write("Mode <- %s\n" % MODE.lookup[mode])
KeyError: 0

I replied to this at least two weeks ago on a PM reply to your PM but I have not heard back. Have you fixed it.

For the benefit of other readers:-

Somewhere in your version of the code you are trying to put the RFM9x to sleep using mode 0 (Key Error: 0), which isn’t a LoRa sleep mode listed in Constants.py. It should be 0x81 (i.e. MODE.SLEEP is defined in Constants.py as 0x81 not 0x00).

MODE.lookup[mode])

Would then return a string and not fall over.

sorry I never saw your dm reply.

The workaround I used was to swap out the dragino board and this worked for a couple of days before the problem reappeared. I then swapped out the board for the orginal one and this worked again (and is still working).

I looked at the code in LoRa.py and see this section with MODE.lookup[mode]) but I dont see this defined as 0x00.

In Constant.py the MODE.SLEEP is defined as 0X80

So I suppose I cannot find what you are saying needs to be changed, what am I doing wrong?

    def set_mode(self, mode):
        """ Set the mode
        :param mode: Set the mode. Use constants.MODE class
        :return:    New mode
        """
        # the mode is backed up in self.mode
        if mode == self.mode:
            return mode
        if self.verbose:
            sys.stderr.write("Mode <- %s\n" % MODE.lookup[mode])
        self.mode = mode
        return self.spi.xfer([REG.LORA.OP_MODE | 0x80, mode])[1]

When writing to the SX127x mode register (0x01)

0x80 = Sleep
0x81 = STDBY (Idle)

This should mask the problem but it would be better to know where the code is getting a mode value of 0 from when it should be 0x80

sys.stderr.write("Mode <- %s\n" % MODE.lookup[mode | 0x80])

or we could try raising an exception which should give a traceback showing where the value of mode was set to zero.

 def set_mode(self, mode):
        """ Set the mode
        :param mode: Set the mode. Use constants.MODE class
        :return:    New mode
        """
        # the mode is backed up in self.mode
        if mode == self.mode:
            return mode

      if mode==0:
            raise Exception("Invalid mode value")

        if self.verbose:
            sys.stderr.write("Mode <- %s\n" % MODE.lookup[mode])
        self.mode = mode
        return self.spi.xfer([REG.LORA.OP_MODE | 0x80, mode])[1]

I find it hard to believe the Dragino RFM95’s are developing faults.