Skip to content

Instantly share code, notes, and snippets.

@M0LTE
Last active March 27, 2023 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save M0LTE/d62b4f4a2a9c603d90b6b76a4b4b490b to your computer and use it in GitHub Desktop.
Save M0LTE/d62b4f4a2a9c603d90b6b76a4b4b490b to your computer and use it in GitHub Desktop.
Idea for using FreeDV's data API as a drop-in replacement for KISS modems

KISS is a super simple framing technique for packet radio TNCs.

Simplistically, a KISS TNC can be commanded to send an AX.25 frame out of its first (or only) port by prefixing it with 0xC0 0x00. See http://www.symek.com/g/smack.html

As well as KISS over serial, BPQ can do KISS over TCP or UDP. I assume the Linux kernel can too.

FreeDV (codec2) has a data transmission API. Codec2 ships with a pair of minimalistic demo programs for transmitting and receiving arbitrary data through FreeDV via stdin/out. The transmit program takes data on stdin and outputs audio bytes to stdout. The receive program takes audio bytes on stdin and outputs the original data on stdout.

Source of the two programs:

https://github.com/drowe67/codec2/blob/master/demo/freedv_datac1_tx.c

https://github.com/drowe67/codec2/blob/master/demo/freedv_datac1_rx.c

As a proof of concept, a simple-ish wrapper program could be created which:

  • accepts a TCP or UDP connection from BPQ (or kissattach / kernel)
  • watches for KISS frames and removes the framing
  • runs the AX.25 frame through the transmit program
  • keys up the radio (hamlib), waits for some configurable TX delay
  • sends the audio bytes to the sound card
  • wait for some configurable periodm, unkey the radio

Similar on receive, though the receive program would need to be continuously listening to audio for frames (and outputting them to the application/driver) rather than working on pre-chopped up chunks of audio bytes.

Once the concept is proven, libcodec2 could be interfaced directly instead of using the intermediate programs.

For proving the concept, the radios and ptts could be eliminated and just use two sound cards connected back to back instead.

One thing that would need implementing would be some form of carrier detect so that the modem doesn't start to transmit while there's an incoming signal. That might need some kind of change inside libcodec2 itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment