Skip to content

Commit

Permalink
Merge pull request #4 from ve7fet/v3.0devel
Browse files Browse the repository at this point in the history
V3.0devel
  • Loading branch information
KG7QIN committed Mar 30, 2021
2 parents dba8414 + 81e59ac commit ddf50b2
Show file tree
Hide file tree
Showing 1,032 changed files with 2,499 additions and 48,226 deletions.
35 changes: 35 additions & 0 deletions README.md
@@ -0,0 +1,35 @@
This repository contains the firmware for the AllStarLink VOTER, the Micro-Node RTCM, and a bunch of
various project fragments that are related to AllStar and the VOTER.

See the /docs folder for information on what the VOTER protocol is, and how the VOTER system works,
in conjunction with chan_voter in AllStarLink.

The EBLEX C30 Programmer is the software utility used to load the VOTER/RTCM over ethernet. You
MUST have the bootloaded installed in the main PIC, and know the bootloader IP address, in order
to be able to capture the target, and load the firmware.

The /VOTER-bootloader folder contains the MicroChip project files, source code, and .cof binary
to load in to the main PIC on the VOTER/RTCM. They allow the EBLEX Programmer (above) to be able
to remotely load firmware in the VOTER/RTCM over ethernet. Otherwise, you need to upload firmware
directly on the module in question through the ICSP header, or an EEPROM programmer (for the VOTER).

The .cof file needs to be loaded in the PIC using a PICKit, or similar, likely via ICSP.

The /VOTER-pcb folder contains the Gerbers and supporting files (schematic, BOM, etc.) for the
original, open-source, VOTER through-hole board. This design IS fully functional, however, you
WILL need to research and update the BOM with currently available components. It is functionally
equivalent to the RTCM that was manufactured by Micro-Node, with the primary difference being that
the RTCM used SMT components, instead of through-hole.

The /VOTER_RTCM-firmware folder contains the firmware used in the PIC of the VOTER and RTCM. As
noted above, the VOTER and RTCM are functionally equivalent, EXCEPT they need to use different
firmware files, as the pin mapping is different between the DIP and SMT PIC packages. As such,
the -smt files should ONLY be used with the RTCM, and not the VOTER. Likewise, the non-smt files
should ONLY be used with the VOTER, and not the RTCM.

The /archive folder contains various other fragments of Jim's projects. Some of them made it in to
production in various forms, some were prototypes, some are now obsolete. Unfortunately, while there
is firmware and source code for a number of the projects, there are no accompanying schematics. If
you have any of the missing information to contribute, please do!


File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions VOTER-bootloader/README
@@ -0,0 +1,13 @@
The VOTER uses a dsPIC33FJ128GP802 and the RTCM uses a dsPIC33FJ128GP804.


There are two parts to the firmware, a bootloader, and then the actual firmware file. The bootloader starts when power is applied, and allows you to talk to the dsPIC and load new firmware files over ethernet. If the bootloader is not intercepted by the loading tool, it will continue to boot the current firmware file.


All new boards will need to have the bootloader installed first, followed by a firmware file. You can load a firmware file directly (.hex) in to the dsPIC, but then you will not have any of the bootloader remote loading features.


This is the current bootloader (.cof file). The -smt file is for the RTCM, if you needed to replace the dsPIC on it for some reason, and needed to re-load the bootloader. It needs to be loaded with a PICKit programmer, through the ICSP header.


Current firmware (.cry files) are available elsewhere in this repository. They are loaded with the EBLEX C30 Programmer via ethernet.
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions VOTER-pcb/README
@@ -0,0 +1,17 @@
The voter-cad-rev-a.zip file contains the following:

-Gerber files for the VOTER PCB
-Schematic, in .pdf and Eagle (~5.11)
-Eagle board layout
-Assembly drawing in .pdf
-Bill of Materials

Note that the BOM is circa 2011, and would need to be updated with currently available components, should you try and build it today.

This is the original, open-source, through-hole VOTER design from Jim Dixon. It IS functional, and can be used with AllStarLink, just like the RTCM.

