December 23, 1987
DSP Group notes de W3IWI

This set of notes is intended to help you get started on the TAPR/AMSAT
DSP project.

4. Software info:

So far the software for the DSP activities can best be described as
developmental and experimental. However, this disk contains what we've
got. Here are the contents of these three disks:

DSP1:
DEL-SPRY ARC   141805  11-15-87   6:32p

The DEL-SPRY.ARC file contains all the stuff that Delanco-Spry normally
provides with their boards for commercial customers. This disk also
contains these notes files, plus other miscellany I chose to include. Note
that the PK-ALL.ARC file contains the PKARC/PKXARC set of utilities. A bug
has recently been found in PKXARC which is noted in the .BUG file in
PK-ALL. The copies on this disk have been patched.
       ----------------------
DSP2:
ASMS     ARC    60325  12-19-87   6:44p
MAC320   ARC   209068   4-10-87   1:36p
BIN      ARC    89584  11-03-87  12:59p

ASMS and BIN contain all the stuff that N4HY and I have generated. Bob
updated ASMS.ARC earlier this week and it should be current. The SPECT1K
program has been our workhorse. It is a 1024 point FFT with several power-
spectrum averaging options. This is what I used to test the TAPR PSK
modem/radio combinations, and it is what we have used for EME and weak-
signal work so far. This program is a real hack. It is dirty. We ain't
proud of the code. Also in these files are the code for Bob's PSK demod
and several filters. All the PC code was written and tested in Microsoft
"C" 4.0 (and recently 5.0). Bob was going to write up some user's notes on
our software for inclusion on this disk, but he has been to busy at work
to get it done.

MAC320 is Allen Ashley's TMS320 Macro Assembler. Note: this was acquired
personally by us and is not public domain! Mike Lamb (N7ML) of AEA is
keenly interested in seeing our DSP development activities progress and
has indicated his willingness to purchase several copies of this assembler
and Ashley's PC-based 320 emulator to loan to us. Documentation on the use
of this assembler was sent with your boards.
           --------------------
DSP3:

MACROS   ARC    44032   2-12-87   8:32p
FLTGPT10 ARC     7680   2-12-87   8:36p
MACROSRC ARC    25728   2-12-87   8:41p
FFT32010 ARC    38400   2-12-87   8:53p
FIRIIR   ARC    15232   2-12-87   8:56p
ADPCMNON ARC    16896   2-12-87   9:32p
DATAIO   ARC    31679   3-03-87   9:58a
BELL212  ARC   134144   2-18-87   9:39p
FIR      ARC    42835  11-03-87   1:17p

This material (except FIR.ARC) came from the TI TMS320 User's Library and
was originally obtained by Mike Parker and Dan Morrison. Someone should
check into TI's BBS and see if there are any new goodies we could use.
FIR.ARC was supplied by N4HY and provides algorithms for computing FIR and
IIR filter coefficients.

In addition, Randy Cole and Billy Brackenridge have code for LPC digital
voice encoding which I hope they will make available as soon as they get
it ported over to the Delanco-Spry board.

Now for one final topic: software availablility. This DSP team will work
only if all the team members freely exchange their code with other team
members. On the TAPR/AMSAT DSP PROJECT sign-up sheet I had the following
simple agreement for you to sign:

 "  Yes, I would like to participate in the DSP project. I
    recognize that the DSP hardware and software are made
    available for experimental amateur development use only.
    I plan to abide by the 'rule' that my activities are to
    be part of a team and that code and ideas I generate
    will be made available to all other team members. I
    understand that AMSAT and TAPR incur no liability for
    the hardware or software involved in the DSP project."

Some of you did not use the TAPR/AMSAT signup form but sent in your
checks to Bob or the AMSAT office or me directly. I assume that you
agree to these statements. I want to see code and ideas moving between
the team members. I do not want to see a replay of the TNC2 firmware
'proprietary code' debacles. You are not putting your code into the
public domain. You still retain rights for commercial use if you want.
You may want to assign rights to AMSAT or TAPR for commercial
'exploitation'. I would point out that the 'sale' of the W3IWI & N4HY
orbit software by AMSAT, and the royalties coming to TAPR from the TNC2
hardware design have provided resources that have made other projects
possible.

