This documentation covers few different hardware revisions. Each secion which is 
specific to certain Hw Rev is marked by a letter. 

If section or point is universal across all revision it doesn't have any explicit
marking.


1. INTRODUCTION
ParaTNC is not only a software which runs on the STM32VLDISCOVERY board. Let's 
be honest, using evaluation boards is not very professional and may lead to 
great mess with soldering, poor-quality universal PCBs and then short 
circuits, noise etc. This is why the ParaTNC hardware was designed to have
everything on single PCB without a lot of jumper wires across. 

The ParaTNC as a software is universal and it might by used both on ParaTNC
hardware and still on STM32VLDISCOVERY board with everything else connected
to it using kynar wire.

2. KEY FEATURES
There were few key assumptions during the designing process which came from
long experience with many different stations

 -> Ground Isolation between the controller and the radio.
 -> Ground Isolation and isolated power supply for external meteo sensors.
 -> RS232 and optional RS485 transceivers on board.
 -> Internal connectors for breakout board with MS5611 pressure sensor.
 -> Separate watchdog IC.
 -> Optional Radiometrix BiM1H 500mW VHF transceiver tuned on 144.800MHz.
 -> The PCB mechanical design which fits into standard Mikrotik RB411 case. 
 -> Supplied from single +12V...14V5 DC source using standard DC barrel jack.

The main problem observed during long experience with meteo stations is RF
feedback. Most sensors (like temperature, wind and humidity) needs to be 
placed outside to ensure proper measuremenets quality. Unfortunately 
extending micro GPIO pins directly by using long cables placed along with
the RF coax cabling, definitely allows the RF energy from stations own TX
to get inside the micro and do a lot of mess. In less dangerous case this
may end with distorted AF coming into modulator input, in the worst case
the micro could just hang with PTT engaged.

3. SERIAL BOOTLOADER
The PCB has a JTAG pinout exposed which may be used for downloading the
software into micro. If User don't want to use a JTAG programmer or he
just doesn't own one, the serial bootloader may be used.

The bootloader is activated by shorting the proper jumper and reseting
the controler. Then the application provided by STMicroelectronics
could be used to download the HEX file into the micro. 



4. CONNECTORS PINOUT (BACK EDGE) - HW-RevA
-------------------------------------------------------------------------------
|RS485B , RS485A|  |+5Vsw, OneWire, AGND|  |TX20, AGND, +5Vsw, DTR| \r\n
                                             |+12V, +5V, +5Vi, +3V3, AGND, GND|

Where:
	RS485A and RS485B -> RS485 bus, protected by TVS (Clamping diodes)
	OneWire 	-> Isolated one wire bus
	TX20 		-> Isolated data bus from LaCrosse TX20 anemometer
	DTR 		-> Enable pin for TX20 anemometer. Permamently pulled down do AGND
	+5Vi 		-> Isolated +5V generated by internal DC-DC converter
	+5Vsw 		-> Switched and Isolated +5V. This line could be power cycled by
			the micro if no communication will be received from either the
		 	anemometer or one wire thermometer
	+3V3 		-> Main uC supply voltage regulated internally by LDO
	+12V 		-> Main supply voltage, hooked in paralel to DC jack
	AGND 		-> Analog GND for radio and sensors
	GND 		-> Main ParaTNC common with DC jack

4. CONNECTORS PINOUT (BACK EDGE) - HW-RevB
-------------------------------------------------------------------------------
|RS485B , RS485A| |+12V, AGND, +5Vi, +5Vsw, +5V, GND|  |+5Vsw, OneWire, AGND|  
						|AGND, TX20-SPD, DIRECTION, +5Vsw|
                                             

Where:
	RS485A and RS485B -> RS485 bus, protected by TVS (Clamping diodes)
	OneWire 	-> Isolated one wire bus
	TX20-SPD 	-> Isolated data bus from LaCrosse TX20 anemometer or
			an windspeed input (pulse out) from mechanical anemometer
	DIRECTION	-> Wind direction input (pot wiper) from mechanical anemometer
			
	DTR 	-> Enable pin for TX20 anemometer. Permamently pulled down do AGND
	+5Vi 	-> Isolated +5V generated by internal DC-DC converter
	+5Vsw 	-> Switched and Isolated +5V. This line could be power cycled by
		the micro if no communication will be received from either the
		anemometer or one wire thermometer
	+12V 		-> Main supply voltage, hooked in paralel to DC jack
	AGND 		-> Analog GND for radio and sensors
	GND 		-> Main ParaTNC common with DC jack

4. CONNECTORS PINOUT (BACK EDGE) - HW-RevC
-------------------------------------------------------------------------------
|+12V, AGND, +5Vi, +5sw, OC-OUT, GND| |RS485B , RS485A|  |+5Vsw, OneWire, AGND| 
						 	  |AGND, TX20-SPD, DIRECTION, +5Vsw|
                                             