The RTCM was a spin-off project, built and sold by Micro-Node. The RTCM is effectively the same as the VOTER, except the RTCM was designed and built with SMT components in order to make it more compact. In fact, they are so similar, they use the same firmware, except the RTCM needs a custom compilation for the SMT version of the dsPIC that it uses.

In 2017 prices, the VOTER could be built for about half the cost of the RTCM, if you weren't worried about the form factor.

The VOTER/RTCM are effectively custom "RoIP" adapters. That is, they convert analog audio to ethernet UDP packets. Audio is encoded with ulaw or ADPCM, and signalling is added to communicate between the host (AllStarLink chan_voter) and the client.
File renamed without changes.
@@ -1,6 +1,6 @@
How-to (Re-)Compile Firmware for the VOTER Board
Lee Woldanski, VE7FET
2017/08/08
2021/03/024

If you look in the votersystem.pdf, you will find a procedure to modify and load the bootloader in to
the PIC of a VOTER board.
Expand Down Expand Up @@ -96,6 +96,8 @@ Go to Project --> Build Configuration and select "Release". This may not be nece
option is used in the firmware), but it removes the compiler option of __DEBUG being passed, so
theoretically it would build "normal" firmware.

If you get license errors trying to build a "Release" version, just leave it in "DEBUG".

Project --> Build All and it should build compile everything and show you "Build Succeeded".

A voter.cry file should be in the board-firmware folder. You can load this with the ENC Loader.
Expand All @@ -104,6 +106,7 @@ There is also a .hex file in there that you could load with a programmer... but
the bootloader... so don't do that.


***As of Version 2.00, "Chuck Squelch" is default, and the old code as been removed.***
If you want to enable "Chuck Squelch", open the HardwareProfile.h and un-comment #define CHUCK.

You may also want to go down to Line 291 in Voter.c (right click on the window, go to Properties -->
Expand All @@ -125,3 +128,18 @@ your board from the Device list. If you don't select the right one, the board wi
That's it!

Now you should be able to modify at-will. :)


Baseband Examination Window (BEW) Firmware

Typically, the discriminator of an FM communications receiver produces results containing audio spectrum from the "sub-audible" range (typically < 100 Hz) to well above frequencies able to be produced by modulating audio. These higher frequencies can be utilized to determine signal quality, since they can only contain noise (or no noise, if a sufficiently strong signal is present).

For receivers (such as the Motorola Quantar, etc) that do not provide sufficient spectral content at these "noise" frequencies (for various reasons), The "DSP/BEW (Digital Signal Processor / Baseband Examination Window)" feature of the RTCM firmware may be utilized.

These receivers are perfectly capable of providing valid "noise" signal with no modulation on the input of the receiver, but with strong modulation (high frequency audio and high deviation), it severely interferes with proper analysis of signal strength.

This feature provides a means by which a "Window" of baseband (normal audio range) signal is examined by a DSP and a determination of whether or not sufficient audio is present to cause interference of proper signal strength is made. During the VERY brief periods of time when it is determined that sufficient audio is present to cause interference, the signal strength value is "held" (the last valid value previous to the time of interference) until such time that the interfering audio is no longer present.

The DSP/BEW feature is selectable, and should not be used for a receiver that does not need it.

***If you compile/load firmware in the VOTER/RTCM with BEW features, you will LOSE the Diagnostics Menu, as there isn't enough room in the dsPIC for both!***
68 changes: 68 additions & 0 deletions VOTER_RTCM-firmware/build-files/README.md
@@ -0,0 +1,68 @@
Firmware Changelog

1.50 04/25/2015
This is the base version of the repository for the initial commits, as far as we can tell.

1.51 08/07/2017
Adds a patch to process_gps in voter.c for TSIP receivers, targeted/assumed to be Trimble Thunderbolts to fix a 1997 date issue:

gps_time = (DWORD) mktime(&tm) + 619315200;

This effectively added 1024 weeks to the time, to correct the date.

Note, this is a CRUDE fix, and likely breaks other Trimble GPS' that speak TSIP. To be resolved in a future version.


1.60 12/06/2020
Reverts the above patch, and replaces it with some logic. Adds a new configuration option (81), to identify if the GPS being used is a Trimble Tunderbolt. If it is, then the GPS week reported by the GPS is evaluated, and the appropriate correction is applied to the time, either adding 1024 or 2048 weeks.

