From 5fd79a3e82da9fd4daabfb72e4cab749950eff08 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Thu, 21 May 2015 10:42:03 +0200 Subject: [PATCH] Updated readme --- README.md | 111 +++++------------------------------------------- protocol/KISS.c | 6 +-- protocol/LLP.h | 4 +- 3 files changed, 16 insertions(+), 105 deletions(-) diff --git a/README.md b/README.md index fc78515..7b238ca 100644 --- a/README.md +++ b/README.md @@ -1,123 +1,34 @@ -MicroAPRS +MicroModemGP ========== -MicroAPRS is an APRS firmware for [MicroModem](http://unsigned.io/micromodem). It supports both normal KISS mode, and a simple serial protocol for easy communication with an Arduino, or other MCU. +MicroModemGP is a general purpose firmware for [MicroModem](http://unsigned.io/micromodem). + +It supports both KISS mode serial connections, and direct serial connection without framing for easy communication with anything with a serial port. You can buy a complete modem from [my shop](http://unsigned.io/shop), or you can build one yourself pretty easily. Take a look at the documentation in the [MicroModem](https://github.com/markqvist/MicroModem) repository for information and getting started guides! ## Some features -- Send and receive AX.25 APRS packets +- Easily send and receive packets over mostly any radio - Full modulation and demodulation in software -- Easy configuration of callsign and path settings - Flexibility in how received packets are output over serial connection -- Persistent configuration stored in EEPROM -- Shorthand functions for sending location updates and messages, so you don't need to manually create the packets -- Ability to send raw packets -- Support for settings APRS symbols -- Support for power/height/gain info in location updates -- Ability to automatically ACK messages adressed to the modem - Can run with open squelch - Supports KISS mode for use with programs on a host computer +- 12,8 Hamming-code forward error correction and 12-byte interleaving +- CRC checksum on packets ensure data integrity +- Supports packets with up to 792 bytes of data ## KISS mode When the modem is running in KISS mode, there's really not much more to it than connecting the modem to a computer, opening whatever program you want to use with it, and off you go. -## Modem control - SimpleSerial +## Direct serial connection If you want to use the SimpleSerial protocol, here's how to control the APRS modem over a serial connection. The modem accepts a variety of commands for setting options and sending packets. Generally a command starts with one or more characters defining the command, and then whatever data is needed to set the options for that command. Here's a list of the currently available commands: -##Serial commands +## Serial connection settings -Command | Description ---- | :--- -__!\__ | Send raw packet -__@\__ | Send location update (cmt = optional comment) -__#\__ | Send APRS message -  |   -__c\__ | Set your callsign -__d\__ | Set destination callsign -__1\__ | Set PATH1 callsign -__2\__ | Set PATH2 callsign -  |   -__sc\__ | Set your SSID -__sd\__ | Set destination SSID -__s1\__ | Set PATH1 SSID -__s2\__ | Set PATH2 SSID -  |   -__lla\__ | Set latitude (NMEA-format, eg 4903.50N) -__llo\__ | Set latitude (NMEA-format, eg 07201.75W) -__lp\<0-9>__ | Set TX power info -__lh\<0-9>__ | Set antenna height info -__lg\<0-9>__ | Set antenna gain info -__ld\<0-9>__ | Set antenna directivity info -__ls\__ | Select symbol -__lt\__ | Select symbol table (standard/alternate) -  |   -__mc\__ | Set message recipient callsign -__ms\__ | Set message recipient SSID -__mr\__ | Retry last message -__ma\<1/0>__ | Automatic message ACK on/off -  |  -__ps\<1/0>__ | Print SRC on/off -__pd\<1/0>__ | Print DST on/off -__pp\<1/0>__ | Print PATH on/off -__pm\<1/0>__ | Print DATA on/off -__pi\<1/0>__ | Print INFO on/off -__v\<1/0>__ | Verbose mode on/off -__V\<1/0>__ | Silent mode on/off -  |   -__w\__ | Set preamble in ms -__W\__ | Set TX tail in ms -  |   -__S__ | Save configuration -__L__ | Load configuration -__C__ | Clear configuration -__H__ | Print configuration - - - -### Examples - -__To set your callsign to XX1YYY-5, and then save the configuration, send these three commands:__ -``` -cXX1YYY -sc5 -S -``` - -__To send an APRS message to ZZ5ABC-1 with the content "Hi there!", send these commands:__ -``` -mcZZ5ABC -ms1 -#Hi there! -``` - -__To send a location update, with the comment "MicroAPRS", you can do something like this:__ -``` -lla5230.70N -llo01043.70E -@MicroAPRS -``` - -__To send an APRS message to ZZ5ABC-1 with the content "Hi there!", using a raw packet, send this command:__ -``` -!:ZZ5ABC-1 :Hi there!{01 -``` -__Here's an example of how to send a location update with power, height and gain information, using a raw packet:__ -``` -!=5230.70N/01043.70E-PHG2410MicroAPRS -``` - -### EEPROM Settings -When saving the configuration, it is written to EEPROM, so it will persist between poweroffs. If a configuration has been stored, it will automatically be loaded when the modem powers up. The configuration can be cleared by sending the "clear configuration" command (`C`). - -### Serial Connection - -To connect to the modem use __9600 baud, 8N1__ serial. By default, the firmware uses time-sensitive input, which means that it will buffer serial data as it comes in, and when it has received no data for a few milliseconds, it will start interpreting whatever it has received. This means you need to set your serial terminal program to not send data for every keystroke, but only on new-line, or pressing send or whatever. If you do not want this behaviour, you can compile the firmware with the DEBUG flag set, which will make the modem wait for a new-line character before interpreting the received data. I would generally advise against this though, since it means that you cannot have newline characters in whatever data you want to send! - -![MicroModem](https://raw.githubusercontent.com/markqvist/MicroModem/master/Design/Images/1.jpg) +To connect to the modem use __9600 baud, 8N1__ serial. By default, the firmware uses time-sensitive input, which means that it will buffer serial data as it comes in, and when it has received no data for a few milliseconds, it will start interpreting whatever it has received. This means you need to set your serial terminal program to not send data for every keystroke, but only on new-line, or pressing send or whatever. You can also compile the firmware for KISS mode serial connection, if you have a host program using KISS. The project has been implemented in your normal C with makefile style, and uses AVR Libc. The firmware is compatible with Arduino-based products, although it was not written in the Arduino IDE. diff --git a/protocol/KISS.c b/protocol/KISS.c index 047cc3a..39c41d5 100644 --- a/protocol/KISS.c +++ b/protocol/KISS.c @@ -4,7 +4,7 @@ #include "device.h" #include "KISS.h" -static uint8_t serialBuffer[LLP_MAX_FRAME_LENGTH]; // Buffer for holding incoming serial data +static uint8_t serialBuffer[LLP_MAX_DATA_SIZE]; // Buffer for holding incoming serial data LLPCtx *llpCtx; Afsk *channel; Serial *serial; @@ -103,7 +103,7 @@ void kiss_serialCallback(uint8_t sbyte) { timeout_ticks = timer_clock(); IN_FRAME = true; serialBuffer[frame_len++] = sbyte; - if (frame_len >= LLP_MAX_FRAME_LENGTH) kiss_checkTimeout(true); + if (frame_len >= LLP_MAX_DATA_SIZE) kiss_checkTimeout(true); #else if (IN_FRAME && sbyte == FEND && command == CMD_DATA) { IN_FRAME = false; @@ -112,7 +112,7 @@ void kiss_serialCallback(uint8_t sbyte) { IN_FRAME = true; command = CMD_UNKNOWN; frame_len = 0; - } else if (IN_FRAME && frame_len < LLP_MAX_FRAME_LENGTH) { + } else if (IN_FRAME && frame_len < LLP_MAX_DATA_SIZE) { // Have a look at the command byte first if (frame_len == 0 && command == CMD_UNKNOWN) { // MicroModem supports only one HDLC port, so we diff --git a/protocol/LLP.h b/protocol/LLP.h index a695a42..e799036 100644 --- a/protocol/LLP.h +++ b/protocol/LLP.h @@ -9,10 +9,10 @@ #define LLP_INTERLEAVE_SIZE 12 #define LLP_MIN_FRAME_LENGTH LLP_INTERLEAVE_SIZE -#define LLP_MAX_FRAME_LENGTH 65 * LLP_INTERLEAVE_SIZE +#define LLP_MAX_FRAME_LENGTH 67 * LLP_INTERLEAVE_SIZE #define LLP_HEADER_SIZE 10 #define LLP_CHECKSUM_SIZE 2 -#define LLP_MAX_DATA_SIZE LLP_MAX_FRAME_LENGTH - LLP_HEADER_SIZE - LLP_CHECKSUM_SIZE // TODO: this is not right +#define LLP_MAX_DATA_SIZE LLP_MAX_FRAME_LENGTH - LLP_HEADER_SIZE - LLP_CHECKSUM_SIZE #define LLP_DATA_BLOCK_SIZE ((LLP_INTERLEAVE_SIZE/3)*2) #define LLP_CRC_SIZE 2