DSP Speech Processor Experimentation 2012-2020

Version 2.1 June 2013

Back to Index.

A DSP speech processor based on the Microchip dsPIC33 Digital Signal Controller, designed to maximize voice levels on communications transceivers.
 
 
A homebrew speech processor designed for SSB applications.

Flattens the speech power spectrum and improves the peak-to-average ratio of speech to about 6dB, while maintaining good audio quality.

Box size: 110 mm x 70 mm x 24 mm.

Hardware features:

  • RF filtering on inputs and outputs.
  • Analog AGC on mike input to prevent input clipping.
  • Ground loop suppression on Tx and Rx.
  • Analog bass EQ boost for transmitter compensation.
  • Rx audio processing input.
  • TDA2003 audio amp for receive output.
  • Polyswitch 12V rail protection.
  • 3 spare microphone pin connections via 8-pin Mini-DIN connectors.
  • Front panel Headphone/Line output for monitoring or recording (both Tx and Rx audio).
  • 44.1 kHz 3.5 mm mini TOSLINK S/PDIF optical digital 2-channel audio output for recording.
  • Power consumption: Under 5 watts (Transmit mode).
  • No power switch - Always-on design.


Software features:

  • Dynamic pre-emphasis for improved clarity and reduced distortion.
  • Microphone Flatness adjustment to compensate non-flat microphones.
  • Six-band look-ahead digital audio compressor with delayed recovery and noise gating.
  • Look-ahead digital output compressor for well controlled clipping level.
  • Two-band low-distortion Hilbert Transform clipper.
  • "Virtual clipping" mode for even lower distortion.
  • Multiple processing levels (Bypass, Singleband, Multiband Local through DX).
  • Selectable processing band limits: 60 Hz, 125 Hz or 250 Hz and 3 kHz or 4.5 kHz.
  • Receive mode LMS Noise Reduction.
  • Receive audio AGC (Volume limiter).
  • Single tone, two-tone, modulated tone, swept tone, toneburst and white noise for testing purposes.
  • Automatic tone sequences and white noise in 10 dB steps for processor Self-test mode.


Concise processing audio chain overview:

  • Low noise, low-distortion 2-transistor mike preamp with software AGC control to prevent clipping.
  • Gain freezing on input AGC to stabilize level and prevent pumping and noise increase.
  • Dynamic pre-emphasis boost, compressing about 18dB above 1kHz.
  • 20 stages of phase rotation centred on 100Hz (adjustable).
  • 10dB to 24dB of 6-band compression with noise gating.
  • About 6dB (up to ~30dB) of single-band output compression with EQ sidechain.
  • About 6dB (up to ~18dB) of dual-band Hilbert clipping.
And it fits in your shirt pocket! :)

PCB cost: AUD$21 including AirMail delivery see below.

Estimated parts cost: Around $50USD (not including PCBs).

Estimated time to build: About two days - depending on skill level.
 

Controls (Left to right)
Button 1: MODE : Resets the display and operating mode to normal Transmit mode.
Button 2: SELECT : Steps through the Select menu, to select different options.
Button 3: - (minus) : Decrements selected option.
Button 4: + (plus) : Increments selected option.
LED Bargraph:
LED 0 = Pre-emphasis Limiter.
LED 1 = Band 1 (60 Hz-125 Hz).
LED 2 = Band 2 (125 Hz-250 Hz).
LED 3 = Band 3 (250 Hz-500 Hz).
LED 4 = Band 4 (500 Hz-1 kHz).
LED 5 = Band 5 (1 kHz-2 kHz).
LED 6 = Band 6 (2 kHz-3 kHz or 2 kHz-4.5 kHz).
LED 7 = Output Compressor.
LED 8 = Hilbert Clipper.

Using the economical 28 pin SPDIP dsPIC33FJ64GP802 by Microchip. (or the dsPIC33FJ128GP802)
40 MIPS @ 3.3V, 16k RAM, 64k FLASH, built-in stereo audio DAC with 256x oversampling, 1 x 10/12 bit ADC, 16 bit CPU design, and many other features.
This processor is a real DSP unit, and has many features to speed up processing such as:
Harvard architecture (separate data and program busses).
Hardware support for multiply, divide, MAC and data move instructions.
Two 40 bit DSP accumulators, hardware multiplier, hardware divider (max 32/16 bit in only 18 CPU cycles), instruction prefetching, hardware saturation, hardware rounding, barrel shifter, memory mapped IO, multiple DMA channels, multiple IRQs, multiple clock sources, in-system low-voltage programming... the list goes on!
 
If you are interested in trying to build this unpublished design for an Amateur Radio or CB radio application, contact the author at this email address:

If no reply is received after two weeks, try again - Spam filtering may have deleted your message.
Remember to check your own spam filtering to ensure you can receive a reply from me!

Please note:

  • This project is NOT a kit.
  • This project is NOT a commercial product.
  • There are no panels or components for sale at this time. PCBs are sold out!
  • This project is shown as a demonstration of what is possible, and to share ideas.
  • Schematics are shown below.
  • Software is still in development.
  • dsPIC code is available via email for personal use only.
  • PCB artwork is available via email for personal use only.
  • This unit is a work in progress and continues to be improved.
  • Details, features and audio levels may change in future versions.
  • This version is unable to support VOX operation due to ADC switching.
  • No guarantees can be made - use at your own risk.
This project was designed to provide "Medium-Fi" processing for older, homebrew or low-budget transceivers without speech processing. It can also be used on radios with SSB RF clipper processors to improve quality. Modern DSP radios that lack good processing can also work very well with this unit.

This processor is designed for maximum loudness, and doesn't try to be "Hi-Fi" - though on-air it sounds very good - almost like a shortwave broadcasting station. This is primarily due to the use of phase rotation, multiband compression and multiband clipping - similar techniques to those used in broadcasting.
 

Standard audio processors do not suit Amateur radio use:

* For SSB, limiting audio level does not control PEP levels accurately.
* Most audio processors do not produce a flat output power spectrum required for best SNR on SSB and AM.
* Most audio processors do not have the output ground loop isolation required to drive an unbalanced transceiver mike input.

What this processor does right:

* A Hilbert Clipper is used (IQ vectorsum controlled limiting) for best SSB PEP control.
* A flat output power spectrum is produced. This matches the flat noise floor of SSB and AM.
* Transceiver ground loops are prevented by using a ground loop cancellation output amplifier circuit.

Some Speech Processing Theory

The difference between the quietest and loudest dB levels in an audio signal is referred to as its "Dynamic Range".

Due to the large dynamic range of unprocessed speech (greater than 30 dB according to various references), speech processing is widely used to reduce this range for consistent modulation. This is especially important for broadcasting and communication where the maximum peak level is limited by the maximum transmitter power level or the defined modulation standard. Both compression and peak clipping are used to reduce the dynamic range of audio content in these applications.

AM and SSB systems have a flat noise spectrum, because they respond equally to noise across the passband. The unprocessed voice has a bass heavy spectrum, as the fundamental and low harmonics of the vocal cords are far stronger than the higher harmonics. FM systems have a noise spectrum that rises with frequency. Pre-emphasis is used in both AM/SSB and FM systems to compensate for these factors.

"Loud, bright, clean - pick any two" is a well known choice in FM broadcasting. This is because the receiver de-emphasis makes low frequencies sound louder. To increase brightness, less bass energy is available - reducing loudness. To increase loudness, more clipping can be used which then increases distortion. Since most receivers have some type of de-emphasis or hi-cut filtering, this effect can also happen in communications gear.

Multiband compressors are often used in broadcasting and music mastering applications because their action produces less undesirable effects than broadband compression (e.g. "pumping" and increased IMD). Essentially the audio spectrum is divided into bands by a filter bank, then compressed individually before being recombined - sometimes after additional filtering to suppress any compressor distortion products.

The multiband compressor also has the effect of producing a more even spread of energy across the audio band, producing a flatter power spectrum. This is useful, as it matches the flat noise spectrum of SSB and AM systems. It gives all the voice frequencies a better chance of being heard above the noise floor, while maintaining a higher perceived quality.

This is the approach used here.

The multiband compression is teamed up with phase rotation, additional wideband compression and Hilbert clipping to significantly increase the average speech power without adding harmonic distortion, or excessive amounts of intermod distortion.

This design will outperform any conventional analog processor, and any standard audio DSP processor.* With its reasonably flat audio spectrum, the processor produces a typical peak-to-average ratio of about 6dB (3kHz BW, Mode 4, clipping ON), while maintaining good quality.

* Unprocessed audio with excessive bass can produce high average RF power due to the bass having a high duty cycle. This looks good on a power meter, but results in poor readability in bad conditions.
 

SSB hates Square Waves!

It has long been known that square wave audio fed into an SSB transmitter produces a very spiky RF output with a low average power. This is primarily due to the inherent Hilbert transform that occurs when generating SSB - either by phasing, Weaver, or filter methods. Virtually all SSB modulators also have a highpass response, causing a low frequency rolloff of the audio. The flat tops on a squarewave are essentially DC pulses, and they require an extrodinarily low frequency response in a modulator to faithfully reproduce the waveform without "tilt". This is impractical in a standard SSB transmitter due to the close spacing of these low frequencies to the opposite sideband.

Ordinary peak clipping of speech waveforms causes flat tops that resemble square waves. It also adds harmonic distortion that makes the voice sound harsh, raucous and unpleasant. This makes it undesirable for SSB speech processing.

Instead, clipping and filtering the SSB RF output produces a higher average power with only an increase in on-channel IMD (Intermod Distortion). IMD sounds far less objectionable on speech, so SSB RF clipping is far better for speech processing than audio clipping.

SSB RF clipping has an equivalent, known as "Hilbert Clipping". Hilbert Clipping is straightforward to do in DSP, by using a "Hilbert Transform" to generate a "Q" (Quadrature) signal from the "I" (In-phase) input, then finding the vector sum of the I and Q signals and using it as a gain control signal. Effectively, the system acts as a compressor with zero attack and recovery time. The waveforms are limited without any squaring, causing IMD from the changing gain - but (ideally) no harmonic distortion. The output can be clipped heavily without generating square waves.

Since the SSB RF envelope is proportional to the vector sum of the I and Q signals, it produces accurate clipping of the RF envelope. This produces higher average SSB RF power with low harmonic distortion, plus some on-channel intermod distortion.

 

Page Shortcuts

Display and Buttons
New Firmware Settings - Select Menu
Old Firmware Settings - Select Menu
How to save settings
Troubleshooting
Schematics
Measurements
Video and audio demonstrations
Constuction Pictures
PCB Pictures
Bill of materials
Bill of materials plus placement grid
dsPIC Programming interface schematic
dsPIC Programming
Microphone Connector Pinouts
Microphone Wiring
dsPIC Code examples
PCB sales

LATEST DEVELOPMENTS

Bandwidth And Noise Tests - Now moved to its own page. Some interesting results here with speech buried in noise.


PCBs

Commercially made PCB sets are now SOLD OUT! (May 27, 2020).
 

Version PCB260.

Three PCBs in one set:

  1. PCB260A = Main board
  2. PCB260B = Display PCB 1
  3. PCB260C = Display PCB 2 (LED board)
Material: FR4.
Double sided, plated through holes.
Thickness: 1.0mm.
Top and bottom green soldermask.
Top and bottom white silkscreen overlay.
Finish: HASL.
Edge routed to shape.

These PCBs have no errors. See pictures of the boards here.

The thinner 1.0mm PCB material improves mounting clearances of the LEDs, audio IC, and connectors.




July 14, 2015: The main PCB from the latest batch of commercially made boards (PCB260A) built up and working. The front of LED D10 has been trimmed off to improve light diffusion.


Constructors

Congratulations to Frank G0GSR for being the first builder to duplicate this design.

Frank has built the PCBs into a 1U rack case to expand the I/O connectors and add extra controls:

An early test can be heard here.

Processor demonstration. G0GSR (Frank) in QSO with M3ZDZ (another Daz), recorded from Hack Green WebSDR. EDITED. This DSP Speech Processor is demonstrated, along with a DBMax for comparison.
 
 

PCB sales and known working units, by country:
* Prototype/test units
 
Country PCBs Units
Australia 5/2* 4
Brazil 2 0
France 1 0
Germany 3 1
India 8 13
Liechtenstein 1 0
Netherlands 3 0
New Zealand 1 0
Norway 1 0
Poland 1 0
Portugal/Azores 2 0
UK 8 3
Ukraine 1 0
USA 3 0

 

Demo video & audio


Nov 25, 2016.
Video of the DSP Speech Processor v2.1 in action - H.264/MP4 Format.
This recording has been lowpass filtered to more closely replicate the sound of passing through transmit filtering.
The "r" in receive mode shows Rx volume adjust is selected (- and + buttons change Rx Volume).
The default transmit behaviour is to show Tx processing level number (- and + buttons change mode number).
The LED "bargraph" is actually configured to show limiting action of each compressor or limiter stage.
The LED ordering is: Pre-emphasis limiter, band 1 through band  6, output compressor and Hilbert Clipper stages.
Audio was recorded via S/PDIF interface for best quality.


Audio

Audio recording via HDSDR Flat receive (no de-emphasis) October 28, 2014.

CB chat August 8, 2015 NEW Demonstration in 4.5kHz bandwidth. 27Mhz CB transceivers, 12W PEP over a 15.7km non-LOS path. DSP Speech Processors used on both radios. Some EQ applied to flatten receiver audio responses. Default Mode 5 on both units. Recorded via TOSLINK output at each end of the QSO, then edited together. SSB frequency correction was applied in Spectrum Lab to correct mistuning.
 


LMS Noise Reduction test - 40m Amateur band

2013-06-24-NR-test-7155kHz-1730-local.mp3

NR is turned off for a short while in this MP3 to show effectiveness. Some audio clipping is heard - AGC routines are still being adjusted.
 

2013-11-20-7150kHz-0150-local.mp3

NR is turned on at 21 seconds into this recording.
 

2013-12-13-VK2IY-VK2QA-40m-2100-local.mp3

NR is used throughout this recording. New Rx AGC is used. What a great story by VK2IY Angus!


Measured specs (S/PDIF output)

White Noise Spectrum Plot 25/02/2016 @-6dBFS - Mode 5.

 
White Noise Spectrum Plot 16/08/2014 @-6dBFS - Mode 4.