This version also adds correction for leap seconds in TSIP devices. Some TSIP devices (ie Resolution T) report their time in GPS time, not UTC. That means that they lead UTC time by the current number of "leap seconds". If you have ALL the same devices in your system, this isn't a problem, since they will be all off by the same number of leap seconds, and chan_voter won't care.

However, if you introduce another type of GPS that reports time in UTC (ie a uBlox), that device will never get voted (silent fail), as while it will connect to the server, it will get excluded from voting by chan_voter, due to the time differential.

This fix examines the Primary Timing Packet from the TSIP receiver, and looks at the flags to see if it is using GPS time, or UTC time. If it is using GPS time, it then takes the supplied UTC offset (current leap seconds), and subtracts it from GPS time, to synchronize this device with UTC time, so it will play well with others.

Added additional bytes (gps_buf[2] and [3]) to the TSIP debug to see Receiver mode and Discipline Mode. No checks currently implemented against them (memory constraints).

Fixed the check of Supplemental Timing Packet 0xAC Minor Alarms, gps_buf bytes were swapped. Not critical, as we are checking for everything to be 0 (no alarms) anyways, but debugging makes more sense when we are looking at the right bits. gps_buf[12] is the low byte (Bits 0-7), and gps_buf[11] is the high byte (Bits 8-12).


1.61 1/11/2021
The mktime() sub-routine in MPLAB C30 has a bug, see https://www.microchip.com/forums/m653169.aspx

After 12/31/2020 23:59:59, mktime() now returns -1, instead of epoch time. That BREAKS the firmware, as on boot, the
date/time starts counting from epoch, and nothing will syncrohize anymore, since all VOTER/RTCM's will have different
times once restarted. The main receiver will still receive, you just lose all voting.

David Maciorowski, WA1JHK, wrote a patch to replace using mktime(). It takes the known value of epoch seconds up until
01/01/2021 00:00:00, and then uses the time/date from the GPS to add the offset to current time/date. Crude, but effective,
since we don't care about time in the past, only need to know the time now.


2.00 3/24/2021
This version drops the original squelch code (which actually had a bug in it), and makes "Chuck Squelch" the default squelch. As such, all binaries will have Chuck Squelch, there will be no binaries compiled with the original squelch (that code has been removed).

Add some comments to the source, trying to figure out what some parts do. Looks like the un-documented "Saywer" mode forces the PL filter OUT of the receive audio path, when in OFFLINE mode, if enabled (Sawyer=1).

Remove the "autoconfiguration" of the baud rate, and resetting PPS/GPS polarity to 0 when changing to/from NMEA/TSIP. This just adds confusion when trying to set up a GPS. Leave the baud and polarity settings alone.

This version reverses the logic for ToS/DSCP marking of packets. Now, by default, we will mark all packets outbound from the VOTER/RTCM with DSCP 48 (802.1p Class 6 aka Network Control ToS). Debug Level 16 now DISABLES ToS, changing the packets to Routine. Don't forget, you still need utos=y in your voter.conf to mark packets from the server TO the VOTER/RTCM.

Add another GPS debug feature to help determine PPS polarity. GPS debug will now report if you have PPS configured (set to 0 or 1), but it doesn't see detect a PPS pulse. This is likely because you are using the wrong polarity. Also added entry to 98-status menu to show if the PPS is bad (and suggest checking polarity). If PPS is set to ignore, the status menu will show 0 anyways, since it is not used.

Add another menu config option (82) to allow you to add an arbitrary number of seconds to this device's GPS time, in order to synchronize with the master. Different brands have different firmware bugs, and may not always come up with the right rime. This makes it easier to line those times up, as long as it is a consistent offset. ie. if you need to add 19.4 years, that would be 19.4 * 365 * 24 * 60 * 60 = 611798400 seconds. This is similar to the change proposed by Chuck Henderson (WB9UUS), except that it adds it to the main menu, and allows for an arbitrary amount of time, up to 25 years.

3.00 3/24/2021
This is another major release, as it introduces the ability to remotely adjust the squelch of the VOTER/RTCM.

By default (originially), the Squelch Pot (R22) just sets a voltage on an ADC line of the PIC. Based on the ADC value read, the setting of the squelch is determined.

