Fixed CPU clock/Sample-rate clock error. Fixed amplitude-phase mis-alignment. Fix for reduced RFI: ADC conversion before RF conversion.

experimental
guido 2019-05-04 12:19:20 +02:00
rodzic 86bf8aa859
commit abb7b71e85
2 zmienionych plików z 20 dodań i 16 usunięć

Wyświetl plik

@ -58,7 +58,7 @@ class QCXLiquidCrystal : public LiquidCrystal {
#include <inttypes.h>
#include <avr/sleep.h>
#include <avr/wdt.h>
#define F_CPU 20000000 // Crystal frequency of XTAL1
#define F_CPU 20008400 //20000000 // Crystal frequency of XTAL1
#define I2C_DELAY 4 // Determines I2C Speed (2=939kb/s (too fast!!); 3=822kb/s; 4=731kb/s; 5=658kb/s; 6=598kb/s). Increase this value when you get I2C tx errors (E05); decrease this value when you get a CPU overload (E01). An increment eats ~3.5% CPU load; minimum value is 3 on my QCX, resulting in 84.5% CPU load
#define I2C_DDR DDRC // Pins for the I2C bit banging
@ -402,7 +402,7 @@ inline void vox(bool trigger)
}
volatile uint8_t drive = 4;
#define F_SAMP 4807 // 4807 4401 // ADC sample-rate; is best a multiple of _UA and fits exactly in OCR0A = ((F_CPU / 64) / F_SAMP) - 1 , should not exceed CPU utilization (validate with test_samplerate)
#define F_SAMP 4810 // 4810 // ADC sample-rate; is best a multiple of _UA and fits exactly in OCR0A = ((F_CPU / 64) / F_SAMP) - 1 , should not exceed CPU utilization (validate with test_samplerate)
#define _UA (F_SAMP) //360 // unit angle; integer representation of one full circle turn or 2pi radials or 360 degrees, should be a integer divider of F_SAMP and maximized to have higest precision
//#define MAX_DP (_UA/1) //(_UA/2) // the occupied SSB bandwidth can be further reduced by restricting the maximum phase change (set MAX_DP to _UA/2).
@ -420,6 +420,7 @@ inline int16_t arctan3(int16_t q, int16_t i) // error ~ 0.8 degree
}
uint8_t lut[256];
volatile uint8_t amp;
inline int16_t ssb(int16_t in)
{
@ -444,7 +445,8 @@ inline int16_t ssb(int16_t in)
_amp = _amp << drive;
_amp = ((_amp > 255) || (drive == 8)) ? 255 : _amp; // clip or when drive=8 use max output
OCR1BL = (tx) ? lut[_amp] : 0; // submit amplitude to PWM register; can be done best as soon as possible to make sure that the new envelope setting is stabalized when the phase change occurs
amp = (tx) ? lut[_amp] : 0;
//OCR1BL = amp; // submit amplitude to PWM register
static int16_t prev_phase;
int16_t phase = arctan3(q, i);
@ -469,14 +471,15 @@ volatile uint16_t numSamples = 0;
// This is the ADC ISR, issued with sample-rate via timer1 compb interrupt.
// It performs in real-time the ADC sampling, calculation of SSB phase-differences, calculation of SI5351 frequency registers and send the registers to SI5351 over I2C.
ISR(ADC_vect) // ADC conversion interrupt
ISR(ADC_vect) // ADC conversion interrupt
{ // jitter dependent things first
si5351_SendPLLBRegisterBulk(); // submit frequency registers to SI5351 over ~840kbit/s I2C
uint8_t low = ADCL; // ADC sample 10-bits analog input, first ADCL, then ADCH
uint8_t high = ADCH;
uint8_t low = ADCL; // ADC sample 10-bits analog input, first ADCL, then ADCH
uint8_t high = ADCH;
OCR1BL = amp; // submit amplitude to PWM register
si5351_SendPLLBRegisterBulk(); // submit frequency registers to SI5351 over ~840kbit/s I2C
int16_t adc = ((high << 8) | low) - 512;
int16_t df = ssb(adc >> MIC_ATTEN); // convert analog input into phase-shifts (carrier out by periodic frequency shifts)
si5351_freq_calc_fast(df); // calculate SI5351 registers based on frequency shift and carrier frequency
si5351_freq_calc_fast(df); // calculate SI5351 registers based on frequency shift and carrier frequency
numSamples++;
}

Wyświetl plik

@ -36,7 +36,8 @@ pe1nnz@amsat.org
## Revision History:
| Rev. | Date | Features |
| ----- | ---------- | ------------------------------------------------------------------- |
| R1.01 | 2019-04-09 | Improved audio quality and IMD3 performance and experimental (amplitude) pre-distortion and calibration. Fixed an issue with spurious transmission for RX-TX-RX transitions. <span style="color:red">**Upgrade requires installation step 6 (see below).**</span> |
| R1.01c | 2019-05-04 | Added I/Q Calibration feature. Added Voltage, I2C and CPU load self-tests on startup. Fix for reduced RFI. Fix for clock and amplitude-phase mis-alignments. Reduced LCD (s-meter) interference on RX. Increased TX bandwidth to 2.4 kHz. Cosmetic improvements. |
| R1.01 | 2019-04-09 | Fix for Q6 bias instability - now digitally switched (**C31 must be removed**). Improved signal processing. Experimental (amplitude) pre-distortion and calibration. |
| R1.00 | 2019-01-29 | Initial release of prototype |
@ -130,15 +131,15 @@ The following performance measurements were made with QCX-SSB R1.01, a modified
- 3dB bandwidth (sweep): 400..2330Hz
![twotone](https://raw.githubusercontent.com/threeme3/QCX-SSB/master/twotone.png)
Known issues:
Known/resolved issues:
| Rev. | Issue | Cause | Resolution |
| ----- | ----- | ----- | ---------- |
| ~~R1.00~~ | ~~in some cases degraded audio quality especially in local QSOs~~ | ~~analog operation of Q6 causes challenges with biasing, dynamic range, linearity and thermal-drift~~ | ~~(FIXED in R1.01) change C31/C32 so that Q6 operates in digital mode and together with the more accurate signal processing of the new firmware, the IMD performance, carrier+side-band rejection and spectral purity has been improved considerably~~ |
| R1.00 | crackling sounds and noise on TX | ATMEGA ADC is sensitive for noise and in some cases RF feedback worsen this | (not fixed yet) dynamic noise gating algorithm could be an effective way of mitigating the issue, adding additional inductor in series with mic in could help preventig RF feedback, increasing MIC_ATTEN value in code attentuates the audio input can put the noise below a threshold at the cost of audio sensitivity |
| R1.00 | in VOX mode TX constantly on when soundcard is connected to mic input | VOX is too sensitive and hence responds to the noise of the external device | not fixed yet) reduce gain on audio input, e.g. by reducing the output level of the external device, adding a resistive divider in the audio line, increase the MIC_ATTEN value in code to attenuate the signal in software or increase VOX_THRESHOLD to make the VOX algorithm less sensitive, dynamic noise gating algorithm could be an effective way of mitigating the issue |
| R1.01 | RFI on the headphones during TX | audio opamp share the same 12V supply as the PA | (not fixed yet) adding 100uF capacitor from emitter of Q6 to GND alleviates the issue, issue does not occur with constant amplitude SSB |
| R1.01 | ~~after pressing PTT or while tuning RX stops working, audio quality on TX also impacted~~ | ~~likely caused by an I2C speed that is too fast for si5351, reuslting in I2C transmission errors~~ | ~~(FIXED in R1.01a) I2C bus speed has been changed from 900kb/s to 600kb/s, and extensive voltage, CPU-timing and I2C relibility checks are done at startup~~ |
| R1.00 | in some cases degraded audio quality especially in local QSOs | analog operation of Q6 causes challenges with biasing, dynamic range, linearity and thermal-drift | FIXED in R1.01) change C31/C32 so that Q6 operates in digital mode and together with the more accurate signal processing of the new firmware, the IMD performance, carrier+side-band rejection and spectral purity has been improved considerably |
| R1.00 | crackling sounds and noise on TX | ATMEGA ADC is sensitive for noise and in some cases RF feedback worsen this | (FIXED in R1.01c) dynamic noise gating algorithm could be an effective way of mitigating the issue, adding additional inductor in series with mic in could help preventig RF feedback, increasing MIC_ATTEN value in code attentuates the audio input can put the noise below a threshold at the cost of audio sensitivity |
| R1.00 | in VOX mode TX constantly on when soundcard is connected to mic input | VOX is too sensitive and hence responds to the noise of the external device | (FIXED in R1.01c) reduce gain on audio input, e.g. by reducing the output level of the external device, adding a resistive divider in the audio line, increase the MIC_ATTEN value in code to attenuate the signal in software or increase VOX_THRESHOLD to make the VOX algorithm less sensitive, dynamic noise gating algorithm could be an effective way of mitigating the issue |
| R1.01 | RFI on the headphones during TX | audio opamp share the same 12V supply as the PA | (FIXED in R1.01c) performing ADC conversions before submitting envelope changes alleviate RFI issues; adding 100uF capacitor from emitter of Q6 to GND alleviates the issue, issue does not occur with constant amplitude SSB |
| R1.01 | after pressing PTT or while tuning RX stops working, audio quality on TX also impacted | likely caused by an I2C speed that is too fast for si5351, resulting in I2C transmission errors | FIXED in R1.01a) I2C bus speed has been changed from 900kb/s to 600kb/s, and extensive voltage, CPU-timing and I2C relibility checks are done at startup |
### Notes:
@ -198,6 +199,6 @@ Known issues:
[HD44780]: https://www.sparkfun.com/datasheets/LCD/HD44780.pdf
[sample]: https://youtu.be/Q6_BCqBZjZU
[sample]: https://youtu.be/-QfMQulk0eA