The response flattens out at high levels.
White Noise Spectrum Plot 16/08/2014 @-16dBFS - Mode 4.

The bass response is designed to drop slightly as the level drops 10dB.
White Noise Spectrum Plot 16/08/2014 @-26dBFS - Mode 4.

The bass response drops more as the level drops 20dB.
White Noise Spectrum Plot 16/08/2014 @-36dBFS - Mode 4.

At very low levels the dynamic pre-emphasis dominates the response.


Measured 02/03/2016.
Sinewave Distortion, Aliasing & Spurious levels - Processing mode 5 - Tested in Self-test mode.

Frequencies are rounded to the nearest Hz - Hanning window.
dB is dB below full scale via S/PDIF output.
dBFS Fundamental Frequency dBFS Worst Spurious Frequency
-14 86 -66 259 (3rd harmonic)
-12 172 -76 862 (5th harmonic)
-12 345 -74 1035 (3rd harmonic)
-12 689 -81 1379 (2nd harmonic)
-12 1379 -90 2759 (2nd harmonic)
-12 2758 -97 3184 (spurious)
-12 4137 -81 2795 (spurious)

Some of the distortion measured is due to spurii produced in the DDS sinewave routine.
Harmonic distortion levels are very low in all stages. The main distortions are now clipper IMD, residual aliasing and IIR filter noise.



Measured 07/02/2016.
Sinewave Distortion, Aliasing & Spurious levels - Processing mode 5 - Tested in Self-test mode.

Frequencies are rounded to the nearest Hz - Hanning window.
dB is dB below full scale via S/PDIF output.
dBFS Fundamental Frequency dBFS Worst Spurious Frequency
-13 85 -65 259 (3rd harmonic)
-12 172 -74 1207 (7th harmonic)
-12 345 -71 1035 (3rd harmonic)
-12 689 -82 2068 (3rd harmonic)
-12 1379 -89 4138 (3rd harmonic)
-12 2758 -96 4881 (spurious)
-12 4137 -87 1379 (DDS spur)

Some of the distortion measured is due to spurii produced in the DDS sinewave routine.
Harmonic distortion levels are very low in all stages. The main distortions are now clipper IMD, residual aliasing and IIR filter noise.



Measured 07/02/2016.
Noise level, measured by waveform statistics, S/PDIF output @5.5kHz BW.
Electret unplugged, gain at minimum.
Mode 5: -38.59dBFS RMS - Noise Gate off.
Mode 5: -59.39dBFS RMS - Noise Gate on.


Measured 10/11/2013.
Noise level, measured by waveform statistics, S/PDIF output @5.5kHz BW.
Mode 0: -84.07dBFS RMS - Electret unplugged, gain at minimum.
Mode 4: -42.81dBFS RMS - Noise Gate off.
Mode 4: -57.61dBFS RMS - Noise Gate on.

Compression @689Hz  = 29.15dB.
Compression @4136Hz = over 36dB. (updated 05/08/2014)


Measured 19/08/2013 after more input gain optimization.
Noise level, measured by waveform statistics, S/PDIF output @5.5kHz BW.
Mode 0: -86.00dBFS RMS  - Mike input shorted.


Measured 17/08/2013.
Noise level, measured by waveform statistics, S/PDIF output @5.5kHz BW.
Mode 0: -84.07dBFS RMS - Electret unplugged, gain at minimum.
Mode 0: -72.24dBFS Peak - Mike input shorted.
Mode 0: -84.30dBFS RMS  - Mike input shorted.
Mode 0: -85.39dBFS RMS  - ADC input shorted.
The microphone amplifier appears to be making a minimal contribution to the input noise.
 

Power Consumption

Under 5 Watts (Transmit mode).

Current drain: as of 06/11/2013 @ 13.8 Volts.
Transmit, Bright mode: 330mA.
Transmit, Dim   mode:  200mA.
Receive,  Bright mode: 310mA+   Expect current to rise with received audio driving a speaker.
Receive,  Dim  mode:  180mA+   Expect current to rise with received audio driving a speaker.

If current consumption is much higher than this, test for audio amp oscillation, a short circuit, or a failed SMD regulator.
 

Firmware Update (new)

New firmware is available (2019) to improve processing performance.
 
 

The new firmware has some differences:

Processing stages up to the Multiband compressor are unchanged. The processor sounds slightly better than the old firmware, and average SSB power is slightly higher. Actual improvement will depend on the transceiver characteristics.
 
Weaver SSB Modulator
The Weaver SSB modulator multiplies a quadrature carrier with the audio input and lowpass filters the result.

The carriers are produced by a software DDS sinewave generator, as this has the most accurate amplitude and phase. The carrier frequency is positioned halfway up the passband: 1.51kHz for 3kHz BW, and 2.25kHz for 4.5kHz BW. The DDS frequencies are carefully chosen to minimize spurious sidebands from the DDS.

The SSB filter is a 6-pole IIR lowpass filter. This passes the difference frequency, and blocks the sum frequency of the mixing. The SSB is centered on 0 Hz and includes positive and negative frequencies.

Hilbert Clipper
After the SSB is generated, it is processed by the Hilbert clipper. The Hilbert clipper clips the IQ signals based on their vectorsum. This accurately limits the SSB envelope, as it also follows the IQ vectorsum. The clipping threshold is adjustable to alter the processing level.

The updated Hilbert clipper uses an "equiripple" magnitude estimator which has higher accuracy (<1% error) than the previous version. This reduces overshoot by improving clipping accuracy, while also saving CPU cycles compared to a normal vectorsum computation by avoiding the need for a complicated square-root math function.

IQ FIR Lowpass Filter 1
After the Hilbert clipper, the signal is lowpass filtered to remove out-of-band distortion products from the clipping. This also is essential to reduce overshoot from the transceiver filtering. Since the Weaver SSB is centered on 0 Hz, only lowpass filters are required for a bandpass SSB response.

Both lowpass filters that follow the Hilbert clipper are FIR types for linear phase and minimum overshoot. Some overshoot is caused by spectral truncation (removed frequencies) and so an overshoot clipper is used next.
 

CESSB Overshoot Clipper
After the first FIR filter, the SSB signal will have some overshoots that are detected in the CESSB overshoot clipper. The clipper control signal is amplified to overcompensate the clipping action, and the overshoots are reduced below 100%, instead of being clipped at 100%. This compensates for the overshoot from the next filter.

IQ FIR Lowpass Filter 2
The final stage is another FIR lowpass filter, to suppress the clipper distortion products.

Since the overshoots were reduced below 100%, the overshoot from this final FIR filter doesn't cause the peaks to significantly overshoot beyond 100%.

The clipper reference level of 100% is set to -6dBFS, to allow headroom for any residual overshoots (~0.1dB) to avoid distortion.

Weaver SSB Demodulator
The final step in the new processing chain is to demodulate the Weaver SSB back to audio. This is done by multiplying the I and Q SSB signals with the original DDS carriers again, and correctly matrixing them to select the correct sideband.
 

The recovered audio is then passed on to the output EQ stage to compensate for the non-flat transceiver response, the same way the old firmware did.


Signal processing structure - Original Firmware (old)

Initialization
At power-on, the software routines are configured to work in an orderly way.
The software Stack is configured.
CPU clock is configured.
I/O pins are configured.
Analog AGC is set fully on to charge microphone amplifier capacitors. This takes about 2 seconds.
RAM is cleared to prevent IIR filter oscillation.
Coefficients are copied from program memory into "Y" RAM.
Variables are set.
Hardware peripherals are configured.
Interrupts are enabled.
Saved settings are loaded from Flash memory.

Transmit Mode

Analog microphone input AGC
The microphone input has a simple but effective limiter to reduce excessively high input levels and prevent clipping. The software measures the audio level, and a smoothed peak sensing control signal is derived. This control signal is output by Timer2 OC2 in PWM mode, to give reasonably linear control of a transistor attenuator. This method has the advantage of software digital filtering of the AGC loop.

A "Hang timer" has been added. This helps stabilize the gain level, and prevents excessive compression at high input gain settings.
A "Gain freeze" function has been added to prevent the gain rising until a threshold audio level is reached. This helps to prevent background noise rise during speech pauses.
Gain can be reset manually by pressing the MODE button.

FIR oversampling filters
In 12 bit mode, the ADC takes 14 clock cycles for each conversion. The CPU clock is divided by an internal programmable divider in the ADC to provide a fast conversion clock frequency which is not too critical. The ADC has now been configured to use Timer5 as a sampling clock. This produces a sample rate that is precisely 16 times the DAC sample rate, for oversampling purposes. Oversampling eases input filter requirements, prevents ADC aliasing and increases SNR. The DSP processing runs at the output samplerate of 11.025kHz.

DMA is used to collect 16 samples into RAM, and avoid CPU overhead. The DMA buffer is now configured in "Ping Pong" mode for greater timing freedom. FIR filter #1 runs at 176.4kHz. It lowpass filters the 16 samples at 5.5kHz with a stopband of 22kHz, and outputs 4 samples at a sample rate of 44.1kHz. Only 4 samples are computed for efficiency. FIR filter #2 lowpass filters the 4 samples at 5kHz with a stopband of 11kHz, and outputs 2 samples at a sample rate of 22.05kHz. Only 2 samples are computed for efficiency. FIR filter #3 lowpass filters the 2 samples at 4.5kHz with a stopband of 5.5kHz, and outputs 1 sample at the final rate of 11.025kHz. Three FIR filters are used to improve filter performance. The FIR filter structure uses the very efficient pipelined modes of the dsPIC and the repeat instruction for fast, no overhead looping. Oversampling at 16 times increases the effective ADC resolution to 14 bits for a maximum input S/N ratio of 84dB, and suppresses aliasing.


Oct 23: Unprocessed audio - Analog AGC only

 

DC blocking
Cancels DC offset using an integrator to follow the average input value. The integrator output is then subtracted from the audio signal to cancel the offset. Doesn't add roundoff noise, so is quieter than an IIR filter. Doesn't suffer from typical IIR overflow problems. Has less phase shift than an IIR filter. Has less rejection of low frequencies than an IIR filter.

Dynamic pre-emphasis
A highpass filter and a compressor are combined for dynamic pre-emphasis of the voice. This allows a high degree of treble boost without clipping distortion. The high frequencies are filtered, then compressed in a look-ahead compressor with a fast time constant. The compressed output is then summed with the original input after delaying it and phasing it to match. Different types of filtering are being evaluated here - including IIR highpass, bandpass, and simple differentiators. Placing this stage early in the processing chain improves the signal to noise ratio, by boosting high frequencies before any roundoff noise gets added by the following stages.

The first green bargraph LED shows pre-emphasis limiting action (LED 0).

Aug 27, 2014: Noisegate added. Adding a noise gate here improves the performance of the following multiband compressor noisegates.

Sep 20, 2014: Dynamic pre-emphasis filter changed to 1500 Hz IIR HPF, for improved EQ with current settings.

Nov 03, 2014: Dynamic pre-emphasis filter is currently a 1 kHz IIR HPF, for improved EQ with current settings.

Dec 31, 2015: Dynamic pre-emphasis has been increased by 6dB to allow more EQ when using flat microphones.

Multi-stage 32-bit error feedback IIR phase rotator
An allpass filter that spreads the relative phase of the input audio to make voice waveforms more symmetrical. Separates the treble and bass sounds in time by delaying the bass, allowing them both to be compressed more. Has a flat frequency response, but makes the bass sound louder. Reduces peak levels (and thus reduces distortion), and adds a characteristic sound. Can improve average SSB power as much as 3dB while simultaneously reducing processor distortion. The default phase rotator setting (LED 0: 100Hz, 20 stages) produces a smoother sound, and seems to make the Hilbert clipper distortion less obvious, improving perceived quality.

The phase rotation code has been pipelined to reduce CPU usage.

The 16-bit IIR phase rotator suffered from circulating roundoff noise that added spurious signals at around -40dB. Even though this noise was not readily audible, the phase rotator has now been upgraded to use 32-bit error feedback. The spurious products of the phase rotator are now down to around -84dB or better.

Nov 03, 2014: The Phase Rotator has been moved back before the Multiband Compressor, to improve waveform symmetry in all compressors. The Dynamic function has been removed. Currently, the benefits of placing the Phase Rotator before all the compressors seems greater than attempting to dynamically optimize the phase at a single stage of the processing.

Apr 24, 2014: The Phase Rotator number of stages is now selectable. Minimum is 1, maximum is 26, default is 20. This selection can peak the average SSB power on voice. The maximum number of stages is limited by total CPU usage. Selecting 26 stages runs the CPU load very close to 100%.

Sep 20, 2014: The Phase Rotator centre frequency adjustment is now a selection of preset frequencies: 100 Hz, 110 Hz, 140 Hz, 200 Hz, 400 Hz, 600 Hz. *These frequencies are approximate - the originally listed frequencies were in error by about a factor of two.

Sep 24, 2014: The Phase Rotator presets now also load a setting for an optimized number of stages for each frequency selection.

Multiband look-ahead compressor
A multiband compressor reduces the dynamic range of the audio with few compression artifacts, and flattens the spectrum power of the voice for more even clipping at all frequencies. Produces large amounts of bass, treble and midrange energy simultaneously. This improves quality, and allows a greater amount of clipping. The current version uses six bands, each one octave wide. Each band has a 13mS delay buffer. Now includes HF gain trimming for microphone flatness compensation (Select menu "_" Flatness adjust).

This multiband compressor is a composite of 24 IIR Butterworth filters, and 6 individual compressors.
 
The look-ahead structure used in all the compressors allows a slower attack time without signal clipping. This reduces distortion. The multiband compressors are essentially overshoot free. Short peaks are best removed by the Hilbert clipper stage, so the Output compressor doesn't attempt to be overshoot free, just low distortion.

The compressors measure the signal magnitude by simply taking the absolute value of the audio samples. The magnitude is converted to an inverse function by dividing it into a large number to produce a control signal. The control signal is then slew-limited for slower attack, smoothed for controlled release, and clipped to limit the maximum gain. This method has good performance and very predictable levels. A small RAM buffer delays the audio before the samples are multiplied by the control signal, which brings the output to a constant level (above threshold). This produces a compression ratio of infinity, and the forward acting structure ensures unconditional stability.

