From 035a72e062a80bd7c794dfbfeac00d31fe603e6b Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Sat, 18 Jun 2022 08:54:18 +0200 Subject: [PATCH] Improved square output accuracy --- sa_core.c | 9 ++++----- si4468.c | 7 ++++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sa_core.c b/sa_core.c index 5841cbd..2fd2e7e 100644 --- a/sa_core.c +++ b/sa_core.c @@ -112,7 +112,7 @@ int actual_drive = -1; #ifdef TINYSA4 const float si_drive_dBm [] = {-44.1, -30, -21.6, -17, -14, -11.7, -9.9, -8.4, -7.1, -6, -5, -4.2, -3.4, -2.7 , -2.1, -1.5, -1, -0.47, 0}; -const float adf_drive_dBm[] = {-13.5,-9,-4.5, 0}; +const float adf_drive_dBm[] = {-13,-8.5,-4.2, 0}; const uint8_t drive_register[] = {0, 1, 2, 3, 4, 5, 6, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18}; float *drive_dBm = (float *) si_drive_dBm; const int min_drive = 0; @@ -228,11 +228,11 @@ void set_output_path(freq_t f, float level) if (signal_path == PATH_HIGH) { return; //TODO setup high path } - level += 3.0; // Always 3dB in attenuator + if (signal_path != PATH_LEAKAGE) level += 3.0; // Always 3dB in attenuator float switch_atten = SWITCH_ATTENUATION; if (signal_path == PATH_LEAKAGE) - switch_atten = 40.0; + switch_atten = 44.0; int very_low_flag = false; float a = level - level_max(); // convert to all settings maximum power output equals a = zero if (a < -switch_atten) { @@ -267,7 +267,7 @@ void set_output_path(freq_t f, float level) } a -= blw; set_output_drive(d); - a -= 3.0; // Always at least 3dB attenuation + if (signal_path != PATH_LEAKAGE) a -= 3.0; // Always at least 3dB attenuation if (a > 0) { a = 0; if (!level_error) redraw_request |= REDRAW_CAL_STATUS; @@ -359,7 +359,6 @@ void set_input_path(freq_t f) case PATH_DIRECT: enable_ADF_output(false, false); enable_ultra(!setting.atten_step); - enable_direct(true); enable_high(true); goto common2; case PATH_ULTRA: diff --git a/si4468.c b/si4468.c index 87fb6ab..5015e8d 100644 --- a/si4468.c +++ b/si4468.c @@ -634,8 +634,7 @@ void ADF4351_enable(int s) else bitSet(registers[4], 11); ADF4351_Set(0); - if (s) - osalThreadSleepMilliseconds(2); + osalThreadSleepMilliseconds(10); } @@ -648,6 +647,7 @@ void ADF4351_enable_aux_out(int s) else bitClear(registers[4], 8); ADF4351_Set(0); + osalThreadSleepMilliseconds(10); } void ADF4351_enable_out(int s) @@ -664,6 +664,7 @@ void ADF4351_enable_out(int s) bitSet(registers[4], 11); // Enable VCO power down } ADF4351_Set(0); + osalThreadSleepMilliseconds(1); } @@ -2046,7 +2047,7 @@ static int old_high = 2; void enable_ADF_output(int f, int t) { - ADF4351_enable(f); + ADF4351_enable(true); ADF4351_enable_out(f); ADF4351_enable_aux_out(t); }