Added IQ corrections for hardware errors

pull/16/merge
boblark 2 years ago
parent 69a298f51d
commit b056dab06e
  1. 11
      radioCESSB_Z_transmit_F32.cpp
  2. 15
      radioCESSB_Z_transmit_F32.h

@ -228,6 +228,17 @@ void radioCESSB_Z_transmit_F32::update(void) {
countPower1++;
}
// Optional corrections to compensate for external hardware errors
if(useIQCorrection)
{
for(int k=0; k<nC; k++)
{
workingDataI[k] *= gainI;
workingDataI[k] += crossIQ*workingDataQ[k];
workingDataQ[k] += crossQI*workingDataI[k];
}
}
// Finally interpolate to 48 or 96 ksps. Data is in workingDataI[k]
// and is 64 samples for audio 48 ksps.
for(int k=0; k<nC; k++) // Audio sampling at 48 ksps: 0 to 63

@ -254,6 +254,16 @@ public:
gainOut = gOut;
}
// Small corrections at the output end of this object can patch up hardware flaws.
// _gI should be close to 1.0, _gXIQ and _gXQI should be close to 0.0.
void setIQCorrections(bool _useCor, float32_t _gI, float32_t _gXIQ, float32_t _gXQI)
{
useIQCorrection = _useCor;
gainI = _gI;
crossIQ = _gXIQ;
crossQI = _gXQI;
}
// The LSB/USB selection depends on the processing of the IQ signals
// inside this class. It may get flipped with later processing.
void setSideband(bool _sbReverse)
@ -279,6 +289,11 @@ private:
uint16_t block_length = 128;
bool sidebandReverse = false;
bool useIQCorrection = false;
float32_t gainI = 1.0f;
float32_t crossIQ = 0.0f;
float32_t crossQI = 0.0f;
float32_t pStateDecimate[128 + 65 - 1]; // Goes with CMSIS decimate function
arm_fir_decimate_instance_f32 decimateInst;

Loading…
Cancel
Save