comSC
comSC is a library containing the low-level routines for the
connectionless mode of AX.25 communications written for a Texas
Instruments MSP430 microprocessor.
Applications
comSC is fully compliant with the UI frames used for the automatic
position reporting system (APRS). It may be used to send or
receive APRS informations. Further, some satellites using
radio amateur frequencies are compliant to the connectionless AX.25
at 1200 baud AFSK. In fact, comSC will even be on board of a CubeSat.
Working Principle
For the data transmission, the data is first copied in memory. After
having added the (fixed) header, the checksum is calculated and appended. Finally, the frame is transmitted towards the frequency modulator. To control
the voltage levels for the logic low and the logic high, the output is
provided by one of the D/A converters. During the duration of the entire transmission (synchronization signal or UI-frame), the output of a second
D/A converter is set to its high level. This output may be used to enable
a power amplifier. Further, a binary signal is toggled with a frequency of about 1.2 kHz during the same duration.
For the data reception, the UI frame is captured at a digital input pin. When the stop flag is received, then the frame is verified by checking the
destination address and the validity of the checksum. If the frame is valid,
then the function RX_packetReceived is called. In the current
implementation, comSC does not (yet) cover any higher layers of the
communication stack. For example, it does not include the code to
forward the data to a PC or another external device.
Getting the Files
The sourcecode is available at
Sourceforge.
Compilation
- Prior to compilation, please change the source
and destination addresses in the AX.25 headers!
- If the dependencies between the source files has been modified, type make depend.
- To compile comSC and program the MSP430, type make install.
A correctly installed GCC toolchain for the MSP430 and a working programmer
is required.
Tests
comSC is tested extensively and the version 0.7 is shown to be compliant
with the SCS Tracker and
with MixW.
Contributions
Several people have contributed to the development and the testing of
comSC.
- 2008 Olivier Maillard HB9TOB
- 2008 Enrique Rivera
- 2008 Ted Choueiri
- 2008 George Florian
- 2008 Yann Voumard
Interface Description
The external functions and routines will be described in this
section. The internal functions and routines are not discussed and
should never be called directly from any external program. More
documentation can be found in the source files.
ax_misc
void AX_start(void); This enables the Timer_B interrupts
that are used for RX and TX. This should be called during the
initialization of the microcontroller in the main file.
ax_rec
void RX_setByteMax(unsigned int size); Sets the maximum number of data
bytes in a frame. If you plan to use larger settings than 278, than
the memory allocation of RX_Data (ax_rec.c, line 19) needs to be
modified. The received frame is not required to have the maximum
length, but can be shorter.
void RX_setPassAll(char passAll); When calling RX_setPassAll(1), than
the data from all frames are forwarded to the higher layer,
independently if the frame passes the validity check or not. This mode
is useful for debugging or to bypass the problem when the receiver
address is not known.
void RX_packetReceived(void); This routine is called
whenever a frame has been received and decapsulated. The higher layer
routines should add a hook to be announced of the arrived data.
ax_send
void TX_start(void); Starts the emission of a frame. The frame needs
first to be prepared by TX_prepareFrame.
void TX_prepareFrame(char *data, unsigned int length); Prepares the data
and forms a valid AX.25. The headers are added. Further, the FCS is
calculated and stored.
void TX_delaySet(unsigned int a); In most implementation,
the TX_delay delays the emission, such that the radio
equipment can first test for other active users before transmitting. The
hardware planned to use at the CubeSat does not allow such a test, as the receiver uses another frequency than the transmitter. In comSC, a (0x7E)
is transmitted during the TX_delay prior to any frame (even before
the start flag). For the fastest transfer, TX_delay should be set to
zero. However, it may be useful to enable the TX_delay to allow a
synchronization of the receiver.
void TX_DACSet(unsigned int low, unsigned int high);
Sets the values for the DAC to the values low and high. The range is
between 0x0000 (O Volt) and 0x0FFF (3.3 Volt).
void TX_DACReset(void); Resets the values for the DAC to
the default values.
void TX_sync(void); Send a synchronization signal.
Communication Example
In the following, a simple connection will be shown.
Initialization
During initialization, the following routines and functions should be
used.
- AX_start(); to enable the interrupts.
Frame Transmission
- TX_DACReset(); Reset high and low levels for TX
- TX_sync(void); If required.
- TX_delaySet(0); to disable the TX_delay (this may also be
called during init).
- TX_prepare(SendData, 256); Prepares the AX.25 frame. Puts the
flags, the header, and the FCS. Copies the data to local memory
- TX_start(); Sends the frame
- Add a hook to TX_end() to announce that the frame emission has
finished.
Frame Reception
- RX_setPassAll(0); to disable the passAll flag and receive only
valid frames (this may also be called during init)
- RX_setByteMax(255); to set the maximum length of the data part
of the frame (this may also be called during init. The default value
is 255.)
- Add a hook to RX_packetReceived to announce that a frame has
been received.
Hosting
Roman Merz, 2008