Repeater controller progress

Jump to: navigation, search


Current Repeater Project


  • Custom Board (Layout in progress)
    • PIC32MZ2064DAx176 MIPS microcontroller
    • I²S DAC, PIC onboard ADC for AF
    • microSD Card Slot for storage (audio files, etc...)
    • USB2.0 and 10/100baseT Ethernet (not populated)
      • usb sound device
      • usb serial device
    • All I/O, except on expansion headers, is fully isolated for prevention of ground loops and damage

Upverter (Cloud EDA) page for controller (schematics, layout, bom, etc...)

Current Architecture

(as reference for programming, this is pretty much set so we can code based on this)

  • Audio out is via I²S attached audio DAC
    • Control via I²C
  • Audio input is via onboard 12-bit,18Msps ADC from PIC
  • USB interface to computer (possibly Type-C or OTG) and maybe Ethernet
  • connection for optional front display, buttons, speaker
  • SD Card, native interface
  • 32MB DDR2 RAM, plus 640 KB SRAM and 2MB Live Update NAND Flash (MMU available)
  • Integrated RTC, backed by supercap
  • 1 UART going to RS-232, DE-9 connector
  • 200MHz Clock
  • MIPS32 ISA, see datasheet for details on CPU features, including DSP features, MMU, and prefetcher
  • digital I/O for controlling TRX via GPIO, solid state relays for output and optoisolators for input
  • still deciding on OS. Okay chance of posix compatibility. Maybe Linux/BSD or an embedded RTOS.


This is a proposed design, no actual coding has been done yet.

supporting software


Threads communicate by setting config variables, triggering events, receiving events or sending/receiving a data stream

These can probably be grouped into three main threads:

  • watchdog thread? (or is this in the kernel)
  • timer event thread (heap driven), maybe combine with repeater state machine
  • audio input thread
    • collects audio input from repeater, filters, and sends to usb
    • detects PL tone and touchtone in input and generates events
    • sends to output thread
  • audio output thread
    • generates audio (pl tone, cw ID, etc., triggered by events)
    • collects audio from input thread and usb
    • replays audio from SD card(?)
    • mixes audio and sends to repeater
    • generates events on playback completion
    • receives signals to abort audio playback
  • GPIO thread(s)
  • serial I/O thread
    • receives events from event bus and relays to serial usb
    • injects events from serial usb into event bus
  • maybe a central event dispatcher thread (combine with serial thread?)

Thread intercommunication consists of:

  • events (defined below)
  • audio streams
  • possible audio stream aborts (via (OOB)signals and events)

Thread functions:

timer (length, end event, restart) 
triggers: start, reset, stop
Dtmf decoder 
input: audio stream output: DTMF events
PL decoder 
input: audio stream output: bool:CTCSS
PL encoder 
modifies audio stream?
Repeater thread
inputs: CTCSS PTT COR TOT CW audio outputs: PTT COR audio
GPIO thread
look for rising edge, falling edge, pulse, or analog ranged triggers
special GPIO threads
for GPIO dedicated to a specific device type
Serial control thread
input: all? events output: serial triggered events, config changes, etc.
CW thread 
input: message output: PTT, audio, end event triggers: abort?
audio thread 
handles audio processing and mixing, described below
Simplified repeater thread state diagram


grandfather clock timer(30m, ID, yes)
reset: HalfHour start/stop via serial only
ID timer(id period(def=9), ID, no)
start: PTT, must not self trigger, may be multiply started, only first start resets timer, may stop via serial
TOT timer(tot, TOT, no) 
start: COR stop: !PTT or !COR
courtesy timer(courtesy lead (2s?), courtesy, no) start
tail timer(tail (1s?), !PTT, no) 
start: !courtesy or !COR

Signals and Events

All events (E) can be artificially triggered via serial. Signals (S) must be triggered and untriggered (or asserted and de-asserted). Some events and signals cause an action including triggering other events. Some events and signals (*) trigger state transitions, actions, and timers which can't be altered (+), but timings can be adjusted.

(E) generated by real time clock
default action: trigger ID
(S*) generated by request to transmit, repeater thread
(S*) generated by receiver detect of carrier, may require CTCSS
(S) generated by PL decoder
(S*+) time out timer; generated by timer, play TOT chime, untriggered by !COR which plays unTOT tone
GPIO digital input 
generated by hardware input on select(none, rising edge, falling edge, positive pulse, negative pulse)
GPIO analog input threashold
(S/E) range select for signal, range edge triggers event; hysteresis needed
(S*+) trigger by timer; plays chime(courtesey+index) and then (if !COR) stops PL encode, deasserts and starts TAIL timer
(S*+) drops PTT when timer expires unless COR aborts
(E*+) plays ID cw message
user event(array)
(E) runs a stored serial string
DTMF event(array)
(E) triggered by a specific sequence of DTMF codes, can trigger a user event
watchdog event
(E) trigger by hardware watchdog after reset is complete, then enters REST state
power on event 
(E) actions at power on followed by REST state

Variables / config options

PL tone
(seconds) time out timer length default=2m
(seconds) gap between !COR and sending chime default=2s
courtesy tone index
(seconds) gap between courtesy and carrier drop default=1s
array of (pitch, duration) ; multiple chimes including: courtesy1 courtesy2 courtesy3 TOT unTOT
ID cw message
series of morse code symbols (e.g., K4UCF/KR ? )
id period
default 9m
repeater variables (i.e., ENABLE)

Serial commands

stop / start / reset timer
set variable
read variable
read digital GPIO
read analog GPIO
set GPIO digital trigger (pin, trigger mode, event)
set GPIO analog trigger (lower, upper, event)
clear GPIO analog trigger
set output GPIO pin
trigger event
set trigger action
test event status
request report of event triggers / all event triggers
clear all report requests
play chimes
play CW
play / record audio clip
start/stop thread??
update firmware (code protect checksum? hardware jumper enable?)
set mode bank (bank contains all vars)
play DTFM to a audio sink

audio thread

This is a guess at what is necessary / possible.

  • may generate audio, possibly based on external controls (covered above)
    • CTCSS tone
    • courtesy tone / chime generation
    • morse code
    • audio clip playback
    • DTMF generation
  • handle incoming audio from multiple sources, mix as necessary
    • internal generated audio (see above)
    • repeater receiver (filtered?)
    • usb sound input
  • will send audio to various devices
    • usb sound output
    • repeater transmitter
  • may do audio processing and send events based on what is found
    • silence detection
    • CTCSS tone detection
    • DTMF detection

Functionality not yet covered

  • audio mixer
  • voice recorder / playback
  • built in real time clock (instead of relying on the computer)
  • weather station (can this be partially covered by GPIO events?)
  • secondary serial port (weather station?)
  • ethernet
Personal tools