Compare commits

...

No commits in common. '135b80cf3ffd34dbe338d52bb8a481f044f0d0ac' and '971bbef5dddf0d5f11faa6dbaadd1385691e75ca' have entirely different histories.

  1. 8
      CHANGELOG.md
  2. 26
      KissHelper.py
  3. 20
      README.md
  4. 4318
      images/RPi_LoRa_shield.svg
  5. BIN
      pySX127x/SX127x/__pycache__/LoRa.cpython-39.pyc
  6. BIN
      pySX127x/SX127x/__pycache__/__init__.cpython-39.pyc
  7. BIN
      pySX127x/SX127x/__pycache__/board_config.cpython-39.pyc
  8. BIN
      pySX127x/SX127x/__pycache__/constants.cpython-39.pyc

@ -36,11 +36,3 @@ All notable changes to this project will be documented in this file.
### Removed
- Config.py as configuration is now completely removed. Configuration is now done completely via RPi-LoRa-KISS-TNC.ini
## [0.0.4] - 2024-01-18
Should now be possible to use it as a real digipeater with aprx software
### Fixed
- Added '*' to LoRa APRS TX string when the 'has-been-repeated' flag of the repeater(s) in the AX.25 frame is set.
- Proper handling of 'has-been-repeated' asterix in LoRa RX frames, also when no SSID is received

@ -30,7 +30,6 @@
#
# 2022-01-23: - in encode_address() added correct handling of has_been_repeated flag '*'
# 2022-01-28: - in encode_kiss() and encode_address(): better exeption handling for corrupted or mal-formatted APRS frames
# 2024-01-18: - in decode_kiss() add '*' to call when 'has-been-repeated' flag is set for reapeters
#
import struct
@ -45,15 +44,6 @@ KISS_TFESC = 0xDD # If after an escape, means there was an 0xDB in the source m
# If it's the final address in the header, set the low bit to 1
# Ignoring command/response for simple example
def encode_address(s, final):
encoded_ssid = 0b00000000
# First we check if the call has the 'has_been_repeated' asterix at the ended.
# If so, set the 'has_been_repeated' flag and remove the asterix
if s[-1] == 42:
s = s[:-1]
encoded_ssid |= 0b10000000
if b"-" not in s:
s = s + b"-0" # default to SSID 0
call, ssid = s.split(b'-')
@ -61,6 +51,19 @@ def encode_address(s, final):
call = call + b" "*(6 - len(call)) # pad with spaces
encoded_call = [x << 1 for x in call[0:6]]
encoded_ssid = 0b00000000
# If ssid ends with *, the message has been repeated, so we have to set the 'has_been_repeated' flag and remove the * from the ssid
if ssid[-1] == 42:
# print("Message has been repeated")
ssid = ssid[:-1]
encoded_ssid |= 0b10000000
# If SSID was not pressent (and we added the default -0 to it), the has_been_repeated flag could be at the end of the call, so check that as well
# Also, there is a lot of bad software around (including this code) and ignorance of the specifications (are there any specs for LoRa APRS?), so always check for the has_been_repeated flag
if call[-1] == 42:
call = call[:-1]
encoded_ssid |= 0b10000000
# SSID should now be one or two postions long and contain a number (idealy between 0 and 15).
if len(ssid) == 1 and ssid[0] > 47 and ssid[0] < 58:
encoded_ssid |= (int(ssid) << 1) | 0b01100000 | (0b00000001 if final else 0)
@ -191,9 +194,6 @@ def decode_kiss(frame):
# print("RPT: ", rpt_addr)
pos += 7
result += b"," + rpt_addr.strip()
# Add repeater flag if set
if (rpt_hrr & 0x04) == 0x04:
result += b"*"
result += b":"

@ -1,34 +1,14 @@
# Raspberry Pi LoRa KISS TNC
This project adds LoRa APRS to the Raspberry Pi. It is fully integrated in the Linux AX.25 stack for maximum flexibility.
This project was originally started by Tom Kottek (https://github.com/tomelec/RPi-LoRa-KISS-TNC). Because the program had some problems dealing with digipeated frames (it crashed when receiving a ssid with the 'has_been_digipeated' flag -*- set), I took on the task of fixing the code for my personal use.
The software is stable and can handle repeated frames (incomming and outgoing) so it can be used with the aprx software to make a digipeater.
## Software
The software controls the LoRa transceiver connected to the Raspberry´s SPI bus and emulates a KISS TNC over TCP. That makes it possible to use existing software like APRX. It is also possible to attach the KISS interface to the AX.25 stack via socat/kissattach.
Assuming you installed and configured the AX.25 stack, start the LoRa KISS TNC with these commands:
#!/bin/bash
# Start TNC software
/usr/bin/python3 ~/RPi-LoRa-KISS-TNC/Start_lora-tnc.py &
sleep 10
# Attach TCP socket to virtual tty device located at /tmp/lorakisstnc
sudo /usr/bin/socat PTY,raw,echo=0,link=/tmp/lorakisstnc TCP4:127.0.0.1:10001 &
sleep 3
# Attach virtual tty to AX.25 stack (port ax2)
sudo /usr/sbin/kissattach /tmp/lorakisstnc ax2 &
## Hardware
[![How to connect LoRa module to Raspberry Pi](./images/RPi_LoRa_shield.svg)](./images/RPi_LoRa_shield.svg)
I also designed my own (open source) hardware for it: a board holding a Raspberry Pi Zero 2 W, an SX1278 LoRa transceiver and a power supply with on/off button to safely switch on and off the system. The design files can be found on my website: [RPi LoRa_shield](https://meezenest.nl/mees/RPi_LoRa_shield.html)
### To Do
* Add raw TCP KISS socket for true AX.25 over KISS

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 172 KiB

Loading…
Cancel
Save