January 12,1988
DSP Notes de N4HY

TOYS!!!!!  Sorry this took so long.  The crap that Tom and I have had to
deal with and put up with lately has been unbelievable and this took
longer than I wanted because of these time eaters.  We will describe only
those routines which we can be blamed for ;-).

A mini guide to some of the software written by W3IWI and N4HY and W5SXD
is now in order.

I think we first need to agree on some standard setups.  All the code Tom
and I have written expects that (1) you have an 80?87 (math chip, ? =2,3,
or nothing) (2) you have your board at segment 0XD000 (see Delanco Spry
manual) (3) your base IO address is set at 0X300 (again see Delanco Spry
manual for setting jumpers for (2) and (3)).  0X means Hex number follows.

Because we are fooling so much with pointers to move this code around we
have been sticking to code that allows easy manipulation of these pointers.
This is "C" as a high level language and assembler for low level and speed.

All three of the current contributors use MicroSoft "C"  5.0 and Microsoft
Assembler 5.0.  These are not the only compilers used in this group. Phil
and others (including myself) have Aztec 4.01a "C" compiler.  These are
all ansi-conforming compilers.

For an assembler for the TMS32010, we have supplied copies of Allen Ashley's
MAC320 TMS32010 cross assembler which runs on the PC and produces hex files.
To compile foo.asm, suppose that you are on computers C drive.  Type

mac320  foo.ccec

asm is mandatory so it is not needed.  After the period are compiler flags.

ccec means the source is on the c drive, put the hex on the c drive, compile
without producing a listing and put the symbol table on the c drive.  The
symbol table is important for the emulator  (emu320.exe).  If you wish a
listing and you want it to go to a file rather than screen type

mac320 foo.ccgc filename.ext

and it will write to a file named filename.ext.

If you wish it to be the printer, filename.ext may be PRN.

Now you have the code foo.hex on your drive, how do you get it to
go onto the TMS32010 board.  We have supplied a utility for this function
called intel.exe

intel.c and intel.exe

To use it suppose you wish to load foo.hex and you have set up your board
as suggested above.  Type

intel foo d000 300 0

or

intel foo d000 300 1

This means load the intel hex file foo.  The board is located at the
beginning of the segment D000 in your computer memory.  Its I/O port base
address is 300 Hex.  The last number determines whether or not you then
tell the processor to GO.  0 means load and do NOT execute and 1 means
send the go signal to the TMS32010 board.

intel.exe is used extensively as you might imagine in the programs we
have supplied.  spect.exe spect1k.exe, from320.exe, to320.exe, rcaspect.exe,
tfft.exe, and many others spawn the process intel.exe to load files.
It is important to have either intel.exe in the directory you are currently
located in or to have it in your search path (type set on your PC to see
what your current path is set to in your environment).  It is ABSOLUTELY
imperative that the hex files be located exactly in the current directory.

Lets try a simple process now.

<<SAMPLE, STORE, AND/OR PLAYBACK>>

Lets gather some samples, store them on disk and then play them back.

Connect your radio through a lead to the A/D input on the board.
Connect a speaker and small amp (Radio Shack mini speaker amp is invaluable
and cheap) to the D/A output on the board.

Make sure that the file gather.hex is in the current directory.
Make sure that the file from320.exe is in the current directory.
Make sure that the file intel.exe is in the current directory.

Run

from320

If you have done this correctly, your will see some lines from the
intel loader where the file gather.hex was loaded.

Answer 10000.0 for the sample rate
and give it the full path name to a place where 193000 bytes are free
for storage of a sample file.

This will gather just under 100000 samples (10 seconds).

Lets play it back.

Make sure that the file send.hex is in the current directory.
Make sure that the file to320.exe is in the current directory.
Make sure that the file intel.exe is in the current directory.

run to320.exe

It will load the program send.hex
ask for the sample rate and which port.

The A/D port on board is 4, so answer port 4.

This will load the ~100000 samples and then blast them to the TMS32010.