Where:
	RS485A and RS485B -> RS485 bus, protected by TVS (Clamping diodes)
	OneWire -> Isolated one wire bus
	TX20-SPD 	-> Isolated data bus from LaCrosse TX20 anemometer or
			an windspeed input (pulse out) from mechanical anemometer
	DIRECTION	-> Wind direction input (pot wiper) from mechanical anemometer
	+5Vi    -> Isolated +5V generated by internal DC-DC converter
	+5Vsw   -> Switched and Isolated +5V. This line could be power cycled by
		   the micro if no communication will be received from either the
		   anemometer or one wire thermometer
	OC-OUT  -> Additional isolated open-collector output 
	+12V    -> Main supply voltage, hooked in paralel to DC jack
	AGND    -> Analog GND for sensors (BUT NOT RADIO!!)
	GND     -> Main ParaTNC common with DC jack



5. RJ45 (RS232) pinout
The RJ45 jack on the front of the PCB is NOT THE ETHERNET! Please don't plug 
any twisted pair Ethernet cable onto it. 

The RJ45 socket is just an RS232 connector in standard Cisco Serial Console
pinout. The proper RJ45 -> DB9 cable could be very easly obtain on any 
online shop like eBay etc. The only difference between official Cisco pinout
and ParaTNC is an optional (disabled by default) +5V voltage which may by 
applied to pin 7 of RJ45 connector, which is wired to pin 4 of female DB9 plug.

6. Female DB9 (radio) pinout
The DB9 connector is used to connect to the radio used for receiving & txing
data on the APRS radio network. As mentioned before this connector has a ground
separation and it is isolated from the microcontroller using AF transformer and
optocoupler (for PTT). An input transformer has a 220uF 16V electrolytic
capaciter in series between a primary winding and DB9. The positve lead faces
the DB9 connector to isolate potential DC offset coming from the radio.

The connector itself repeats the Tapr (Muel) TNC-2 pinout which goes as below:
	Pin 3 - AF from Radio to TNC
	Pin 4 - Open Drain PTT
	Pin 5 - AF from TNC to Radio
	Pin 7 - AGND

7. Adjusting audio levels
The ParaTNC controller has two trimpots mounted on PCB which may be used to
tune the level of audio coming from/to the radio.

The trimpot located close to the microcontroller is used to set the output signal
level. The another one which is near right isolation transformer changes the
input level and it is hooked up between the primary winding and DC-blocking
electrolytic

8. JUMPERS (Sketch not to scale!)
-------------------------------------------------------------------------------
|									      |
|	  JP1				  MS5611 sensor			      |
|          x -----------			x			      |
|          x |JTAG conn|			x			      |
|	     -----------			x			      |
|						x			      |
|	   /----------\				x			      |
|	   |          |				x			      |
|	   |   MICRO  |	 DHT22 sensor		x			      |
|	   |          |       x						      |
|	   \----------/	      x						      |
|			      x						      |
|                   RS232 sel						      |
|		       >xx<						      |
|	               >xx<						      |
|									      |
|            JP3							      |
|	      x								      |
|	      x	 --------------						      |
|	         | RS232 conn |						      |
|		 --------------						      |
-------------------------------------------------------------------------------

JP1 - This is used to jump to the serial bootloader during startup
JP3 - This is used to apply regulated +5V supply to RS232 connector
RS232sel - This pair of jumpers is used to choose RS232, present only in HW-RevA
MS5611 - .1' Connector for GY-63 breakout board with MS5611 pressure sensor
		=========
		| empty |
		| empty |
		| empty |
		|  SDA  |
		|  SCL	|
		|  GND  |
		|  +5V  |
		=========
DHT22 - .1' connector for DHT22 humidity sensor
			==========
			|  +5V   |
			| Sensor |
			|  GND   |
			==========


9. CHOOSING BETWEEN RS485 AND RS232 (applies only to HW Revision A)
ParaTNC controller has connectors for both 485 and 232 variant of RS standard.
This doesn't automatically means that ParaTNC has two separate serial ports,
this is still the same serial port from the microcontroller which just may
be converted differently. Due to how TTL and CMOS logic works You CANNOT use
both 232 and 485 at once. If You'll leave 485 and 232 enabled at once the main
logic supply voltage may be shorted to ground if one transceiver will receive
logic one while the another will receive zero (and pull low the TTL/CMOS rx
line which goes to the micro)

It is strongly recommended to put MAX485 into socket. In such case the
transition from RS485 to RS232 could be done just by removing MAX485
from the socket and then shorting the RS232sel jumpers block. Jumpers
needs to be shorted horizontally 