It is often desired to be able to remotely tune the squelch of the receiver, without having to drive to the radio site to "diddle the pot", and as it turns out, this is relatively trivial to do in software, by directly setting the value that would normally read from the ADC.

In addition, there is a "squelch tunable" in the firmware, called "hysteresis", that will be brought out so it can be adjusted without having to recompile the firmware. By default, this has always been set to "24", unless you specifically changed it, and compiled your own firmware.

Therefore, this version adds a new (S)quelch menu, that lets you adjust the squelch level and hysteresis remotely.

Note, due to space constraints in the PIC, the option to display the "diagnostic cable pinout" has been removed from the diagnostic meny. This allows us to have the option to select using the hardware squelch pot, or software squelch pot.

When using the software squelch setting, the change is immediate, but do not forget to save the EEPROM settings (99) when you are done your adjustment, to make it permanent.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -61,22 +61,37 @@ extern char dummy_loc;
#define SMT_BOARD
#endif

// #define CHUCK

#if defined CHUCK
#define CHUCK_SQUELCH
#define CHUCK_RSSI
#endif

// Set configuration fuses (but only once)
#if defined(THIS_IS_STACK_APPLICATION)

// Set Configuration Registers
// Code Protect off, Code Protect disabled, Write Protect disabled
_FGS( GSS_OFF & GCP_OFF & GWRP_OFF )

// Primary (XT, HS, EC) oscillator with PLL
// Start-up device with user-selected oscillator source
_FOSCSEL( FNOSC_PRIPLL & IESO_OFF )

// Clock switching and clock monitor both disabled
// Single configuration for remappable I/O OFF
// OSC2 is clock O/P
// XT oscillator (3-10MHz)
_FOSC( FCKSM_CSDCMD & IOL1WAY_OFF & OSCIOFNC_OFF & POSCMD_XT )

// Watchdog Timer disabled (enabled/disabled by user software)
// Windowed Watchdog Timer disabled (non-window mode)
// Watchdog Timer Prescaler 1:32
// Watchdog Timer Postscaler 1:4096
_FWDT( FWDTEN_OFF & WINDIS_OFF & WDTPRE_PR32 & WDTPOST_PS4096)


// I2C mapped to SDA1/SCL1
// Power-on Reset Value disabled
_FPOR(ALTI2C_OFF & FPWRT_PWR1 )

// JTAG disabled
// ICD communication channel communicate on PGC3/EMUC3 and PGD3/EMUD3
_FICD(JTAGEN_OFF & ICS_PGD3 )

#endif // Prevent more than one set of config fuse definitions
Expand All @@ -86,8 +101,8 @@ _FICD(JTAGEN_OFF & ICS_PGD3 )


// dsPIC33F processor
#define GetSystemClock() (76800000ul) // Hz
#define GetInstructionClock() (GetSystemClock()/2)
#define GetSystemClock() (76800000ul) // Fosc (Hz), see voter.c for how the clock is set
#define GetInstructionClock() (GetSystemClock()/2) // Fcy = 38.4MHz
#define GetPeripheralClock() GetInstructionClock()

// #define DUMPENCREGS
Expand All @@ -113,24 +128,24 @@ _FICD(JTAGEN_OFF & ICS_PGD3 )

#endif

#define UARTTX_TRIS dummy_loc
#define UARTTX_IO dummy_loc
#define UARTRX_TRIS dummy_loc
#define UARTRX_IO dummy_loc
#define UARTTX_TRIS dummy_loc
#define UARTTX_IO dummy_loc
#define UARTRX_TRIS dummy_loc
#define UARTRX_IO dummy_loc

// ENC28J60 I/O pins
#define ENC_CS_TRIS (TRISBbits.TRISB11) // Comment this line out if you are using the ENC424J600/624J600, ZeroG ZG2100, or other network controller.
#define ENC_CS_IO dummy_loc
#define ENC_CS_TRIS (TRISBbits.TRISB11) // Comment this line out if you are using the ENC424J600/624J600, ZeroG ZG2100, or other network controller.
#define ENC_CS_IO dummy_loc
//#define ENC_RST_TRIS (TRISBbits.TRISB10)
//#define ENC_RST_IO (PORTBbits.RB10)
//#define ENC_RST_IO (PORTBbits.RB10)

