Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1c7a4679a0 | ||
![]() |
135b80cf3f |
@@ -36,3 +36,11 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- Config.py as configuration is now completely removed. Configuration is now done completely via RPi-LoRa-KISS-TNC.ini
|
- 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,6 +30,7 @@
|
|||||||
#
|
#
|
||||||
# 2022-01-23: - in encode_address() added correct handling of has_been_repeated flag '*'
|
# 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
|
# 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
|
import struct
|
||||||
@@ -44,6 +45,15 @@ 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
|
# If it's the final address in the header, set the low bit to 1
|
||||||
# Ignoring command/response for simple example
|
# Ignoring command/response for simple example
|
||||||
def encode_address(s, final):
|
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:
|
if b"-" not in s:
|
||||||
s = s + b"-0" # default to SSID 0
|
s = s + b"-0" # default to SSID 0
|
||||||
call, ssid = s.split(b'-')
|
call, ssid = s.split(b'-')
|
||||||
@@ -51,19 +61,6 @@ def encode_address(s, final):
|
|||||||
call = call + b" "*(6 - len(call)) # pad with spaces
|
call = call + b" "*(6 - len(call)) # pad with spaces
|
||||||
encoded_call = [x << 1 for x in call[0:6]]
|
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).
|
# 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:
|
if len(ssid) == 1 and ssid[0] > 47 and ssid[0] < 58:
|
||||||
encoded_ssid |= (int(ssid) << 1) | 0b01100000 | (0b00000001 if final else 0)
|
encoded_ssid |= (int(ssid) << 1) | 0b01100000 | (0b00000001 if final else 0)
|
||||||
@@ -194,6 +191,9 @@ def decode_kiss(frame):
|
|||||||
# print("RPT: ", rpt_addr)
|
# print("RPT: ", rpt_addr)
|
||||||
pos += 7
|
pos += 7
|
||||||
result += b"," + rpt_addr.strip()
|
result += b"," + rpt_addr.strip()
|
||||||
|
# Add repeater flag if set
|
||||||
|
if (rpt_hrr & 0x04) == 0x04:
|
||||||
|
result += b"*"
|
||||||
|
|
||||||
result += b":"
|
result += b":"
|
||||||
|
|
||||||
|
20
README.md
20
README.md
@@ -1,14 +1,34 @@
|
|||||||
# Raspberry Pi LoRa KISS TNC
|
# 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.
|
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
|
## 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.
|
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
|
## Hardware
|
||||||
|
|
||||||
|
[](./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)
|
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
|
### To Do
|
||||||
|
|
||||||
* Add raw TCP KISS socket for true AX.25 over KISS
|
* Add raw TCP KISS socket for true AX.25 over KISS
|
||||||
|
@@ -1,3 +1,8 @@
|
|||||||
|
######
|
||||||
|
# THIS CONFIGURATION FILE IS NOW OBSOLETE!
|
||||||
|
# CONFIGURATION IS DONE VIA RPi-LoRa-KISS-TNC.ini
|
||||||
|
#####
|
||||||
|
|
||||||
## KISS Settings
|
## KISS Settings
|
||||||
# Where to listen?
|
# Where to listen?
|
||||||
# TCP_HOST can be "localhost", "0.0.0.0" or a specific interface address
|
# TCP_HOST can be "localhost", "0.0.0.0" or a specific interface address
|
||||||
|
4318
images/RPi_LoRa_shield.svg
Normal file
4318
images/RPi_LoRa_shield.svg
Normal file
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 172 KiB |
Reference in New Issue
Block a user