Placing the integration stage after the inverse divider stage has reduced compressor distortion, probably by improving the smoothness of the gain control signal.

The Multiband Compressor now uses the DSP accumulator to scale and sum each band output for fine control over individual band levels.
Input gains are adjusted for some pre-emphasis at low levels, and output levels are set for a reasonably flat response at high levels.

Oct 04, 2013: These IIR filters have now been pipelined and modularized for faster execution, and neater code. This has produced some benefits:

Both 16-bit and 32-bit-error-feedback filter modules have been written. The 32-bit version is essential for low frequency filters, to avoid very strong IIR roundoff noise products.

Oct 08, 2013: The compressor code has now been rewritten into modular form. A single macro instruction repeats the compressor and noisegate code in each of the six stages. This makes the code easier to understand and upgrade.

Oct 11, 2013: The Multiband Compressor code now includes "Delayed Recovery", to reduce control ripple while speeding up recovery time. This increases loudness, and reduces distortion. Delayed recovery works by setting the compressor recovery time constant to infinity whenever a signal increase is detected. After a delay (inversely proportional to the frequency), the decay time constant progressively speeds up to rapidly adapt to the new audio level.

Dec 30, 2013: The filters used in the Multiband Compressor were inititally placed both before and after each compressor stage. They have now all been moved in front of the compressors. This should improve compressor action (increasing loudness) and reduce some compressor distortion products, by reducing out-of-band energy at the compressor input.

May 08, 2014: Tests are being conducted to evaluate subjective audio quality using non-flat (spectral skewed) output from the multiband compressor. This may reduce bass response by between 1 and 6 dB, and increase treble.

Sep 20, 2014: The spectral skewing has been assisted by a following shelf filter. This can dramatically increase quality by reducing bass distortion in the clipper. Using a shelf filter reduces problems with filter leakage in the multiband compressor due to widely varying band output level settings required for EQ correction.

Oct 16, 2014: The spectral skewing is now assisted by a following -10 dB 300 Hz peak filter (notch). This increases quality by reducing bass distortion in the clipper at moderate clipping levels.

Sep 23, 2016: The Mode 4 spectral skewing has been removed. Mode 4 is now optimized for 3kHz bandwidth use. Band 1 level has been reduced 7dB to keep the voice fundamental at a similar level to the higher bands. Since band 1 has only a single voice frequency present, all the power is concentrated on one frequency - causing it to be out-of-proportion if adjusted for flatness on white noise (like Mode 5 is). Compressor gain on band 4 and band 5 has been reduced 6dB to improve voice quality in 3kHz bandwidth.

Sep 23, 2016: In Mode 5, band 4 and band 5 have had their compression gains reduced 3dB to improve voice quality.

Nov 02, 2016: Compressor timing modified to improve performance.

Nov 15, 2016: Microphone Flatness adjustment added, to trim the gains on band 5 and 6 to compensate non-flat microphones.

Per-band noise gate
Downward expands the compressor output below a preset threshold, to reduce background noise.

The noise gate also removes IIR filter noise, which is noticeable when the multiband compressor is active.
Currently the noise thresholds are preset in software. If possible, they will be made automatic.
The noise gating is limited to about 20dB. This helps prevent gating artifacts, and also helps the other station to hear when you are still transmitting.

Shaping filter
Modifies the response going into the output compressor to provide EQ or filtering. Implemented as a 2nd order biquad, allowing a variety of IIR filter types to be used. Shaping the spectrum going into the output compressor can increase quality by reducing unwanted distortion. Using a separate filter to perform this EQ avoids band leakage problems from excessive scaling of the multiband compressor outputs. The shaping filter is now only used in Mode 2.

Oct 16, 2014: This filter was a -10dB peak (notch) at 300 Hz. When combined with the multiband compressor output level EQ, this produces a dip in the voice energy around 300 Hz. This reduces some very obvious bass clipping distortion in the region 300 to 600 Hz, resulting in better sounding audio at moderate clipping levels. At high clipping levels, the results improve with a flat multiband output. This filter is only used in mode 2.

Feb 18, 2016: This filter is now a 500Hz highpass 3dB shelf filter. This produces less clipping under 500Hz to reduce bass distortion.

Sep 23, 2016: Shaping filter is now only used in Mode 2. It is now disabled in Mode 4. Mode 4 is now optimized for 3kHz bandwidth audio.

Hilbert Transform filter
The Hilbert Transform filter adds a 90 degree phase shift to the entire audio spectrum, generating a Q (Quadrature) channel, from the I (In-phase) input. This enables accurate measurement of audio levels and helps avoid aliasing distortion from non-linear processes causing beats between audio harmonics and the sample rate. As this doubles the workload of the following processes, it was placed here instead of earlier in the signal chain.

Look-ahead output compressor
Makes up for variations in level due to the multiband compressor outputs adding in random phases. Boosts loudness. Increases average power. Gives the impression of more bass. Provides a more constant drive level to the Hilbert clipping stage. Produces a very well controlled output level. Uses a 1.45mS look-ahead buffer. This compressor now has dual time constants to deal with fast peaks and slower average signal variations simultaneously ("Virtual clipping"). The gain control signal is now lowpass filtered to reduce audible distortion.

Limiting action is shown by lighting the last orange LED (LED 7).
Has a slower attack time than other compressors to improve loudness, and reduce compression artifacts.
Uses Look-ahead peak vector sum computation of the I and Q channels to compute the signal magnitude.
Includes Delayed/Adaptive Recovery to allow a faster recovery time while avoiding control ripple distortion.
Delayed recovery works by setting the compressor recovery time constant to infinity whenever a signal increase is detected. After a set time delay, the decay time constant starts to recover.
Adaptive recovery speeds up the compressor recovery until another peak is detected. This makes the compressors progressively speed up to adapt to the new audio level.
NEW "Peak stretching" added to level detector to improve control sensitivity to fast signal peaks.
NEW "Virtual clipping" added to improve peak-to-average ratio without creating excessive distortion. This adds a second fast time constant in parallel with the normal compressor time constant, to deal with fast peaks.
NEW Control signal lowpass filtering added to slow down gain changes and reduce distortion.
"Virtual clipping" is now disabled when Hilbert clipping is enabled.
"Virtual clipping" level is now adjustable via Select menu "c" (Global setting = affects all modes). Adjustable from 0 to 6dB. Level is boosted 6dB more on Mode 6 and 12dB more on Mode 7.

Oct 29, 2014: The Output Compressor now has a bypass mode in the Select menu. When active, it feeds the Multiband Clipper from the Multiband Compressor directly. This changes the loudness/distortion performance. Peak clipping level increases, but average clipping level decreases.

Aug 29, 2014: Fast RMS level detection has now been added. This is the same routine used in the Hilbert clippers. Removed, due to processing order changes.

May 22, 2015: A noise gate has been added to the Output Compressor, to improve noisegating performance further.

Nov 01, 2016: The compressor structure has been updated to use the vector sum of the I and Q channels to improve accuracy. This is important when Hilbert clipping is disabled, to still provide good SSB power control.

Nov 02, 2016: Compressor parameters modified to improve performance.

Nov 05, 2016: "Peak stretcher" added. "Virtual clipping" added. Control signal lowpass filtering and matching audio delay added. Latency reduced.

Nov 06, 2016: "Virtual clipping" is now disabled when Hilbert clipping is enabled. When Hilbert clipping is disabled, Virtual clipping level is boosted 6dB in Mode 6 and 7. Control signal lowpass filtering reduced to 500Hz for lower distortion.

Nov 15, 2016: "Virtual clipping" now boosted by 12dB in Mode 7.
 

EQ sidechain
Fixed lowpass EQ on the compressor level sensing input reduces compression on high frequency signals. This improves loudness, especially with large amounts of pre-emphasis. It also reduces level "pumping" or "flutter" of low frequencies by strongly emphasised high frequency voice components. Makes the high frequencies clip harder in the Hilbert Clipper. Only enabled when Hilbert clipping is enabled.

Nov 05, 2014: The EQ sidechain is now disabled if Hilbert Clipping is disabled, to prevent overshoots.

Oct 04, 2014: The EQ sidechain now includes a mix setting to increase compressor sensitivity to low frequencies when the shaping filter is active, reducing low frequency clipping for improved quality. This is only useful on modes 2 and 4, as they are the only modes using the shaping filter. Obsolete.

July 07, 2015: The EQ sidechain now uses a biquad shelf filter for more predictable response. Currently, it is a -3dB 600Hz high shelf. This causes frequencies above 600Hz to clip up to 3dB harder than frequencies below 600Hz. This appears to produce a cleaner processed sound.


Nov 15, 2016: Output compressor envelope (Hilbert clipping off, virtual clipping active, Mode 5) - Average power has been greatly increased.

Clipping is used after the compressors to increase the average power, while decreasing peak levels.
Larger amounts of clipping produce a louder signal, but increase distortion.
Three techniques are used to allow higher clipping levels, while keeping distortion lower:

Multiband Peak-hold/Zero-crossing Hilbert Transform Clipper/Limiter
A Hilbert Clipper limits signal amplitude by clipping peaks from the audio waveform. Increases average power by reducing the peak to average ratio. Functionally equivalent to an SSB RF clipper, but operating at baseband frequencies. Produces intermod distortion, but almost no harmonic distortion. This is visible looking at the scope captures that show the audio envelope being clipped, but the waveform remaining rounded. This is very important when feeding an SSB transmitter, as it avoids generating squared edges on the audio waveform that can cause the SSB envelope to have larger peaks. Computes a gain control signal from the vector sum of the I & Q channels. Ideally, this produces a gain control signal with no ripple for a sinewave.

The vector sum calculation is the same math technique used for finding the perimeter of a circle from a central point. The I & Q channels describe a sinewave as a rotating vector. The Hilbert Clipper works to limit the radius of the vector which equates to the signal amplitude. All real signals can be represented as a combination of sinewaves, so the process works for all waveforms.

The vector sum computation is a fast approximation that produces better than -30 dB average error. Suppresses harmonic generation better than 30 dB at high frequencies. At low frequencies, harmonic distortion is reduced further by using peak-hold and zero-crossing reset techniques.

Version 1 of the DSP Speech Processor used a fast audio compressor that had its level control synchronized to the waveform zero crossings. This allowed it to maximize the waveform half-cycles while keeping harmonic distortion levels low. A similar approach is applied to the Hilbert Clippers to reduce harmonic distortion from imperfect Hilbert Transforms and vector sum computations. A peak-hold routine is added to the magnitude estimation (vector sum) output. The peak-hold value is reset to the current magnitude output value at each zero crossing.

Oct 14, 2013: The Hilbert Clippers have now been modified to use peak-hold and zero-crossing reset. This reduces low frequency harmonic distortion by an additional 20 dB or more, without significantly compromising limiting effectiveness. This creates a limiter with zero attack and recovery time, and low harmonic distortion and aliasing. Produces higher average power levels on SSB.

A Multiband Hilbert Clipper clips the audio in two separate frequency ranges. The clipper outputs are combined by a matrixing process. This restricts the bandwidth of each clipper to reduce distortion, and simultaneously allows both bands to reach nearly full output. Methods to further reduce distortion are being investigated.

Allows higher clipping levels while maintaining good quality. Audio sounds strong and clear.
Appears to have good peak control.

Sep 23, 2016: The Multiband Hilbert clipper now uses a fixed crossover frequency of 2kHz in all modes and bandwidths.


Nov 15, 2014: Output envelope - Mode 5. Updated. "The".


Nov 15, 2014: Output waveform - Mode 5. Updated. "E".


Oct 23: Output waveform - Mode 7 (Narrow DX).

Output filtering and transceiver EQ
Cleans up some high frequency IMD from the Hilbert Clipper, and provides high & low frequency boost to help compensate for transceiver filtering. Running an outboard speech processor is always a compromise, as the accurately controlled output level then goes through the transceiver filtering, altering the frequency and phase response of the nicely limited audio. The output EQ tries to compensate for the bandpass effect of the transceiver audio and RF filtering. Eventually it will be made adjustable. This digital process is assisted by the hardware EQ that adds a fixed amount of boost at low frequencies. This helps improve the dynamic range of the DAC, and helps avoid low frequency digital clipping.

Oct 06: The two IIR filters used for EQ have both been upgraded to the new pipelined IIR code. The bass EQ filter uses the 32-bit version for lower noise.

Oct 29: A separate EQ mode has been added for AM use. It is switchable via the Select menu. At this time it is not adjustable. OBSOLETE.

May 06: Output EQ modes expanded. Choices are Disabled, SSB1, SSB2, AM. Disabled has higher output level, as it needs no headroom. This selection will be expanded further.

Output gain compensation
This switches audio levels to compensate for different filter gains and processing levels, to maintain constant peak output.

DDS test tones
Test tones are useful for testing levels and distortion performance.

At this stage, levels are only approximately set to -6 dBFS unless noted otherwise.

An assortment of tones are available + white noise:
Single tone sinewave: For testing CW power on SSB.
2-tone sinewave: For measuring IMD with a spectrum analyzer. Changed to 2 kHz separation 21/07/2014.
Triangle modulated sinewave: For checking transmitter linearity with a scope. Distortion is far more visually obvious on this than on a 2-tone waveform.
Swept tone flatness test: For checking output EQ matching to transceiver. Level is about 6dB below limiter output.
Pulsed sinewave tonebursts: For testing transmitter tuning without overheating. 5 cycle bursts of 1 kHz sinewaves, 5 mS long, 50 mS apart. 10% duty cycle.
Impulse response test signal: Single sample impulses, used for testing transceiver amplitude and phase response.
White noise: For testing frequency response using a spectrum analyzer.
* All of these test tones are sent through the DSP digital EQ (if enabled) and the analog EQ stages, to compensate for transceiver filtering.

Self-test mode
Uses the DDS and white noise routines to generate stepped sequences of tones and noise. Feeds the tones and noise into the processor input, for evaluating processing performance. Generates seven frequencies that are carefully chosen to minimize DDS spurs. Roughly: 86, 172, 344, 689, 1378, 2756 and 4136 Hz. Steps down through four levels in 10 dB steps, 1 second each for tone : 5 seconds each for white noise. Includes settings to freeze the current tone or noise output.