#define ENC_SPI_IF (IFS0bits.SPI1IF)
#define ENC_SSPBUF (SPI1BUF)
#define ENC_SPISTAT (SPI1STAT)
#define ENC_SPI_IF (IFS0bits.SPI1IF)
#define ENC_SSPBUF (SPI1BUF)
#define ENC_SPISTAT (SPI1STAT)
#define ENC_SPISTATbits (SPI1STATbits)
#define ENC_SPICON1 (SPI1CON1)
#define ENC_SPICON1 (SPI1CON1)
#define ENC_SPICON1bits (SPI1CON1bits)
#define ENC_SPICON2 (SPI1CON2)
#define ENC_SPICON2 (SPI1CON2)

// 25LC256 I/O pins
#define EEPROM_CS_TRIS dummy_loc
Expand All @@ -149,10 +164,10 @@ _FICD(JTAGEN_OFF & ICS_PGD3 )
#define POT_SPI_IF (IFS0bits.SPI1IF)
#define POT_SSPBUF (SPI1BUF)
#define POT_SPICON1 (SPI1CON1)
#define POT_SPICON1bits (SPI1CON1bits)
#define POT_SPICON1bits (SPI1CON1bits)
#define POT_SPICON2 (SPI1CON2)
#define POT_SPISTAT (SPI1STAT)
#define POT_SPISTATbits (SPI1STATbits)
#define POT_SPISTATbits (SPI1STATbits)

#define IOEXP_SPI_IF (IFS0bits.SPI1IF)
#define IOEXP_SSPBUF (SPI1BUF)
Expand All @@ -163,7 +178,7 @@ _FICD(JTAGEN_OFF & ICS_PGD3 )
#define IOEXP_SPISTATbits (SPI1STATbits)


#define DISABLE_INTERRUPTS() __builtin_disi(0x3FFF)
#define ENABLE_INTERRUPTS() __builtin_disi(0)
#define DISABLE_INTERRUPTS() __builtin_disi(0x3FFF)
#define ENABLE_INTERRUPTS() __builtin_disi(0)

#endif
Expand Up @@ -87,7 +87,8 @@
#define IP_SERVICE_N_RELIB (0x00)
#define IP_SERVICE_H_RELIB (0x20)

#define IP_SERVICE ((AppConfig.DebugLevel & 16) ? 0xc0 : (IP_SERVICE_ROUTINE | IP_SERVICE_N_DELAY))
// Debug Level 16 will disable TOS/DSCP (48) marking of packets, normally mark all packets with DSCP 48
#define IP_SERVICE ((AppConfig.DebugLevel & 16) ? (IP_SERVICE_ROUTINE | IP_SERVICE_N_DELAY) : 0xc0)

#if defined(STACK_USE_ZEROCONF_MDNS_SD)
#define MY_IP_TTL (255) // Time-To-Live in hops
Expand Down
Expand Up @@ -54,6 +54,9 @@
EEPROM_BUFFER_SIZE, USE_LCD
* Howard Schlunder 8/09/06 Removed MCHP_MAC, added STACK_USE_NBNS,
* STACK_USE_DNS, and STACK_USE_GENERIC_TCP_EXAMPLE
* VE7FET 12/05/20 Add GPSTBolt
* VE7FET 12/13/20 Add GPSOffset
* VE7FET 3/24/21 Add Squelch and Hysteresis and Sqpot
********************************************************************/
#ifndef __STACK_TSK_H
#define __STACK_TSK_H
Expand Down Expand Up @@ -162,7 +165,12 @@ typedef struct __attribute__((__packed__))
BOOL EthFullDuplex;
WORD LaunchDelay;
WORD CTCSSThreshold;
BYTE Zeros[564];
BYTE GPSTbolt;
DWORD GPSOffset;
WORD Squelch;
WORD Hysteresis;
BOOL Sqpot;
BYTE Zeros[553];
} APP_CONFIG;

#ifndef THIS_IS_STACK_APPLICATION
Expand Down
File renamed without changes.

0 comments on commit ddf50b2

Please sign in to comment.