home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / hamradio / ax253008.zip / AX25.DOC < prev    next >
Text File  |  1992-09-02  |  12KB  |  306 lines

  1.         AX25 driver for BAYCOM-like modem.
  2.         Version of 30th of August 1992
  3.  
  4. Free license for this software is granted for _amateur_ use only.
  5. Commercial usage is prohibited.
  6.  
  7. AX25.COM is a packet driver comforming (to some extend) to well known
  8. "FTP packet driver" specification. It's purpose is to serve as interface
  9. between application software (e.g. KA9Q NOS) and a modem connected
  10. to RS232 port (e.g. BAYCOM modem).
  11.  
  12. The driver relies on the following RS232 pins:
  13. RTS - controls PTT: high level activates the transmitter
  14. DTR - transmitted data. On this pin the driver sends data
  15.       to be transmitted by the modem.
  16.       When in receive state this pin is held high.
  17. CTS - received data. The modem should supply here the data it receives.
  18. DCD - the modem may supply here "carrier detect" signal.
  19.       This pin is _optional_ - it is not a must because the driver
  20.       is able to deliver carrier signal from received data.
  21. GND - a common ground for the above signals.
  22.  
  23. TxD outputs a signal which is in high (positive voltage)
  24. most of the time. A low power modem (TCM3105) can be supplied
  25. from RTS+DTR+TxD (adding realized with diodes).
  26.  
  27. My primary intention while writting this driver was to provide
  28. opportunity to run KA9Q NOS with simple modems based on TCM3105
  29. or AM7910 chip. I tested the driver _only_ with NOS - no other software
  30. was available at the time. Thus I can not guarantee full compatybility
  31. with "FTP packet driver" definition.
  32.  
  33. The driver status can be examined with PKSTAT.COM and terminated
  34. (removed from memory) by TERMIN.COM. These two utilities are part
  35. of packet drivers package from Clarkson and they should work
  36. with any "FTP packet driver".
  37.  
  38. AX25 driver heavily relies on quick interrupt response.
  39. Thus the application software should avoid disabling
  40. CPU interrupts for long periods. Or say it in another words:
  41. enable interrupts whenever possible.
  42.  
  43. AX25.COM has several start-time options. To see them start it
  44. with "-?". If you start the driver without any command line
  45. switch it will use default values: COM1, 1200 baud, etc.
  46.  
  47. These are the options - default values are in []:
  48.  
  49. -b<bit rate> [1200] - decimal number
  50.     defines the bit rate. Rates below 300 are not accepted
  51.     because of PC's timer specific features.
  52.     Maximum usable rate is probably 2400 but it really depends
  53.     on your CPU... The upper limit for this parameter is 14400.
  54.     "Valid" rates are only numbers which can be expressed as 14400/n.
  55.     If you give an "invalid" value it will be adjusted to the closest
  56.     "valid" one.
  57.  
  58. -i<software interrupt> [60] - hexadecimal number
  59.     Tells the driver which software interrupt to use
  60.     for control functions. Usually you would use numbers
  61.     from 60..63 here because these are intended for user applications.
  62.  
  63. -B<COM port I/O base> [3f8] - hexadecimal number
  64.    I/O address of RS232 port: 3f8 for COM1, 2f8 for COM2
  65.  
  66. -I<COM port IRQ> [4] - hexadecimal number
  67.    Interrupt request line of RS232 port: 4 for COM1, 3 for COM2
  68.    Only the range 2..7 is supported so far. I'm not sure the irq 2
  69.    would work on a PC/AT.
  70.  
  71. -s<slot time> [120] - decimal number 16..255
  72.    Slot time for p-persistance scheme. The value is in data bits.
  73.    For 1200 baud, slot time 120 bits means 100 ms.
  74.  
  75. -p<persistance> [64] - decimal number 0..255
  76.    p-persistance - the higher the value the higher the probability
  77.    of activating PTT at a time slot.
  78.  
  79.    Your station becomes more "agressive" on the air
  80.    with increasing persistance and decreasing slot time.
  81.  
  82. -h<tx header length> [480] - decimal number 8..65535
  83.    Number of extra bits the transmitter sends before actuall data
  84.    is transmitted. This is same as TxDelay on most TNCs.
  85.    480 bits means 400 ms at 1200 bps.
  86.  
  87.    You should always make this number as small as possible
  88.    for best bandwidth use. 480 tells you basicaly that 480 "useless"
  89.    bits (60 bytes) are being transmitted before real packet data goes out.
  90.  
  91.    Unlike most TNCs this driver sends a square wave not a series
  92.    of HDLC flags in front of a packet. This was easier to program
  93.    in software and it makes DPLL lock faster at receiving end.
  94.    Thus less header bits should be needed...
  95.    
  96. -t<tx tail length> [24] - decimal number 8..65535
  97.    Number of extra bits the transmitter sends _after_ the actuall data.
  98.    24 bits makes 20 ms tx tail.
  99.  
  100. -c<carrier sense mode> [t] - one of the following letters: f,c,t,d
  101.    mode      meaning           
  102.  
  103.     f      full duplex - transmit whenever data is pending.
  104.        This option disables carrier sensing.
  105.  
  106.     c      sense modem DCD line to find out whether channel is busy or not.
  107.        Your modem has to supply this signal. Note that TCM3105
  108.        does not do it very well... it sets DCD to high on any noise
  109.        on audio input. Am7910 is said to deliver much more reliable CD
  110.        signal.
  111.  
  112.     t      sense data transition - if incoming data signal moves
  113.        the driver assumes that the channel is busy - BAYCOM 1.5 uses
  114.        the same (or very similar) way with "CARRIER 1" switch.
  115.        Use this mode if you intend to use squelch in your radio.
  116.  
  117.     d      deliver "channel busy" status by analysing incoming data.
  118.        BAYCOM's v1.5 "CARRIER 0" does effectively similar thing although
  119.        it uses different algorithm. The driver examines the incoming
  120.        signals "regularity" - if data transitions comes at regular
  121.        intervals the channel is assumed busy.
  122.        With this mode you may run your radio with squelch open
  123.        all the time.
  124.        How this option works may depend on modem type. Some modems
  125.        have still very regular digital output signal even with white
  126.        noise applied to the analog input.
  127.  
  128. Please note that argument line is case sensitive and so are hexadecimal
  129. values... "2F8" will not do - you must specify "2f8".
  130.  
  131.  
  132. Frequently asked questions with answers.
  133.  
  134. How to start quickly ?
  135.  
  136. 1. Start the ax25.com - most important parameters are COM base and irq.
  137.    e.g. for COM1: ax25 -B3f8 -I4
  138. 2. Start KA9Q NOS.
  139.    and then type in:
  140.      ax25 mycall <your callsign>
  141.      attach packet 0x60 ax25 5 512
  142.      trace ax25 111
  143.    you should see packets being received now...
  144. 3. Try to connect to another station by typing:
  145.    connect ax25 <callsign>
  146.  
  147. Are there any programs the driver dislikes ?
  148.  
  149. Yes, SP9AUV discovered a small and nice program saying "Good Morning"
  150. (in polish) disabled the driver completely on his PC. The reason is a mistery
  151. as the program is not even resident.
  152. If the driver does not work, try to start the DOS from a diskette with
  153. simplest possible config.sys and autoexec.bat and give the driver
  154. another try.
  155.  
  156. How to change ax25 driver parameters ?
  157.  
  158. If you realized that you have started ax25.com with not the parameters
  159. you liked use termin.com to terminate the driver (e.g. termin 0x60)
  160. and start ax25.com again with another option set.
  161.  
  162. Can the ax25 driver be loaded into high RAM ?
  163.  
  164. Yes, the driver can be loaded into UMB to save base memory.
  165. However on my 386 when I tried to get UMB using EMM386.EXE
  166. the driver performance become worse even when loaded into low RAM.
  167. After trying UMBDR521 I got more UMB space (!?) and the driver
  168. could run both in low and high RAM without any side effects.
  169.  
  170. Can the driver work on an XT ?
  171.  
  172. I can't see any reason why not (appart from CPU speed)
  173. but haven't got a single report about such a case.
  174. In contrary I'm getting lot of claims that "BAYCOM works
  175. but the ax25 driver does not". I don't understand why...
  176.  
  177. How to check whether my PC is fast enough ?
  178.  
  179. Do simple loopback by connecting DTR (data out) to CTS (data in).
  180. Then start the driver at 300 bps and -cf option (full duplex).
  181. Start the NOS, attach the packet driver (see "How to start quickly")
  182. and let NOS transmit few packets (for example by enabling beacon
  183. every 10 sek). Every packet sent should reapear as received in trace window.
  184. If so try higher speeds, if not either your PC is too slow or something else
  185. is wrong.
  186.  
  187. How big packets can ax25 driver handle ?
  188.  
  189. The receiver can handle 2048 byte frames.
  190. This include address, control and data field but not CRC.
  191. The transmitter buffer can hold up to about 4KB.
  192. That is the amount of data which can be transmitted
  193. per each PTT push.
  194.  
  195. How to connect a modem to RS232 port ?
  196.  
  197. To cooperate with ax25 driver the modem should meet some
  198. minimal requirements. Basic roules are:
  199. 1. The modem must provide decoded received data on CTS pin.
  200. 2. The driver outputs data to be transmitted on DTR pin.
  201.    Modem should modulate and pass this signal to the radio.
  202. 3. Pin RTS controls the PTT of the radio. When it becomes positive
  203.    the radio (together with the modem) should go into transmition mode.
  204. 4. Optionally the modem may provide carrier detect signal
  205.    on DCD pin.
  206. 5. Don't forget about GND line which is the reference for all above signals
  207.  
  208. BAYCOM and many other modems build around TCM3105 or AM7910/11
  209. for use with BAYCOM or TFPCX software conform to this scheme.
  210.  
  211. If you are going to build your own modem you may encounter
  212. the problem of level conversion. RS232 ports of a PC
  213. use +/- 12 V while most modem chips need TTl levels (0..+5V).
  214. The most elegant solution is to use MAX232 or similar converter.
  215. A simpler (but not that elegant) way of doing conversion is to use
  216. CMOS inverters (I use 4049 with my TCM3105). Like on the picture below:
  217.  
  218.  
  219.         _____    |\
  220. RS232 DTR   ---|_____|---| \o_____ TTL modem TxD
  221.          50 or 100 k | /
  222.              |/
  223.  
  224.         _____     /|
  225. RS232 CTS   ---|_____|--o/ |_______ TTL modem RxD
  226.         2.2 k    \ |
  227.               \|
  228.  
  229.  
  230.         _____     /|     /|
  231. RS232 DCD   ---|_____|--o/ |___o/ |____ TTL modem DCD
  232.         2.2 k    \ |    \ |                      Modem Tx control
  233.               \|      \         ____+5V__      |
  234.                           |   _|_      |        Radio PTT
  235.                    Si diode  _|_  | | 3M   |          |
  236.                          /_\  |_|      |          |
  237.         _____    |\     _____  | |+   |    |  |\   |  ___ B |/  C
  238. RS232 RTS   ---|_____|---| \o--|_____|-| |----|----|--| \o---|___|--|
  239.          50 or 100 k | /    2.2 k  | |            | /    10 k   |\
  240.              |/            10 uF          |/              | E
  241.                                   -------
  242. RS232 GND ---o
  243.          |
  244.         _|______ 0V
  245.  
  246. Inverters are supplied from 0 and +5 Volts - same levels
  247. as modem TTL part.
  248.  
  249. The first scheme _does_ work because CMOS inputs accept voltages outside
  250. power supply range thanks to input protective diodes.
  251. The resistor limits the current flowing through these diodes.
  252. You _must_not_ avoid it !
  253.  
  254. The second scheme does work as well because the threshold between
  255. logical states in PC's RS232 is a bit above 0 Volts.
  256. BAYCOM team recomends HC or HCT series circuits - they must have
  257. a reason for it but I don't know what it is...
  258.  
  259. Please note that transmitted and received data polarity is not important
  260. in packet radio. Only transitions matters. However polarity of DCD signal
  261. _does_ matter.
  262.  
  263. The last scheme shows PPT circuit with simple watchdog timer. It limits
  264. the transmition time and is recomended for unattended stations
  265. to protect against software failures.
  266.  
  267. It is a good practice to ground unused RS232 inputs (RI, DSR, DCD).
  268. Due to capacitive coupling to neibour pins there may apear short spikes
  269. on them - these will trigger extra interrupts thus loading the CPU.
  270.  
  271. Have fun and _please_ send success/failure notes
  272. and comments/hints/complaints to:
  273.  
  274.     email:    jalocha@chopin.ifj.edu.pl
  275.     or    jalocha@vxcern.cern.ch
  276.     or    jalocha@priam.cern.ch
  277.     packet:    SP9VRC@SP9ZDN.POL.EU (untested yet...)
  278.  
  279. my home address:   Pawel Jalocha
  280.            Rynek Kleparski 14/7
  281.            PL-31150 KRAKOW (Poland)
  282.  
  283. Pawel, SR9VRC
  284.  
  285.  
  286. History file:
  287.  
  288. First versions on 25-27 of April 1992: first approach to transmitter
  289. code caused inaccurate data transition timing. After fixing that bug
  290. another one got in: after transmiting 7KB of data the driver refuses
  291. to accept packets.
  292.  
  293. 29 April 1992:
  294. More-or-less stable version. Variables aligned to word boudary.
  295.  
  296. 4 May 1992:
  297. Defaults for tx head,tail and slot time are like most TNCs
  298.  
  299. 6 May 1992:
  300. Tx head, tail, slot time are printed out in bits and ms units.
  301.  
  302. August 1992:
  303. An attempt to cure problems occuring on COM ports handling
  304. IIR register not as I wished they did.
  305. By the way minor code review.
  306.