DDS distortion and spurs were initially higher than expected at -69 dBFS (3rd Harmonic of 86Hz), but this has now been improved to -82 dBFS by using a quadrature combining technique [16/08/2014]. The improved test signals make distortion measurements more accurate, because the processor's pre-emphasis and multiband compression amplify harmonics and spurii. The sinewave source may eventually be updated to an even lower distortion version, such as a DSP phase-shift oscillator.

* Self-test mode is designed for testing the DSP compressors and clippers, not as a general purpose audio generator.

Roger Beep (future option)
A Roger Beep produces a short tone to indicate end-of-transmission. When enabled, the PTT line is kept on for a short time after manual PTT release, and an audio tone is sent to the transceiver. Single tone, multi-tone or modulated tone outputs are possible. Morse code is also possible, such as the letter "K" -.- indicating "invitation to transmit". The delay is typically about 250 mS to 1 S.

S/PDIF over TOSLINK (optical digital audio output)
The S/PDIF output is sent using the dsPIC DCI (Data Converter Interface) 16-bit shift register. The shift register is clocked by the divided down CPU clock to produce the correct frequency S/PDIF bit clock. This requires a CPU clock other than the standard 40 MHz. The bit clock is now provided via Timer3 OC3, transferred to the DCI via pin 11 (RP4). This allows a wide choice of divide ratios. The DCI interface is run in DMA mode, to reduce CPU usage.

The audio is encoded and formatted into BMC (Biphase Mark Coding) using a 256 entry lookup table. This is very fast. BMC encoding generates two bits out for each bit in. A 16 bit word becomes 32 bits long after coding.
The S/PDIF preambles (sync headers), channel status bits, and parity bits are added, and the data is written directly into the DMA buffer in "ping-pong" mode. This method saves over 3% CPU time compared to the previous double buffering scheme.

No antialiasing is performed on the upsampled data, to reduce CPU load.

If recorded at the original sample rate of 11.025 kHz, the alias frequencies are automatically removed. Alternatively, the audio can be recorded at 44.1 kHz, and resampled without filtering to 11.025 kHz, as there is no content above 5.5 kHz to cause aliasing. The TOSLINK output now features EQ to improve the sound quality, so it no longer has accurate peak control.

An interesting observation about the S/PDIF format is that the even parity and BMC coding always results in the last BMC parity bit being a logic 0. This means the signal polarity never changes, as can be observed on an oscilloscope. This also means the parity doesn't need to be calculated. Instead, the first BMC parity bit can just be made to compliment the preceding BMC bit! This further speeds up encoding.

The S/PDIF output is proving invaluable for testing audio processing performance.

June 25, 2015: Main CPU clock speed has been dropped back slightly to decrease S/PDIF clock speed to fix an audio glitching problem when feeding a C-Media USB sound device. These glitches occurred despite the S/PDIF clock being within 1% of the correct value.

July 06, 2015: The S/PDIF monitor output and headphone output now have lowpass shelf filtering added to improve sound quality. Currently the filtering consists of a 500Hz -4dB high shelf, followed by a second order 4.5kHz lowpass filter.

November 15, 2016: The S/PDIF monitor and headphone output lowpass shelf filter has been disabled, to make audio testing easier during firmware development.

PTT state filtering and click suppression (level ramping) (added 11/06/2015)
The DSP Accumulator is used as an integrator to count up if the PTT is activated, and down if it is not activated. The Accumulator saturation function limits the values and prevents overflow. When the accumulated value is positive the unit switches to transmit mode. When the value is negative the unit switches to receive mode. The value is also used as a multiplier to fade the transmit and receive audio. This neatly filters the PTT action, and provides click suppression at the same time producing very smooth switching. The fade period is about 23mS.

Transmit timer and Watchdog timer (future options)
Since the PTT line is controlled by the CPU, a transmit mode timeout is a wise option. A software timer keeps track of how long the unit has been in transmit mode. If no audio is present, the timer counts faster.
After a set time, the PTT output is temporarily disabled to shut off the transmitter. Releasing the PTT switch resets the timer.

In over two years of operation, the functional software has never locked up in transmit mode, despite some serious bugs.

A watchdog timer keeps track of whether the CPU is executing code. If the CPU locks up for any reason, the watchdog timer times out, and the CPU is reset. The CPU then starts again normally. This is a safeguard against malfunction due to ESD, intense RF interference or power supply glitches that could cause CPU errors.
 

Receive Mode

Input overload is indicated by lighting the red LED (LED 8 - the last one). This means the radio volume level is too high, and should be reduced.

FIR oversampling filters (as above)

DC blocking (as above) [Replaces IIR highpass filter - DC blocking has superior overload performance during impulse noise.]

Receive EQ
Typical old style SSB radios have a steep drop in audio response below about 400 Hz in SSB mode, due to the crystal IF filter response. This can be corrected to some degree by low frequency boost. The required amount of boost is very high - over 16 dB. On AM or FM mode this boost must be disabled, or greatly reduced.

Nov 08, 2014: Low frequency EQ boost significantly flattens the receive frequency response on a typical transceiver. This improves the perceived quality of received audio, and allows much better readability at lower volume settings with typical household ambient noise levels.

Nov 08, 2014: This IIR biquad filter can be programmed with a variety of response curves. Currently, it is a 120 Hz peak filter with a Q of 1.2 and a gain of 20 dB.

Noise Limiter (future option)
A Hilbert Clipper could be placed here to act as a noise limiter. Since a Hilbert Clipper produces minimal harmonic distortion, it will sound better than a traditional audio noise limiter (more like an IF clipper).
Will help protect the Rx AGC (Volume Limiter) from impulse noise. Any distortion produced by this stage will be reduced by the LMS Denoiser, when active. Clipping will be indicated by lighting one of the front panel LEDs.

Phase Rotator (future option)
It may be worth adding a Phase Rotator after the Noise Limiter, to disperse noise pulses after limiting to lower their peak level.

LMS Denoiser
Based on an "Adaptive predictor", this filter reduces random noise on the signal by adapting to pass the frequencies in the signal with the greatest power. LMS stands for "Least Mean Squares", which is the adaption method used. It has three adjustments: delay, beta (error gain) and leak (coefficient decay). The standard LMS design is modified by controlling the beta value and audio input level in an AGC loop, to reduce clipping caused by excessive enhancement.

This AGC action is indicated by lighting the first orange LED (LED 6).

The output is taken from y(n).

Rx AGC (Volume limiter)
A low gain audio compressor with adaptable recovery time, allows weak signals to be heard more easily and prevents blasting on strong signals. Using "Delayed Recovery" provides rapid recovery from audio peaks and noise impulses, while keeping distortion levels low.

This AGC action is indicated by lighting the last orange LED (LED 7).
 

Configuration saving
To avoid the need for resetting levels each time the processor is powered up, the settings can now be saved into Flash memory.

On startup, the Flash memory is scanned for the start of the data block. The start is marked by the number 12345. The starting address is then saved in RAM for later access, and the data is read into RAM. During save operations, a simple wear levelling scheme adds an offset to the starting address, incrementing the page of Flash that the settings are saved to each time. After the new page is written, the old page is erased. Bounds checking sets the page back to the start of free Flash when the last block is reached. At this stage no verify is done, but this may be added later.

The dsPIC33FJ64GP802 has a specified endurance of more than 10,000 erase/write cycles. Together with the wear levelling that spreads the writes over about 30 Flash memory pages, this should allow more than 300,000 saves before device failure.

The DSPIC33FJ128GP802 can be used instead, and has twice the FLASH memory. This would extend the FLASH endurance, and allow more complex firmware to be loaded for future updates.
 

Currently, these settings are saved:

Global settings: (always saved regardless of mode)
Receive EQ (bass boost).
Utility mode (narrowband settings).
Input level.
Output Level.
Phase Rotator settings.
Microphone Flatness setting.
Output compressor on/off.
Hilbert clipper on/off.
Output EQ setting.
Default startup mode.
Virtual clipping level.

Settings saved individually for each mode:
Input EQ setting (pre-emphasis).
Multiband gain settings. Currently there is no way to adjust this setting.
Multiband level settings. Currently there is no way to adjust this setting.
Output compressor gain setting.
Hilbert clipper drive level.

During firmware updates, all settings will revert back to the defaults.
 



Current Software Problems: Software development is proceeding quickly, the problems listed above should not be hard to fix.

Current Hardware Problems and fixes:

Many of the hardware problems listed above have simple remedies. They will be dealt with as time permits.

ToDo List:

New Ideas: Things that DIDN'T work: Things that DID work:


Adjustments

grey = Not written yet.
green = Already implemented.

HARDWARE
Tx output level (R43/R45).
Rx input level (R25/R26). These resistor values also affect receive input common-mode rejection.
Tx analog EQ freq (C31).
Tx analog EQ shelving (R30).

SOFTWARE
LED dimming function bright/dim/dynamic - Manual bright/dim working 23/06/2013.
Save user settings to Flash memory.
Load user settings from Flash memory.
Reset default user settings.

Transmit
Eight audio processing levels 0-7. (Bypass, Singleband, Multiband Minimal... through Narrow DX.)
Analog AGC hang time.
Analog AGC freeze threshold.
HF boost EQ on/off/slope adjustment. - Slope adjustment added 20/06/2013. - Now only used on modes 1 & 2. OBSOLETE.
Dynamic pre-emphasis EQ adjustment. - Added 10/07/2013.
Phase Rotator on/off. - Added 24/08/2013.
Phase Rotator centre frequency adjustment. - Presets added 20/09/2014..
Multiband compressor on/off. - Off in modes 0, 1 and 2. On in modes 3, 4, 5, 6, 7.
Compression gain adjustment. Adjusts gain on the multiband or output compressors on modes 1 through 7. Added 02/05/2014..
Six bands of multiband compressor EQ gain adjustment. - Implemented via mode presets.
Microphone Flatness setting - scales gain on Bands 5 and 6.
Six bands of multiband compressor recovery time adjustment. - No longer required since Delayed Recovery has been implemented.
Six bands of noise gating threshold adjustment. Will be made automatic if possible.
Six bands of noise gating recovery time adjustment.
Output compressor on/off. Added 29/10/2013.
Output compressor gain (post-multiband compression). - Implemented via modes, and Input level adjust setting.
Output compressor recovery time adjustment. - No longer required since Delayed Recovery has been implemented.
Hilbert clipper on/off. Added 07/07/2013. Works on modes 1 to 5.
Hilbert clipping level. 1 = HF - Added 24/09/2013.
Hilbert clipping level. 2 = LF - Added 24/09/2013. [Disabled] LF clip level is a fixed amount above HF clip level for best results.
Tx digital EQ bypass. Added 21/03/2014.
Tx digital EQ mode setting. Added 21/03/2014.
Tx digital EQ LF peak frequency.
Tx digital EQ LF gain.
Tx digital EQ HF peak frequency.
Tx digital EQ HF gain.
Tx output level - Added 19/06/2013.
Tx headphone monitor on/off.
Alignment tones: Single tone, 2-tone, triangle modulated sinewave, pulsed sinewave and swept sinewave for linearity, EQ and level tests + psudo white noise.
Debug mode - allows testing of each processing stage to evaluate audio quality and identify problems.

Receive
Noise Reduction on/off.  (LMS adaptive filter.) Added 21/06/2013.
Noise Reduction "delay". Added 21/06/2013.
Noise Reduction "beta". (Adaptation gain.) Added 21/06/2013.
Noise Reduction "leak". (Decay factor.) Added 21/06/2013.
Audio AGC on/off. (Volume limiter.)
Receive audio level. (Volume.) - This will also affect the analog Tape/Headphone output level. (TOSLINK S/PDIF digital output is unaffected.)

DISPLAY Information
7-segment display. - Current processing mode 0-7, plus tones: 8, 9, A, b, c, + white noise: d.
7-segment display. - Menu state/options (Alphanumeric codes and graphics).
Modes are shown below.
Decimal point. - Keypress indicator.
LED multistage limiter display.
LED audio level/adjustment level bargraph.
Red LED Hilbert clipping indicator (Tx).
Red LED Input overload indicator (Rx) Added 16/06/2013. For consistency, this will be moved to the Tx/Rx indicator.
Green/Red power LED Rx/Tx indicator + Analog AGC limiting indicator (Yellow).


Controlling the processor

Display and Buttons:

Rx/Tx LED:
Green = Receive.
Red = Transmit.
Yellow = Input AGC active.

LED Bargraph:
LED 0 = Pre-emphasis Limiter.
LED 1 = Band 1.
LED 2 = Band 2.
LED 3 = Band 3.
LED 4 = Band 4.
LED 5 = Band 5.
LED 6 = Band 6.
LED 7 = Output Compressor.
LED 8 = Hilbert Clipper.

KEYPAD FUNCTIONS: (left to right)
Button 1 = Normal mode. (Resets functions to default starting positions, also resets analog input AGC to maximum gain.)
Button 2 = Select - Tx default is 0 (mode number), Rx default is 1 (volume). This is for convenience. Debug overrides both.
Button 3 = "-" minus Decrements selected setting.
Button 4 = "+" plus Increments selected setting.
 

Select Menu - For new 2019 Weaver firmware:

SELECT Button: incremental Note: Not all Select menu option adjustments have user feedback via the LED display yet.
0 = [mode number] Normal: Tx default, auto selected on Tx by default : modes 0 to 7 + test tones & white noise 8, 9, A, b, c, d.
1 = [r] Rx volume: Rx default, auto selected on Rx by default.
2 = [r] Rx volume + speaker muting: This selection "sticks" on in Rx, overriding selection 1, until manually deselected in Rx mode (muting is denoted by an overscore).
3 = [o] Output level adjust: Adjusts transmit output level. : + key increases output, - key reduces output. LEDs show level.
4 = [i] Input level adjust (compression gain setting) : + key increases, - key reduces. Works on modes 1 to 7. Added 02/05/2014. LEDs show level.
5 = ["] Noise Gate on/off: + key = on, - key = off.
6 = [E] Voice EQ & Dynamic pre-emphasis adjust: Adjusts maximum transmit input pre-emphasis boost. : + key increases, - key decreases (also does EQ for modes 1 & 2) Changing modes resets this.
7 = [_] Flatness adjust: Scales gain on Band 5 and 6 to compensate microphones. -6dB to +3.5dB range. Default 0dB. Only works in Modes 3 to 7. NEW Added 15/11/2016.
8 = [b] Rx Bass boost EQ: + key = on, - key = off. +20dB @ 120Hz. Off by default. 30/10/2014.
9 = [n] NR on/off toggle: Enables/disables Rx mode noise reduction LMS adaptive filter.
10 = [d] NR delay: Adjusts adaptive filter "delay" : + key increases, - key decreases. Updated 04/07/2015.
11= [G] NR Gain: Adjusts adaptive filter "beta" : + key increases, - key decreases.
12= [L] NR Leak: Adjusts adaptive filter "leak" : + key increases, - key decreases.
13= [=] NR EQ: Adjusts EQ slope into NR filter to help flatten response and avoid low frequency clipping.
14= [8] "Lamp test" + Bright/Dim setting: + key = Bright, - key = Dim. Updated 04/07/2015.
15= [P] Phase rotator: 0:off 1:on :  LED bargraph shows number + key = On, - key = Off : Added 24/08/2013.
16= [n] Phase Rotator Number of stages: + key = more, - key = less : Minimum 1, maximum 26, default 20 : Added 21/04/2014.
17= [F] Phase rotator Frequency (tuning select): + key = higher N, - key = lower N : Added 24/08/2013. Updated 20/09/2014. UPDATED. 18= [=] Output EQ mode : Set output EQ to suit transceiver : Default = SSB2 : Added 21/03/2014. Updated 06/05/2014. Needs more work to optimize levels and EQ. 19= [/] Output compressor on/off: 0=off, 1=on : Sticks on until manually set off, or power off : Added 29/10/2013.
20= [c] Output compressor gain setting: + key = increases, - key = decreases : Added 04/10/2014.
*** "Virtual clipping" is not available in the Weaver firmware.
21= [U] Change narrow Utility setting for all modes :  + key = increases, - key = decreases : Added 12/10/2013, updated 11/12/2013. *** Hilbert Clipper cannot be disabled in this new Weaver firmware ***
22= [h] Hilbert Clipper drive: Added 15/07/2013 - Clipper gain, modes 1 to 7. This setting is kept until a mode change or power off.
23= [t] Selftest modes: 0:off, 1:tone steps, 2:tone continuous, 3:noise steps, 4:noise continuous. LED bargraph shows number. Sticks on until manually set off, or power off.
Self-test tone mode: Generate four 10dB amplitude steps of 1 second sinewave tones into processor input. For distortion and compression tests.
Self-test noise mode: Generate four 10dB amplitude steps of white noise @ 5 seconds each, into processor input. For frequency response tests.
24= [u] Startup mode number. Select default starting mode 0-7. Added 14/02/2016.
25= ["] Analog input AGC Gain Freeze: + key = Enable, - key = Disable. Added 26/11/2017
26= [H] Headphone monitor on/off: NEW Added 30/03/2019.
27= [J] For development test purposes only: Filter compensation on/off - Not available in DSP release..
28= [A] For development test purposes only: Parameter adjust.
29= [b] For development test purposes only: Parameter adjust.
30= [C] For development test purposes only: Clipping mode tests.
31= [d] Debug mode: Steps through audio outputs of each processing stage. This selection "sticks" on, overriding the Rx/Tx defaults, until manually deselected. See below.
 

Select Menu - Old Firmware:

SELECT Button: incremental Note: Not all Select menu option adjustments have user feedback via the LED display yet.
0 = [mode number] Normal: Tx default, auto selected on Tx by default : modes 0 to 7 + test tones & white noise 8, 9, A, b, c, d.
1 = [r] Rx volume: Rx default, auto selected on Rx by default.
2 = [r] Rx volume + speaker muting: This selection "sticks" on in Rx, overriding selection 1, until manually deselected in Rx mode (muting is denoted by an overscore).
3 = [o] Output level adjust: Adjusts transmit output level. : + key increases output, - key reduces output. LEDs show level.
4 = [i] Input level adjust (compression gain setting) : + key increases, - key reduces. Works on modes 1 to 7. Added 02/05/2014. LEDs show level.
5 = ["] Noise Gate on/off: + key = on, - key = off.
6 = [E] Voice EQ & Dynamic pre-emphasis adjust: Adjusts maximum transmit input pre-emphasis boost. : + key increases, - key decreases (also does EQ for modes 1 & 2) Changing modes resets this.
7 = [_] Flatness adjust: Scales gain on Band 5 and 6 to compensate microphones. -6dB to +3.5dB range. Default 0dB. Only works in Modes 3 to 7. NEW Added 15/11/2016.
8 = [b] Rx Bass boost EQ: + key = on, - key = off. +20dB @ 120Hz. Off by default. 30/10/2014.
9 = [n] NR on/off toggle: Enables/disables Rx mode noise reduction LMS adaptive filter.
10 = [d] NR delay: Adjusts adaptive filter "delay" : + key increases, - key decreases. Updated 04/07/2015.
11= [G] NR Gain: Adjusts adaptive filter "beta" : + key increases, - key decreases.
12= [L] NR Leak: Adjusts adaptive filter "leak" : + key increases, - key decreases.
13= [=] NR EQ: Adjusts EQ slope into NR filter to help flatten response and avoid low frequency clipping.
14= [8] "Lamp test" + Bright/Dim setting: + key = Bright, - key = Dim. Updated 04/07/2015.
15= [P] Phase rotator: 0:off 1:on :  LED bargraph shows number + key = On, - key = Off : Added 24/08/2013.
16= [n] Phase Rotator Number of stages: + key = more, - key = less : Minimum 1, maximum 26, default 20 : Added 21/04/2014.
17= [F] Phase rotator Frequency (tuning select): + key = higher N, - key = lower N : Added 24/08/2013. Updated 20/09/2014. UPDATED. 18= [=] Output EQ mode : Set output EQ to suit transceiver : Default = SSB2 : Added 21/03/2014. Updated 06/05/2014. Needs more work to optimize levels and EQ. 19= [/] Output compressor on/off: 0=off, 1=on : Sticks on until manually set off, or power off : Added 29/10/2013.
20= [c] Output compressor gain setting: + key = increases, - key = decreases : Added 04/10/2014.
21= [c] Output compressor "Virtual clipping": + key = increases, - key = decreases, LEDs show level : NEW Added 06/11/2016.
22= [U] Change narrow Utility setting for all modes :  + key = increases, - key = decreases : Added 12/10/2013, updated 11/12/2013. 23= [H] Hilbert Clipper on/off: Added 07/07/2013 Works on modes 1 to 5.
24= [h] Hilbert Clipper drive: Added 15/07/2013 - Clipper gain, modes 1 to 7. This setting is kept until a mode change or power off.
25= []] Hilbert Clipper2 drive: Added 24/09/2013 - Clipper 2 = LF clipping only, modes 1 to 7 [Disabled] LF clip level is now set a fixed amount above HF clip level, for best results.
26= [t] Selftest modes: 0:off, 1:tone steps, 2:tone continuous, 3:noise steps, 4:noise continuous. LED bargraph shows number. Sticks on until manually set off, or power off.
Self-test tone mode: Generate four 10dB amplitude steps of 1 second sinewave tones into processor input. For distortion and compression tests.
Self-test noise mode: Generate four 10dB amplitude steps of white noise @ 5 seconds each, into processor input. For frequency response tests.
27= [u] Startup mode number. Select default starting mode 0-7. Added 14/02/2016.
28= ["] Analog input AGC Gain Freeze: + key = Enable, - key = Disable. Added 26/11/2017
29= [J] For development test purposes only: Parameter adjust : Post Compressor EQ - Reduce LF level : + key increases, - key decreases : [Not installed yet.]
30= [A] For development test purposes only: Parameter adjust.
31= [b] For development test purposes only: Parameter adjust.
32= [C] For development test purposes only: Clipping mode tests.
33= [d] Debug mode: Steps through audio outputs of each processing stage. This selection "sticks" on, overriding the Rx/Tx defaults, until manually deselected. See below.
Further selections are being added to support more levels, EQ and feature settings.
 

Processing Modes: (Tx processing level)

Bypass - Outputs to the DAC from the last oversampling filter - Has only analog AGC.
Singleband - Disables the multiband compressor, enables everything else.
Multiband - Uses the multiband compressor plus all other features.
Flat EQ - Pre-emphasis set to zero. Not suitable for direct microphone input. Requires external EQ.
Voice EQ - Pre-emphasis set to a high value, suitable for direct microphone input.

*UPDATED 25/11/2016*
0 = Bypass - Unprocessed. Analog AGC only. Preserves input quality. Analog output EQ still on. For testing or feeding from external input for replays etc.
1 = Singleband, flat EQ. Multiband off, everything else on. No noise gating. Maintains spectral balance of input. For equalized inputs only, or manual EQ adjustment. Not suitable for normal microphone input.
2 = Singleband, voice EQ. Multiband off, everything else on. Maintains spectral balance of input, apart from Dynamic Pre-emphasis and shaping filter.
3 = Multiband, flat EQ. Good quality, no pre-emphasis. For equalized inputs only, or manual EQ adjustment. Not suitable for normal microphone input.
4= Multiband, voice EQ. Tuned for better flatness on voice. Mode 4 is now optimized for 3kHz bandwidth use. UPDATED 23/09/2016.
5 = Multiband, voice EQ. Tuned for better flatness on white noise. Slightly more bass on voice. Good loudness at increased clipping levels. Default mode.
6 = Multiband, voice EQ. DX mode. 3dB more Hilbert clipping. Still sounds OK but with some minor distortion. Loud. UPDATED 21/10/2016.
7 = Multiband 3kHz, voice EQ. Heavy DX mode. 6dB more Hilbert clipping, max bandwidth 60 Hz-3 kHz. Higher average power than modes 4, 5 and 6. Very loud with good DX quality, but high distortion.
8 = Single tone DDS sinewave - 800Hz. Peak level is -6.17 dBFS on S/PDIF date: 29/04/2014.
9 = Two-tone sinewave SSB IMD test - 1628.95Hz & 2628.56Hz. Peak level is -6.88 dBFS on S/PDIF date: 29/04/2014. Frequencies updated 03/07/2014.
A = Triangle modulated sinewave linearity test - ~2628.56Hz, with ~43Hz triangle. Peak level is -7.34 dBFS on S/PDIF date: 29/04/2014.
b = Swept frequency DDS sinewave flatness test. Added 06/05/2014. Peak Level is around -12dBFS 10/01/2016.
c = Pulsed sinewave tonebursts - 5mS long, 50mS spacing, 10% duty. Added 18/05/2014. Peak level is around -6dBFS.
d = Impulse response test signal. Added 25/11/2016. NEW. This test signal allows a transceiver frequency and phase response to be tested.
E = White noise Added 01/07/2013. Peak level is about -4.35 dBFS on S/PDIF date: 29/04/2014.

Modes 6 and 7 are DX modes that have higher distortion than other modes. Due to improvements in processing, the lower modes are only about 1dB quieter than the DX modes, but have much higher quality.

Customized Processing.
Many of the processing stages can be disabled, to customize the processing as required (although this is not recommended).

Examples:
Single band compression and pre-emphasis only: Mode 2 selected, Hilbert clipper disabled.
Multiband compression and pre-emphasis only: Mode 4 selected, output compressor disabled, Hilbert clipper disabled.
High quality, minimal processing: Mode 2 selected, output compressor disabled, Hilbert clipper disabled. (No peak control.)
High quality, minimal processing but louder: Mode 2 selected, output compressor enabled, Hilbert clipper disabled. (Good peak control using latest firmware.)
High quality, minimal processing but louder still: Mode 5 selected, output compressor enabled, Hilbert clipper disabled. (Good peak control using latest firmware.)

Controllable stages:
Input EQ (dynamic pre-emphasis) adjustable (Adds brightness and clarity to audio.)
Phase rotator on/off (Increases loudness by reducing peaks. Adds no harmonic or IM distortion.)
Multiband compressor off = Mode 1 or 2, on = Mode 3 to 7 (Increases loudness and clarity of audio. Adds no significant distortion, or artifacts.)
Output compressor on/off (Keeps the clipper drive level more constant. Adds punch.) (On newest firmware, has excellent peak control when Hilbert clipper is off.)
Hilbert clipper on/off (Increases loudness by removing unwanted peaks from the audio. Only adds IM distortion.)
Output EQ off/choose (Helps to flatten the transceiver's transmit filtering response.)
 


Save Settings (Programming Mode)

Added 29/07/2015. Limitations as of November 25, 2016.
All modes share the same Global settings. Updating any mode will update the Global settings.
Mode 0 is always bypass mode, and can't be changed. Saving to Mode 0 only updates the Global settings for all modes.
Mode 1 and 2 are always single band compression.
Mode 2 always uses the shaping filter (HP shelf). This may change at a later time.
Mode 7 is always 3kHz bandwidth on transmit and receive.
User modes 8 and 9 will be added later, and the test tones will be moved to a, b, c, d, E, F and G.
During firmware updates, all settings will revert back to the defaults.

Currently, these settings are saved:

Global settings: (always saved regardless of mode)
Receive EQ (bass boost).
Utility mode (narrowband settings).
Input level.
Output level.
Phase Rotator settings.
Microphone Flatness setting. NEW
Output compressor on/off.
Hilbert clipper on/off.
Output EQ setting.
Default startup mode.
Virtual clipping level. NEW

Settings saved individually for each mode:
Input EQ setting (pre-emphasis).
Multiband gain settings. Currently there is no way to adjust this setting.
Multiband level settings. Currently there is no way to adjust this setting.
Output compressor gain setting.
Hilbert clipper drive level.


Debugging and test modes

Debug Mode levels. For processor tests and diagnosis only.
Bargraph LEDs = TENS.
7-Segment display = UNITS.

Updated 25/11/2016.

0  = Normal processor output.
1  = 1st FIR antialias filter output.
2  = 2nd stage FIR antialias filter output.
3  = 3rd stage FIR antialias filter output.
4  = DC blocker output.
5  = Dynamic pre-emphasis output.
6  = Phase Rotator output.

* Most of the filter monitoring points have been deleted to save CPU time - they no longer function.
7  = Band 1 filter 1 HPF output.
8  = Band 1 filter 2 LPF output.
9  = Band 1 filter 3 HPF2 output.
10 = Band 1 filter 4 LPF2 output.
11 = Band 1 compressor output.

12 = Band 2 filter 1 HPF output.
13 = Band 2 filter 2 LPF output.
14 = Band 2 filter 3 HPF2 output.
15 = Band 2 filter 4 LPF2 output.
16 = Band 2 compressor output.

17 = Band 3 filter 1 HPF output.
18 = Band 3 filter 2 LPF output.
19 = Band 3 filter 3 HPF2 output.
20 = Band 3 filter 4 LPF2 output.
21 = Band 3 compressor output.

22 = Band 4 filter 1 HPF output.
23 = Band 4 filter 2 LPF output.
24 = Band 4 filter 3 HPF2 output.
25 = Band 4 filter 4 LPF2 output.
26 = Band 4 compressor output.

27 = Band 5 filter 1 HPF output.
28 = Band 5 filter 2 LPF output.
29 = Band 5 filter 3 HPF2 output.
30 = Band 5 filter 4 LPF2 output.
31 = Band 5 compressor output.

32 = Band 6 filter 1 HPF output.
33 = Band 6 filter 2 LPF output.
34 = Band 6 filter 3 HPF2 output.
35 = Band 6 filter 4 LPF2 output.
36 = Band 6 compressor output.

37 = Multiband summing output.
38 = spare.
39 = Stereo I & Q Hilbert transform test on S/PDIF.
40 = Hilbert transform output I.
41 = Hilbert transform output Q.
42 = Stereo I & Q output compressor test on S/PDIF.
43 = Output compressor output I.
44 = Output compressor output Q.
45 = Stereo I & Q Hilbert clipper 1 test on S/PDIF.
46 = Hilbert clipper 1 output I.
47 = Hilbert clipper 1 output Q.
48 = Stereo I & Q Hilbert clipper 2 test on S/PDIF.
** More levels are needed here to test multiband clipper functions. Yet to be added.


Schematics


Latest analog schematic (Part 1) for DSP speech processor v2.1 for dsPIC - Mike amp and Speaker amp.
The amplifier circuits are mounted on the main PCB, but shown here for clarity and space reasons.
 

Updates & Notes



dsPIC DSP Speech Processor CPU schematic NEW VERSION (Part 2). Click image for high resolution version.
UPDATED: Revisions 5.7 onward use a PNP inverter stage to fix a PTT related problem.
UPDATED: In revision 5.9 onward all components have been renumbered to avoid duplicate numbering in other schematics.

Updates & Notes



dsPIC DSP Speech Processor LED Display Boards schematic (Part 3).

LED Display boards 1 & 2 - Some values may need adjustment to improve LED brightness matching.
Bypass capacitor values are not critical. Only two bypass capacitors were fitted to the prototype.

Caution: Since common-anode LEDs are used, (except for D100) any LED shorts to ground will cause LED failure. The latest Display PCB 2 has a small link that can be cut to insert a safety resistor in the 7-segment LED supply rail. This safety resistor has been omitted from later prototypes. The commercially made PCBs have very well controlled spacing that protects against short circuits when assembled.


In System dsPIC Programmer

The simplified programming interface means the (AVR style) LVISP programmer needs a diode and two 470 ohm resistors added (shown below).
The programming adaptor works well with the free PICPgm. http://picpgm.picprojects.net/


If using an add-on printer card, put the card's I/O address under "Programmer Connection" "Advanced" "I/O Addr.".
The card used in this example was a "Redchief" LPT COM1 COM2 serial port expansion card, with LPT I/O address 0xE800. This card works well, as it has a good voltage output and very high value pullup resistors allowing it to work with the revision 1.2 circuit below.
If using standard on-board peripherals, select the LPT number in "Port", instead.
 

Programming Interface Schematic

 

Parallel Printer Port. (From Wikipedia.)


The dsPIC needs to be powered up to use this programming method.

If this circuit fails to communicate with the dsPIC, the port voltage might be a bit low. Try increasing R5 and R6 to 680 ohms or even 1k. These resistors need to be low enough in value to discharge the cable capacitance, and high enough in value to allow adequate voltage.

Some printer ports have low value pullup resistors that can upset the voltage levels on the Data line (3). These types of printer ports require buffering of the pin 10 Data In line (ACK) to prevent it pulling up the voltage level on the Data line, and to fully drive the Data In line. Using an LM311 has been proven to work even with troublesome printer ports.


Programming

To program the dsPIC, the DSP PCB MUST be powered up.
The internal FRC is used as a clock source.

PICPgm Settings

For initial programming:
Select "Program Code Memory (FLASH)".
Deselect "Program Data Memory (EEPROM)".
Select "Program ID Locations".
Select "Program Configuration Bits".

If Verify fails:
Deselect "Program ID Locations".
Deselect "Program Configuration Bits".

For later updates:
Deselect "Program ID Locations".
Deselect "Program Configuration Bits".

Configuration bits only need updating if the hardware configuration changes, which is very unlikely.


Transformerless ground loop cancellation

The transceiver ground voltage is changed by the transmitter current drain (the signal envelope), due to voltage drop across the negative power wiring. When fed from external equipment, the microphone input can easily suffer feedback from this as it shares the same ground voltage.

A common way to prevent this happening is to use a coupling transformer. The transformer allows differential current flow, but prevents common mode current flow.

But transformers have some problems:

This design uses microphone ground isolation, microphone attenuation, and OpAmp ground loop cancellation to prevent ground loops affecting the microphone signal. This is done by isolating the DSP board microphone output ground from PCB ground, and attenuating the processed audio with a voltage divider that has its grounded end connected to the radio microphone ground. The OpAmp takes a sample of the radio microphone ground voltage, and amplifies it (at a gain of 1) into the output signal, thus cancelling the ground current flow on the signal output by maintaining equal voltages. The combination of techniques seems to work well at preventing ground loop induced feedback.

The audio is attenuated by a voltage divider for two reasons:

As the audio is attenuated, it is brought closer to the transceiver ground level. This reduces the effect of any ground voltage differences by the attenuation factor. The audio is reduced by about 38 dB.

Since a receive mode DSP input has been added, additional ground loops are possible. A differential input has been used in the Rx ADC preamp circuit to minimize this.

The ground loop cancellation circuit relies on a low-resistance connection to the transceiver microphone ground. A ferrite bead-on-lead has low DC resistance, and has been added to the microphone ground line for better RF filtering.


S/PDIF via TOSLINK

It was desirable to add optical digital audio output for these reasons: The audio data needs to be correctly formatted and encoded into Biphase Mark code (BMC - also called Differential Manchester Code) for the TOSLINK optical S/PDIF output.

BMC is a simple two-frequency representation of binary data. A 1 is encoded as a 10 or 01 output, and a 0 is encoded as a 11 or 00 output. The polarity of the new output is the opposite of the previous last output bit. An 8 bit byte becomes a 16 bit word after BMC coding.

The audio is encoded by using a 256 word lookup table to convert to BMC. The data is then written to a dual DMA memory buffer for sending to the dsPIC DCI unit. The SPI unit could also work for this application, and may run at higher clock speeds. Since these are hardware shift registers, they can send high speed 16 bit serial data words with no additional CPU load.

Software encoding was chosen because the special "preamble" sync codes that S/PDIF uses are not in BMC format - which makes hardware encoding difficult. Commercial S/PDIF encoders exist, but they need a clock reference that is not easily available now that the dsPIC has been switched to the internal FRC clock.

Ideally, the S/PDIF would be at 11.025 kHz stereo, but most consumer devices will not recognize this sample rate. The S/PDIF output is instead upsampled (without antialias filtering) to 44.1 kHz stereo with good results. The USB sound device being used works well at this rate. The CPU is now being clocked at 39.5136 MHz, and the correct S/PDIF bit clock is generated by Timer3 Output Compare routed to the DCI serial clock input by setting both lines to use remappable pin RP4.

Since there wasn't room to fit a full size TOSLINK socket on the rear panel, a mini-TOSLINK output connector was built from a 3.5 mm socket and a red LED. It works very well. A mini-TOSLINK to TOSLINK cable connects the DSP unit to the S/PDIF optical input of a cheap (<$15) C-Media USB sound device.

At this stage, the dsPIC internal FRC clock appears to be stable enough for reliable S/PDIF / TOSLINK functioning, but clock frequency errors or drift will cause recorded audio to change pitch slightly.

Recordings are best done at 11.025 kHz, so the recording system performs antialias filtering. Another way is to record at 44.1 kHz, and resample to 11.025 kHz afterward. This does not require antialias filtering, as there is no audio content above 5.5 kHz. The dsPIC software currently does not feature antialias filtering on the S/PDIF resampling, to reduce cpu load. The transmit monitor output now features some EQ to improve the sound quality, and no longer has accurate peak control like the transceiver output does.


Design choices

The enclosure has been chosen from the extruded aluminium boxes available on eBay.
These boxes and much more are available for reduced prices on their website: http://rfsupplier.com/
The PCB has been designed for box type BOX-1110 (rounded corners, black) box:

 

The DSP Speech Processor needs several connectors to attach the I/O.
The microphone I/O is designed around 8-pin Mini-DIN connectors.
Fly leads can be built to adapt to any kind of microphone system.
Receive audio I/O is via 3.5 mm phone plugs.

An audio amplifier IC has been added to the board. Point-to-point wiring connects the amp to the Speaker socket. If speaker drive is not required, the audio power amp can be left out of circuit, and the Rx Out taken from the OpAmp, but this will disable the transmit muting hardware.

A front panel stereo headphone socket has been added to the PCB. It can also be used as a TAPE output for recording both sides of a QSO. The audio is also available via the digital optical TOSLINK output. The optical output has the advantage of being immune to RF and ground loop effects. It carries processed audio on the left channel, and unprocessed audio on the right channel - for both transmit and receive.

PCB I/O consists of:

Right Mini-DIN (back view).
Microphone audio input.
PTT input.

Left Mini-DIN (back view).
Processed audio output.
PTT output.

PTT Rx switching is only required by some older CB radios.

Rx audio in (3.5 mm).
Rx audio out (3.5 mm).
3.5 mm Socket Tech Drawing - these were the slimmest 3.5mm sockets available anywhere. Known as Lumberg 1503-07:

Digital optical output (TOSLINK S/PDIF) located on Display PCB 1 (3.5 mm Mini-TOSLINK, built from an LED mounted behind a 3.5 mm socket).

DC Power (2.1 mm). A long shaft plug may be required due to rear panel clearances.


Bill of materials

Bill of materials (parts list)

Bill of materials (parts list) with component location grid (thanks to Frank G0GSR)


Special Parts

NOTE: These are the parts used to build the prototype. They may be available more cheaply (or in smaller quantities) elsewhere. Shop wisely!

Two different dsPICs can be used in this design:
The SPDIP dsPIC33FJ64GP802-I/SP can be purchased online from Microchip Direct (minimum order is 2). This was the original design choice.
The SPDIP dsPIC33FJ128GP802-I/SP costs slightly more (about $1 extra), and has twice the FLASH memory. This could be useful for future firmware upgrades, and is compatible with the original design.

DSPIC33FJ64GP802-I/SP
Lead Count:    28
Package Type:    SPDIP
Temp Range:    -40C to +85C
Packing Media:    Tube
http://www.microchipdirect.com/ProductSearch.aspx?keywords=DSPIC33FJ64GP802-I/SP

*OR*

DSPIC33FJ128GP802-I/SP
Lead Count:    28
Package Type:    SPDIP
Temp Range:    -40C to +85C
Packing Media:    Tube
http://www.microchipdirect.com/ProductSearch.aspx?keywords=DSPIC33FJ128GP802-I/SP
 

SM16126D SOIC-24 LED Driver:
http://www.ebay.com/itm/2pcs-16-channels-constant-current-LED-drivers-arduino-SM16126D-STP16CP0-TLC5926-/111902604117

Miniature electrolytic capacitors are available here:
http://stores.ebay.com/CAPPRO/Electrolytic-Capacitors-/_i.html

Ferrite "Beads On Leads":
http://www.ebay.com/itm/50-Ni-Zn-Ferrite-Bead-Core-Lead-3-5x6-0mm-Taiwan-/140329107881

DC power socket:
http://www.ebay.com/itm/10pcs-DC-Power-Supply-Female-Jack-Socket-5-5-x-2-1mm-Barrel-Type-PCB-Mount-/180855002074

Miniature 3.5mm sockets (called "Lumberg 1503-07" sockets - widely available):
http://www.ebay.com/itm/10-Pcs-DIP-PCB-Mount-4-Pins-Female-3-5mm-Stereo-Audio-Jack-Socket-/321099207333

Alternative 8-pin Mini-DIN sockets: * These have been checked, and physically fit the PCB, though they have slightly different dimensions. This supplier has cheaper postage.
http://www.ebay.com/itm/311323907000

The 8-pin mini-DIN sockets: *
http://www.ebay.com/itm/5-Mini-DIN-Connector-Socket-Female-8pin-PCB-pin-2008-8-/140431326834

The 8-pin mini-DIN plugs: *
http://www.ebay.com/itm/5pcs-Mini-DIN-Connector-Male-Plug-8-pin-1102-8-/140431341209

* It is important to purchase mini-DIN plugs and sockets that match the PCB pad outline. Connectors from other suppliers are not guaranteed to fit the PCB. Also, plugs and sockets bought from different suppliers may have differing connector pin configurations, and may not fit each other.

PCB mount right-angle pushbutton switches:
http://www.ebay.com/itm/10-x-Tact-Switch-6-6mm-6-85mm-50mA-12V-DC-Right-Angle-/260528274819

7-Segment common anode white LED display:
http://www.taydaelectronics.com/led-displays/7-segment-1-digit/led-display-7-segment-1-digit-0-56-inch-common-anode-super-white.html

AMS1117 1A 5V SMD Regulator IC:
http://www.ebay.com/itm/10-pcs-AMS1117-5-0-5-0V-1A-Voltage-Regulator-SOT-223-/250725260822

AMS1117 1A 3.3V SMD Regulator IC:
http://www.ebay.com/itm/10-pcs-AMS1117-3-3-3-3V-1A-Voltage-Regulator-SOT-223-/250742607708

1.35A through-hole Polyswitch devices:
http://www.ebay.com/itm/20pcs-RUEF135-1-35A-30V-PPTC-PolySwitch-Resettable-Fuse-/321412059105

1A SMD Polyswitch device:
http://www.ebay.com/itm/10Pcs-Polyswitch-SMT-SMD-Resettable-Fuses-1812-1A-/180640196871


Construction Notes

Front panel drilling template for PCB257

This template is for PCB257 (1.6mm thick) only. PCB260 will need different measurements, as the boards are only 1.0mm thick causing the buttons and headphone socket to be 0.6mm lower.
Print this template at 600dpi for correct scaling.

Rear panel drilling template

Still to come.....
 

Forming the front panel

A transparent front panel has been made from 1.5 mm thick polycarbonate sheet (to allow the 2.5 mm long headphone socket to clear the panel). The corners were rounded using a milling bit in a drill press. The panel was temporarily screwed down to a simple wooden jig built from scrap timber, allowing the panel to be pivoted and rotated past the milling bit for an accurate, repeatable curve.

Drill all the panel holes before rounding the panel. This provides the required mounting holes, and helps assure better alignment.

The template below allows the construction of a wooden jig. Only one pivot point is necessary. When the first end of the panel is rounded, undo the mounting screws and flip the panel over end-for-end instead of rotating it. This helps provide better left-right symmetry in the finished panel. Then fasten the panel again with mounting screws and round the other end.

Print this template at 600dpi for correct scaling.

Dark grey window tint was applied to the front surface to improve LED contrast. This also hides any scratches on the polycarbonate. It may also be possible to use the adhesive window tint to hold button labelling in place. If acrylic sheet is used, never clean it with alcohol as this will discolour the material.


 

For commercially made PCBs:

It may be best to solder the LEDs to Display PCB 2 before attaching it to Display PCB 1. The 3mm LEDs need to be spaced about 2mm off the board, then twisted with pliers to align their flat sides to point to the next LED for space reasons (otherwise they won't fit).

The optional SMD protective resistor on Display PCB 2 (marked "R") is best ignored.

Attach Display PCB 1 to Display PCB 2, making sure the PCB edge pads are aligned. Display PCB 2 should be vertically aligned with Display PCB 1 so that the top row of the 7-segment LED pins is just clear of the top edge of Display PCB 1. Tack solder Display PCB 2 to Display PCB 1 at the corner pads first, in case realignment is needed. Be careful not to stress the PCB edge pads, or they may break off the board making reconnection very difficult. Avoid dropping the boards at this stage, or the edge pads can break off! Also use a small amount of solder to bond parts of the large top pads of Display PCB 2 to the Display PCB reverse side for mechanical strength.

Display PCB Alignment: PCB1 = Display PCB 1
A: Ideal alignment for 1.6 mm thick PCBs. 7-segment LED is mounted almost touching the box top, 3 mm LEDs have very little space. LED pins clear the PCB1 edge OK.
B: Actual alignment used on the first prototype. 7-segment LED is mounted almost centrally. PCB1 is mounted slightly higher. 3 mm LEDs have a little more space. LED pins clash with PCB edge, requiring a chamfer.
C: Ideal alignment for 1.0 mm thick PCBs. 7-segment LED is mounted almost touching the box top, 3 mm LEDs have a bit more space. LED pins clear the PCB1 edge OK. Use this for PCB-260.

Using 1.0 mm thick PCB material increases the space above and below the 3 mm LEDs. This means the same design will work for 1.0 and 1.6 mm PCBs, as the 3 mm LED centre line is the same.

The commercially produced PCBs have very carefully controlled LED placement. Using 1.0mm PCBs (PCB260) they should mount like "C" above. The rear of Display PCB 1 is required to be vertically higher than the front, to enable sufficient separation of the 3.5 mm Rx In socket and the mini-TOSLINK socket. Sloping Display PCB 1 upwards slightly towards the rear allows for this.

Header pins are used in two areas, for CPU electrical connections and mechanical fixing. Gold plated pins are recommended to provide most reliable contact. Nickel plated pins were used on the first prototype, and became unreliable.

Some 2.54 mm header pins and sockets connect the signal lines between Display PCB 1 and the Main PCB:
 

Simpler PCB pin mounting

The best way is to mount some straight header pins on the main board, and the header socket strips on the Display board (shown below). This avoids the need for creating a customized header pin assembly from right angled pins. Instead, the mounting pins of the socket strip are bent flat to match the pad pattern for SMD mounting. This method has been tested, and works fine.


After the pins are installed, plug Display PCB 1 into the main PCB, taking care to align all the pins. Test how well the PCBs fit the enclosure. They should align well, with no conflicts. Display PCB 1 tilts up at the rear for correct front and rear alignment.

Once the alignment is good, solder the remaining edge contacts that connect Display PCB 1 and Display PCB 2. Also solder the mechanical bonding solder pads at the top of the boards.

Next, fit the other parts to the boards. Start with the main PCB, then move on to the Display PCB components. Most parts are marked on the overlay. More details below.

Some capacitors can be either through hole or SMD. SMD capacitors have better RF performance.

Be careful to install the SIP OpAmps around the right way - they are difficult to unsolder. Pin 1 is marked with a square pad and a square outline on the overlay. Vcc is pin 8.

Use machined pin socket strips as a socket for the dsPIC chip. Mount the socket strips before the other components around them.

The TDA2003 leads need to be straightened to fit the board. Use minimal solder on the IC pins, as the pads have close spacing. They may be a tight fit. The TDA2003 needs to be mounted with its epoxy body pressed down until it touches the PCB, so the heatsink tab will clear the top of the enclosure. It only just fits.

Solder in a copper heatsink tab after fitting the IC, keeping the solder away from the IC lead pads. The tab will need one mounting hole, aligned to the IC tab hole. The tab needs to be the same height or slightly lower than the IC tab, or it will hit the top of the enclosure. Use a copper tab. Do not attempt to solder an aluminium heatsink tab, it will damage the PCB (aluminium soldering requires special solder alloy with a high melting point).

The commercial PCBs do not require fixed wire jumpers, but there are four flying leads required. One is for the Rx ADC input, one for Headphone output, and two are for the speaker output. Mount the four flying leads last, after the other components. The speaker flying leads can both have a ferrite bead added to reduce RF effects, but this is optional.

The main DSP board can be constructed first, and powered up with Display PCB 1 disconnected. The unit will function OK with no display. Before inserting the dsPIC IC, power up the main board, and check the supply rails. They should be 3.3v at the dsPIC IC. Also test the 8.3V rail for the analog circuits. Then power down and insert the dsPIC. It can then be programmed.

IMPORTANT: Never remove or insert Display PCB 1 with power applied or LED damage can result, due to short circuits.

Pads have been provided for an SMD RF bypass capacitor to be fitted to the TDA2003 audio input, if required. Currently unused.

The Polyswitch device can be either a through-hole or SMD type. It is used to protect the PCB tracks from melting in case of a short on the 12V rail. A 1.35A 30V device has been used.

The electrolytic capacitors must be physically small enough to fit the available space. This is especially important for values over 100 uF.
The smallest electrolytic capacitors are 4 x 7 mm from CAPPRO on eBay.
Use the lowest voltage rating suitable. e.g.: 16V for 12V bypass, 10V for 8V bypass, 10V or 6V for 3.3V bypass, 10V for coupling, etc.

The circuit is DC isolated from the enclosure. There are some SMD pads on the tracks for capacitor placement. The main groundplane has a 0.5 mm spacing from the edge tracks.

The programming connector is a 4-pin PCB header socket strip, fitted to the PCB underside using surface mounting, and facing the front. This avoids the need to remove Display PCB 1 to access the connector. It can then be accessed from the front after removing the front panel, or after sliding the PCB assembly out from the rear of the box. Glue the socket strip to the PCB with a dab of hot glue, to prevent the pins flexing and breaking.
See below:

Note: The 4-pin header socket does NOT align to the four resistors nearby - the right hand pin connects to the PCB ground pad. The PCB overlay correctly shows the pin locations, numbered 4, 3, 2, and 1. The commercial PCB has this marking on the overlay, and also features plated through holes to reinforce the pads.
 

Mini-DIN Plugs

The mini-DIN plugs used have a bulky double-layer outer plastic shell that is best discarded. The outer layers can conflict with the rear panel and prevent the sockets engaging fully. Instead, the metal shell can be soldered together at the rear tabs and wrapped in tape or heatshrink. This produces a slim plug that works well. Scrape back the plating to make soldering easier.

Avoid overheating the pins when soldering or the plastic can melt - destroying the plug. Solder fast.

The outer jacket from some RG-6 coax fits these connectors perfectly, and keeps the wiring tidy. A dab of hot glue inside the plug shell halves acts a good strain relief. It will melt when soldering the shell halves together, producing a good bond to the RG-6 jacket.

 

3 wire electret converson


A three-wire large diaphragm electret condenser microphone was used on the prototype. The circuit above was used to convert it to 2-wire phantom power format to suit the DSP unit. An additional resistor boosts the gain slightly to improve performance. Capacitor C2 is used to suppress RF. It must be a ceramic type. Values from 2n2 (2200pF) to 4n7 (4700pF) are OK. The R1 value can be altered to suit the microphone characteristics. Maximum gain occurs when R1 is replaced with a short, but this may increase distortion.

Dec 31, 2015: C1 (was across R1) has now been removed from the circuit, as the DSP EQ has been modified to work better with a flat input.

If RF feedback persists, add an RF choke of at least 1mH in series with the 2-wire output "Audio" line, close to the mike. 1mH = 1 millihenry = 1000uH = Brown Black Red.
 

Dynamic microphone amplifier

The input to the DSP Speech Processor is designed for Electret Condenser microphones. Dynamic microphones need more gain, and a lower input impedance. This circuit uses the phantom power supplied by R1 on the DSP board to run a one transistor amplifier. If Rx is used, the 4k7 resistor may need to be increased to boost the gain. Because the input of the amp loads the microphone, Rx needs to be higher than the microphone impedance.

* The 2n2 capacitors must be ceramic types, to be effective at RF suppression.

* If RF feedback persists, add an RF choke of at least 1mH in series with the "To DSP Mike input" line. 1mH = 1 millihenry = 1000uH = Brown Black Red.

* If this circuit is not located at the microphone, an additional RF choke of at least 1mH may be needed in the "Mike in" line, to suppress RF feedback. Place it between Rx and the 1uF capacitor, or between the 1uF capacitor and the 2n2 capacitor.
 

Extra RF filtering

In some installations, RF feedback can be a severe problem that can still occur even with a 2.2nF ceramic RF bypass capacitor fitted. It is important to correct any RF feedback problems before making other adjustments to the system. Any RF feedback will destroy the good audio quality of the processor. In these situations, additional filtering must be fitted by adding an RF choke to improve the RF blocking. If the RF filtering is effective, the mike input should be able to run at full gain without any RF feedback (though this may cause normal background noise increase).

An example is shown below:

Both the capacitor and the RFC must be mounted close to the microphone.

1mH = 1 millihenry = 1000uH = Brown Black Red.
Small value RF chokes (much less than 1mH) will be of little use to reduce RF levels on the microphone. If the RFC resonates with the 2.2nF capacitor at the radio frequency, it will make the RF voltage at the mike higher instead of reducing it!

The microphone cable shield wire must connect to microphone ground. This is to ensure good shielding against AC hum and RF.
Avoid using data cable for microphone cable, as the microphone wire is not shielded from the other wires. This causes capacitive coupling.
Do not connect microphone shield wire to chassis ground. This can cause earth loop feedback, RF feedback and AC hum pickup.
Do not short microphone ground to chassis ground. This can cause earth loop feedback and RF feedback.

If RF feedback is still present after installing effective microphone RF filtering, there is a problem somewhere that must be fixed. See Troubleshooting.
 

Grounding

Correct ground connections are essential for correct processor operation. Following correct grounding procedures will help to assure the best audio quality.

DSP MIKE INPUT to MICROPHONE
The microphone cable must be shielded, and the shield must connect to the DSP microphone input ground. DSP microphone input ground is connected directly to PCB DC ground. It is grounded for audio, RF and DC. Connecting the shield to microphone ground prevents RF pickup, and AC hum pickup.

If the microphone cable has a separate ground wire and shield wire, they must be connected together at the processor. They can also be connected together at the microphone.

Do not connect the microphone shield wire to chassis ground. The DSP chassis ground is not DC grounded or audio grounded, and is not guaranteed to be RF grounded due to aluminium oxide and powder coating on the enclosure. Lack of grounding at audio frequencies will cause AC hum pickup. If the chassis has RF flowing on it, connecting the shield to the chassis could feed the RF directly into the microphone input via capacitive coupling through the cable. This can cause RF feedback.

Do not short microphone ground to chassis ground. Chassis ground is intentionally isolated from DC ground to prevent ground loops. Ground loops at the processor input will cause ground loop feedback (sounds just like RF feedback) due to the high processor gain. When the microphone ground is shorted to the chassis, this could happen at any time if the DSP box were to touch other grounded metalwork.

Do not use the DSP PTT input ground for a microphone ground or shield connection. It is only grounded via a 1k resistor, and will not be an effective ground for DC, audio or RF.

DSP MIKE OUTPUT to TRANSCEIVER
The DSP microphone output feeds the audio into the transceiver microphone input. The DSP microphone output ground connection must only connect to the transceiver microphone socket audio ground pin. The DSP microphone output ground connection must remain isolated from the DSP PCB ground, and the chassis ground. Any connection between these ground points can cause ground loop feedback (sounds like RF feedback).

If the transceiver microphone socket has separate PTT grounds and audio grounds, use the audio ground only. The PTT ground pin may not share the same ground voltage as the transceiver microphone input stage, due to being connected to a different part of the transceiver PCB. This can cause ground loop feedback (sounds like RF feedback).

Do not short the DSP microphone output ground to DSP chassis ground. This can cause ground loop feedback if the DSP chassis becomes shorted to another ground.

Do not short the DSP microphone output ground to transceiver chassis ground. This can cause ground loop feedback if the chassis is DC or audio grounded via any other path.

Do not short the DSP microphone output ground to transceiver power ground. This will cause ground loop feedback by disabling the ground loop cancellation circuit.

Do not short the DSP microphone output ground to DSP PCB ground. This will cause ground loop feedback by disabling the ground loop cancellation circuit.

NOTES
These rules might seem excessive. Sometimes, these rules can be broken and everything seems fine... until something changes. For example, if the mike ground is connected to the chassis ground of the DSP box, this of itself doesn't cause a problem. But if the box touches or is connected to other grounded metalwork (such as a metal bench, a station ground bus or a transceiver casing) suddenly it will cause ground loop feedback. Having correct ground connections prevents this from ever happening.

Because the DSP Speech Processor can have as much as 40dB gain on the microphone input, any signals caused by ground loop current or RF pickup will be greatly amplified. This causes problems that can range from slight distortion effects through to 100% feedback. It is important that the microphone shielding is correctly grounded to keep RF out of the microphone wiring. Even though the microphone and microphone input stage have RF lowpass filtering, there is a limited amount of RF rejection. At low frequencies this rejection is less than at higher frequencies. Strong RF pickup due to incorrect cable shielding can still cause RF feedback.

Another thing to be aware of, is there are often different grounds used for different frequency ranges. For example, standard practice in radio transceivers is to have the antenna output ground connected to the chassis, and the negative power connection used as PCB ground. But in many cases, these two grounds are isolated at DC and connected at RF by only grounding the PCB via small capacitors. For mobile radios, this is often done to prevent short circuits in case the radio is used in a vehicle using positive chassis ground on the electrical system. If the radio is manufactured with the PCB grounded to the chassis at DC, this is usually only done in certain places on the circuit to prevent ground loops due to the very high currents being used (often over 10A for 100W transceivers). The high currents cause voltage drops in the wiring and PCB tracks (due to resistance) that have to be kept from affecting sensitive inputs, (such as microphone inputs) that are operating in the millivolt range. This is why transceiver microphone inputs are never grounded to the chassis at DC and audio frequencies - although they are often grounded at radio frequencies using RF bypass capacitors to help prevent RF from entering via the microphone wiring.
 

Microphone Wiring

Mini-DIN pinouts
INPUT
OUTPUT


EQ and output level modifications

To remove DSP analog output EQ (to suit transceivers with flatter responses - such as DSP based radios):
Remove R31 and C31. This removes the low frequency shelf, and increases gain.
Change R33 to 22k. This reduces gain to prevent clipping.
Connect a 22pF capacitor from U1b pin 6 to 7 to improve stability. This prevents OpAmp oscillation.
Also, disable DSP output EQ in settings. (Set Output EQ mode to zero.) Remember to save settings.
This mod is for newer transceivers that have a flat transmit passband. It produces very good results.

To decrease DSP analog output EQ (to suit transceivers with wider filters, or to reduce bass level or bass distortion in some transceivers):
Change R31 to 10k to reduce EQ by 6dB.
Connect a 22pF capacitor from U1b pin 6 to 7 to improve stability. This prevents OpAmp oscillation.
The output level will increase after this mod. Reduce output level setting to compensate.

Increasing output level:
Scale R45 as needed to increase level.
Some transceivers need more audio drive. Change R45 to 22k for 6dB more output, or 10k for 12dB more output. Do not reduce R45 more than necessary. Overdriving the transceiver can cause distortion and splatter.
Keep R45 above 1k.

Changing the analog EQ corner frequency:
Some transceivers have a wider or flatter frequency response, and need a lower corner frequency for the DSP analog EQ boost. The following table should help to calculate the best value for C31. Supplied by Frank, G0GSR.
 
C31 f+3dB
68n 477Hz
100n 322Hz
330n 99Hz
560n 57Hz


Voltages

As measured on the prototype 21/11/2013 in either Tx or Rx mode.

U2a pin 1: 6.03V
U2b pin 7: 6.60V Versions prior to v5.1 are 4.51V

U1a pin 1: 5.64V
U1b pin 7: 5.86V

These voltages are not critical, but should be near Vcc/2 (6V) for maximum OpAmp voltage range to avoid clipping.


Current Drain

Current drain: as of 06/11/2013 @ 13.8 Volts.
Transmit, Bright mode: 330 mA.
Transmit, Dim   mode:  200 mA.
Receive,  Bright mode: 310 mA+   Expect current to rise with received audio driving a speaker.
Receive,  Dim  mode:  180 mA+   Expect current to rise with received audio driving a speaker.

If current consumption is much higher than this, test for audio amp oscillation, a short circuit, or a failed SMD regulator.
Audio amp oscillation can be caused by: Poor connections, failed or poor quality components or shorted output wiring.

Caution: The 8.3V rail is supplied by a 5V regulator with its adjust pin connected to the 3.3V rail, which may prevent the 5V regulator overcurrent protection from working. Avoid shorting the 8.3V rail!


Temperature

At ambient of 29°C, the unit reaches 40°C in receive mode, with LEDs set to Dim. Airflow can reduce this.


Construction Pictures


Testing the brightness matching of the new green LEDs on the very first prototype.
 


The LED Display Board(s) - Contains a low-cost 3.3V SMD serial LED driver IC, a TDA2822 used as a full bridge LED driver for the R/G LED, a TOSLINK digital audio output driver circuit, and assorted dimming logic.

The green bargraph LEDs are superbright water-clear types to match the brightness of the other LEDs. They were made diffused by roughening the front surface with fine sandpaper.

A 3.5 mm TOSLINK adaptor was built from a 3mm red LED and a 3.5 mm socket.

Normal resistors were used to make construction easier. Some surface mount devices were used to save space and money. The header pins are standard right-angle types, modified to be surface mounted. The CAD process makes the boards fit together perfectly.


The two PCBs side-by-side.


The two PCBs fit together well, like a sandwich. The back of Display PCB 1 is all groundplane, except for an isolation strip near the front edge.


Triangle modulated sinewave being used to perform a linearity test on a transceiver. A good result!


DSP Speech Processor transceiver setup

Feed a 12 to 15 volt DC power supply to the DC Power socket. The transceiver power supply can be used, and this is recommended. The centre terminal is positive. Some transceiver power supplies can deliver very high current, and a short circuit on a light duty power cable may not trip their overcurrent protection. Inserting a ~1A Polyswitch device (or fuse) in series with the power lead is a good idea to avoid a fire hazard in case of a short. 1.35 A 30 V Polyswitch devices have been used on the prototype - one on the main PCB and one at the power supply.

Connect a 4 to 8 ohm speaker to the DSP Speech Processor 3.5 mm speaker output (the socket further away from the DC Power socket). The TDA2003 audio amplifier IC can drive speakers down to 2 ohms, but the bass response will decrease due to the output coupling capacitor being 1000 uF.

Transceiver microphone fly leads will need to be made to suit the transceiver. Consult your transceiver schematic diagram for the microphone wiring. The transceiver microphone lead goes to the mini-DIN socket nearest the DC Power connector, and the input microphone lead goes to the mini-DIN socket furthest from the DC Power connector.

See Microphone Wiring Diagram.
See Grounding.

Receive

Connect the transceiver speaker output to the DSP Speech Processor receive audio input (next to the DC power socket) using a 3.5 mm audio lead. Either a mono or stereo lead should work, as the sockets are stereo types, but are wired for mono operation.

Adjust the radio volume control so the last orange LED lights on the loudest voice or noise peaks. This is the point at which the DSP Receive AGC activates. Signals above this level will be compressed to prevent them exceeding the set volume level. The volume can be reduced further to avoid this AGC action if desired.

The DSP Speech Processor Receive volume setting can be adjusted by the "r" Select Menu. This is the default at power-on. At the time of writing, this DSP adjustment will be lost at power-off. At power-on, the unit will start at the default setting again.

If NR is activated via Select Menu "n", the audio level may reduce. If needed, increase the radio volume slightly until the speaker volume is at a comfortable level again. NR decreases random noise on the signal, and enhances cyclic content.

The NR adjustments are:
d Delay: Adjusts the DSP delay between the audio input and the LMS filter. Increasing delay makes the noise reduction more aggressive, and increases audio artifacts.
G Gain: Adjusts how closely the LMS filter attempts to follow the signal. Increasing gain makes the signal louder and increases audio artifacts.
L Leak: Adjusts how fast the LMS filter response decays to zero. Increasing leak improves noise reduction and increases audio artifacts.
= EQ: Adjusts the EQ slope of the LMS audio input. Increasing EQ boosts treble and cuts bass. Decreasing EQ boosts bass and cuts treble.

If the red LED lights at any time, it indicates input ADC clipping. Reduce the radio volume until the red LED does not light on signal peaks.
 

Transmit

Initial transmit testing of the DSP Speech Processor can be done without a transceiver, by listening to the transmit audio via headphones connected to the front panel headphone socket. Monitor level is adjusted via the "r" Receive volume Select Menu setting. Depending on the headphone characteristics, the tone response may not be accurate. The analog monitor output response is not flat, as it includes some DSP lowpass filtering to improve sound quality. Since the compression gain is high, feedback can be a problem when monitoring. This primarily occurs at high frequencies around 4 kHz where the pre-emphasis is greatest, and typical headphones have the most audible leakage. Monitor output latency is around 30 mS.

Audio can also be monitored via the S/PDIF output. If the S/PDIF is fed to a stereo amplifier, severe alias distortion will be heard, as the S/PDIF output does not currently feature antialias filtering. If S/PDIF audio is recorded using a sample rate of 11025 Hz, the alias frequencies above 5.5 kHz will be completely removed. The S/PDIF audio is the unprocessed (Right) output and processed (Left) output (no transceiver output EQ).

Transmit setup of the processor is best done while transmitting into a dummy load.

Switch PTT to transmit and speak normally into your microphone. The processor LEDs should light up to show each speech band being compressed. The first green LED (LED 0) will mostly light during sibilance ("S" sounds) or other high frequency sounds. The last orange LED (LED 7) will light most of the time, showing output compressor action. The red LED (LED 8) will light to show Hilbert clipper action.

Set the correct bandwidth to match the transceiver. This is set using the Select menu "U" option.
At the time of writing, six settings are available:

The 3 kHz modes lowpass filtering is also active on receive.

Adjust the transceiver microphone gain for the desired ALC action. If the output EQ is well matched to the transceiver, it should be possible to obtain full PEP output at all voice frequencies with little or no ALC action.

If this is not possible, it likely indicates the DSP output EQ does not suit the transceiver. With the current design, this will usually mean the bass end of the audio spectrum is too low in level. Sometimes this can be improved by boosting the bass EQ by circuit adjustment, or DSP output EQ adjustment (limited selections are available at this time). Another method is to modify the transceiver audio response to be flatter towards the bass end of the spectrum, by increasing coupling capacitor values in the transceiver microphone amplifier circuit.

Transceiver SSB carrier offset frequencies should be checked for accuracy and corrected if errors are found. It is possible to improve the low frequency transmit response on SSB by increasing the audio path coupling capacitor values, and by careful tuning of the carrier offsets. This may degrade opposite sideband rejection slightly at low frequencies. It is not too difficult to obtain a reasonably flat SSB response down to 100Hz on a typical transceiver, using the SSB 2 EQ (default) and some careful carrier offset tuning (see image below). This is done using the white noise mode (main mode "d") while observing the signal on a low-cost SDR receiver. An RTL dongle works well on the higher bands (27/28MHz) for this purpose. The carrier is placed part way down the SSB filter curve, and finely adjusted for best passband flatness on white noise. Only a small vestige of opposite sideband energy is left close to the carrier (depends on filter response). If audio distortion is too high, increasing the transmit path RF gain after the balanced modulator can decrease distortion by lowering the audio drive requirement. This will reduce the carrier suppression by an equal amount, but with careful adjustments it can easily reach an acceptable limit. The best option for wideband audio on SSB might be to replace the SSB filter with a new unit having a wider response and/or steeper skirts, or even better still - use a DSP based SSB generator, or a DSP based transceiver.

The transceiver passband response can be checked by using the Mode "b" Swept tone flatness test, and an RF power meter or scope. This will display the combined response of the DSP output EQ, analog EQ, transceiver microphone amplifier and SSB filter. Ideally, the output power should be constant across the desired transmit passband. The white noise mode "d" can be used to check transmit passband flatness and opposite sideband rejection, by using an SDR receiver with a spectrum display. See image below.

If the DSP audio output level needs adjustment, it can be performed as follows:
With the PTT down, and the processing Mode number displayed, go to the Output Level setting in the Select Menu by pressing the Select button (button 2) three times. The 7-segment LED should display "o". The output level can then be increased by button 4 or decreased by button 3. This setting can now be saved using the "Programming Mode".

If the transceiver features an SSB RF clipper processor, the RF clipper can be used as a final limiting stage. Since an RF clipper has no methods to control in-passband distortion, it should be used at its lowest level for best quality (just barely clipping). The DSP then does the bulk of the processing, with the RF clipper providing final peak protection for the transmit stages by removing overshoots. Any other transceiver audio compression should be disabled, or reduced to minimum. If the transceiver does not feature an RF clipper, but instead only has an audio based processor/clipper, it is recommended to leave the transceiver processing disabled.


SSB white noise spectrum on a typical CB transceiver using a 4kHz wide monolithic crystal filter. The LSB passband is mostly flat with only a tiny amount of USB energy present.


Troubleshooting

26/04/2014

Possible problems:

Audio break-up, echoing distortion, scratchy noise or feedback (SSB) or feedback squeal (AM).
Could be RF feedback, or a ground loop.

Strong mains buzz or hum on transmit audio. Poor peak control (overshoots).
Red Hilbert Clipping LED is lighting on voice: Red Hilbert Clipping LED is NOT lighting on voice: Other possibilities: High Distortion.
First, try reducing Output level.
Excessive output level: Excessive microphone drive: Bass clipping in the transceiver microphone amplifier stage: Hilbert Clipping is set too high: Very low microphone sensitivity.
A sudden loud input has frozen the microphone input AGC at a low gain level. High background noise level.
Too much gain - or - Noise gate disabled.
The DSP compressors have a total gain of over 30 dB. Any background noise will be amplified. Overheating.
The DSP unit runs warm, but not hot. If the audio amplifier tab temperature exceeds 50°C, it may be oscillating at HF (around 2MHz).



PCB Pictures

Commercially made PCB prototype:

Commercially made PCB, underside:

Commercially made PCB, Display PCB 1:

Commercially made PCB, Display PCB 2 - front view (not to scale):
3mm or SMD (untested) LEDs can be used with this panel. Safety resistor "R" is optional, and has a shorting link. It can be ignored.

Overlay of main PCB - all resistors marked. Click for full-size image.


Back to Index