If everything is hooked up correctly, you should hear the sampled audio
from your radio, etc.  The A/D chips clip at +/- 5V so don't overdrive
them.  +/- 5V is THE limit on input.


<< SPECTRUM ANALYZERS >>

SPECT1K.EXE

This is a HORRIBLE piece of C code that does some really fun stuff.

Requires CGA.

To run the spectrum analyzer program spect1k.exe you must have an 80x87.
or you must recompile it yourself with options listed below.

You must have the following in the same directory

spect1k.exe
intel.exe
ffthy1k.hex

spect1k will load the DSP board and then begin asking questions.

What sample rate do you wish (6000 is about right for SSB rigs)?

How many spectra do I need to average to determine the amplitude response
of the radio (for example) I am listening to?
(100 is a good number to start with)

How many spectra do I collect before I update the display?
(start with 5)

You should now be seeing spectra on your CGA screen.

Key commands
Up arrow   increase scale
Down arrow decrease scale
Pg Dn      Slide Graphics Down
Pg Up      Slide Graphics Up
F1         smooth the spectra more (tconst on the bottom gets smaller)
F2         smooth the spectra less
F3         Quit
F4         Restart
F5         Set threshold.  from 0 to 199.   0 means off.  199 means the
          bottom of the screen.   This sets off a tone at the freq that
          corresponds to the maximum amplitude point in the spectral
          display IF it is above threshold.  Useful as "CW remodulator"
          in weak signal experiments.
Bottom line display
Rate    sample rate
Scale   scale the spectra down by this many bits (keep it on the screen).
tconst  the spectral smoothing constant or how much the newest spectra
       is weighted in the display (set with F1 and F2 above)
sample  how many spectra to collect before display
freq    freq with largest amplitude
amp     The value of that largest amplitude

<<TFFT.EXE>>

TFFT is by W5SXD and is a EGA spectrum analyzer.  It is a brilliant piece
of work.  To use it, you must have 80X87 math chip

fft512.hex
board.def
tfft.exe

The program is COMPLETELY self explanatory and there are NO keystroke
commands.  We will look forward to some of you adding them.  The
sources and a make file are included.
msc 4.0 and above with masm are needed

<<MODEM.HEX  MODEM.ASM>>

Modem is our first "modem code" on the TMS32010.  It part of the "dem"
half only.  It is a BPSK to Bel202 FSK translator.  It tracks the carrier
and makes bit decisions in order to remodulate the bits onto a Bel202
FSK output.  This is so that you may copy JAS-1 or TAPR/W3IWI/JAMSAT
BPSK modem output with an unmodified tnc.

you must have the following in the same directory

d320d.exe
intel.exe
modem.hex

Run d320d.exe

type
t2,651
q

This will set the sample rate at 9600 BPS (see DS manual)
and then quit the debugger (d320d)

now run

intel modem d000 300 1

this will load and start  the modem code.

Hook the input to the receiver and the output to a tnc.  Copy JAS-1
or BPSK modem output with it.  The code is rudimentary and many addtions
are planned as we gear up for PHASE III-C, including clock recovery and
drop the remodulator.  MAYBE some EQ, but probably not due to lack of
sufficient RAM.


<<Compilation instructions for compatibility with what Tom and I
  have been doing lately>>


To compile all C programs with msc 4.0 type

cl /Oat /AL /FPi87 /c filename.c
link /stack:12000/F/PAC filename;

or if you need some of the routines in Davids libraries do

link /stack:12000/F/PAC filename,,nul,mscl320

You probably don't need that much stack but you may experiment with it.
After you are satisfied as to how much stack you really need, make that
number smaller and turn OFF the stack checking routines by adding to
the cl command the option /Gs.

If you are using msc 5.0 do /Oatl in place of /Oat

as msc 5.0 does loop optimizations.

If you are brain damaged and don't have an 80x87 change /FPi87 to
/FPa in the compile line.

I didn't use msc for 4.0 because I wanted to use the same command for
both compilers.  I have NO experience with any other C compiler on this
code. Even though I have used and like Aztec for other purposes.  I have
little experience with Turbo C having gotten disgusted when I divided
two numbers and got the wrong answer.

Bob