Update filter corrections

Speed-test
erikkaashoek 4 years ago
parent 77e606ca1f
commit fe5b3e1cb6

@ -915,14 +915,14 @@ config_t config = {
.high_level_output_offset = 0, // Uncalibrated, but checking code is not yet present
.correction_frequency =
{
{ 10000, 100000, 300000, 1000000, 30000000, 500000000, 750000000, 750000010, 1000000000, 1500000000, 1520000000, 2000000000, 2500000000, 3000000000, 3500000000, 4000000000, 4500000000, 5000000000, 5500000000, 6000000000 },
{ 10000, 100000, 300000, 1000000, 30000000, 500000000, 750000000, 750000010, 1000000000, 1500000000, 1520000000, 2000000000, 2500000000, 3000000000, 3500000000, 4000000000, 4500000000, 5000000000, 5500000000, 6000000000 },
{ 10000, 100000, 1000000, 5000000, 15000000, 30000000, 145000000, 400000000, 720000000, 800000000, 800000001, 1519000000, 1527000000, 3000000000, 3500000000, 4000000000, 4500000000, 5000000000, 5500000000, 6000000000 },
{ 10000, 100000, 1000000, 5000000, 15000000, 30000000, 145000000, 400000000, 720000000, 800000000, 800000001, 1519000000, 1527000000, 3000000000, 3500000000, 4000000000, 4500000000, 5000000000, 5500000000, 6000000000 },
{ 10000, 50000, 80000, 150000, 300000, 1000000, 5000000, 80000000, 100000000, 180000000, 650000000, 700000000, 760000000, 780000000, 790000000, 800000000, 800000000, 800000000, 800000000, 800000000},
},
.correction_value =
{
{ 10.5, +4.9, +1.6, +0.6, 0, 0, +2, +0, +2, +2, +2, +2, +3.5, +6.5, +6.5, +9, +9, +9, +11, +11,}, // low in
{ 10.5, +4.9, +1.6, +0.6, 0, 0, +2, +0, +2, +2, +2, +2, +6, +9, +11.5, +14.5, +23, +25, +36, +46,}, // LNA in
{ 10.5, +3.5, +1.9, +0.5, -0.8, 0, +0.7, +4.7, +5.7, +12.7, +6.8, +10.7, +8.3, +8.3, +8.3, +9, +9, +9, +11, +11,}, // low in
{ 10.5, +3.5, +1.9, +0.5, -0.8, 0, +0.7, +4.7, +5.7, +12.7, +6.8, +10.7, +8.3, +9, +11.5, +14.5, +23, +25, +36, +46,}, // LNA in
{ 11.5, 7, 6, 3.5, 1.5, 0.5, -0.2, 0, 0, -0.5, +1.5, +2, +4, +6.5, +9, +13, +13, +13, +13, +13, }, // low out
},
.setting_frequency_30mhz = 30000000ULL * FREQ_MULTIPLIER,
@ -2138,6 +2138,8 @@ static void shell_init_connection(void){
}
#endif
bool global_abort = false;
static const VNAShellCommand *VNAShell_parceLine(char *line){
// Parse and execute line
char *lp = line, *ep;
@ -2163,6 +2165,12 @@ static const VNAShellCommand *VNAShell_parceLine(char *line){
*lp++ = 0;
}
if (shell_nargs){
if (shell_args[0][0] == '.') {
global_abort = true;
return NULL;
}
global_abort = false;
const VNAShellCommand *scp;
for (scp = commands; scp->sc_name != NULL; scp++)
if (get_str_index(scp->sc_name, shell_args[0]) == 0)

@ -400,7 +400,7 @@ void set_measurement(int);
void sweep_remote(void);
void calculate_step_delay(void);
extern int generic_option_cmd( const char *cmd, const char *cmd_list, int argc, char *argv);
extern bool global_abort;
#ifdef __ULTRA__
void toggle_ultra(void);
void enable_ultra(int);

@ -967,6 +967,7 @@ VNA_SHELL_FUNCTION(cmd_correction)
float v = my_atof(argv[3]);
config.correction_frequency[m][i] = f;
config.correction_value[m][i] = v;
dirty = true; // recalculate intermediate table
redraw_request|=REDRAW_AREA; // to ensure the change in level will be visible
shell_printf("updated %d to %D %.1f\r\n", i, config.correction_frequency[m][i], config.correction_value[m][i]);
}

@ -601,8 +601,12 @@ void toggle_debug_avoid(void)
debug_avoid = !debug_avoid;
if (debug_avoid) {
TRACE_ENABLE(TRACE_STORED_FLAG|TRACE_TEMP_FLAG);
setting.stored[TRACE_STORED] = true;
setting.stored[TRACE_TEMP] = true;
} else {
TRACE_DISABLE(TRACE_STORED_FLAG|TRACE_TEMP_FLAG);
setting.stored[TRACE_STORED] = false;
setting.stored[TRACE_TEMP] = false;
}
dirty = true;
}
@ -612,8 +616,12 @@ void toggle_debug_spur(void)
debug_spur = !debug_spur;
if (debug_spur) {
TRACE_ENABLE(TRACE_STORED_FLAG|TRACE_TEMP_FLAG);
setting.stored[TRACE_STORED] = true;
setting.stored[TRACE_TEMP] = true;
} else {
TRACE_DISABLE(TRACE_STORED_FLAG|TRACE_TEMP_FLAG);
setting.stored[TRACE_STORED] = false;
setting.stored[TRACE_TEMP] = false;
}
dirty = true;
}
@ -1744,7 +1752,7 @@ pureRSSI_t get_frequency_correction(freq_t f) // Frequency dependent RSSI c
if (setting.mode == M_LOW && ultra && f > ultra_threshold) {
if ( f > ULTRA_MAX_FREQ) {
#ifdef TINYSA4
cv += float_TO_PURE_RSSI(9); // +9dB correction.
cv += float_TO_PURE_RSSI(0); // +9dB correction.
#else
cv += float_TO_PURE_RSSI(13.5); // +dB correction. TODO !!!!!!!!!!!!!!!!!
#endif
@ -3526,7 +3534,7 @@ again: // Spur redu
if (setting.mode == M_GENLOW) {
if (local_modulo == 0) ADF4351_modulo(1000);
ADF4351_R_counter(3);
} else if ( ( (lf > 8000000 && lf < 700000000) || (lf > 500000000 && lf < 520000000) ) /* && lf >= TXCO_DIV3 */ && MODE_INPUT(setting.mode)) {
} else if ( ( (lf > 8000000 && lf < 800000000) || (lf > 500000000 && lf < 520000000) ) /* && lf >= TXCO_DIV3 */ && MODE_INPUT(setting.mode)) {
#if 0
if (local_modulo == 0) {
if (actual_rbw_x10 >= 3000)
@ -5182,19 +5190,19 @@ const test_case_t test_case [] =
#ifdef TINYSA4
{// Condition Preparation Center Span Pass Width(%)Stop
TEST_CASE_STRUCT(TC_BELOW, TP_SILENT, 0.06, 0.11, -30, 0, -30), // 1 Zero Hz leakage
TEST_CASE_STRUCT(TC_BELOW, TP_SILENT, 0.1, 0.1, -70, 0, 0), // 2 Phase noise of zero Hz
TEST_CASE_STRUCT(TC_SIGNAL, TP_30MHZ, 30, 1, -23, 10, -85), // 3
TEST_CASE_STRUCT(TC_BELOW, TP_SILENT, 0.1, 0.1, -60, 0, 0), // 2 Phase noise of zero Hz
TEST_CASE_STRUCT(TC_SIGNAL, TP_30MHZ, 30, 1, CAL_LEVEL, 10, -85), // 3
TEST_CASE_STRUCT(TC_SIGNAL, TP_30MHZ_ULTRA, 900, 1, -75, 10, -85), // 4 Test Ultra mode
#define TEST_SILENCE 4
TEST_CASE_STRUCT(TC_BELOW, TP_SILENT, 200, 100, -70, 0, 0), // 5 Wide band noise floor low mode
TEST_CASE_STRUCT(TC_BELOW, TPH_SILENT, 633, 994, -85, 0, 0), // 6 Wide band noise floor high mode
TEST_CASE_STRUCT(TC_SIGNAL, TP_10MHZEXTRA, 30, 14, CAL_LEVEL, 27, -45), // 7 BPF loss and stop band
TEST_CASE_STRUCT(TC_FLAT, TP_10MHZEXTRA, 30, 14, -18, 9, -60), // 8 BPF pass band flatness
TEST_CASE_STRUCT(TC_BELOW, TP_30MHZ, 900, 1, -90, 0, -90), // 9 LPF cutoff
TEST_CASE_STRUCT(TC_SIGNAL, TP_30MHZ_SWITCH,30, 7, -23, 10, -50), // 10 Switch isolation using high attenuation
TEST_CASE_STRUCT(TC_DISPLAY, TP_30MHZ, 30, 0, -25, 50, -60), // 11 test display
TEST_CASE_STRUCT(TC_BELOW, TP_30MHZ, 880, 1, -100, 0, -100), // 9 LPF cutoff
TEST_CASE_STRUCT(TC_SIGNAL, TP_30MHZ_SWITCH,30, 7, CAL_LEVEL, 10, -50), // 10 Switch isolation using high attenuation
TEST_CASE_STRUCT(TC_DISPLAY, TP_30MHZ, 30, 0, CAL_LEVEL, 50, -60), // 11 test display
TEST_CASE_STRUCT(TC_ATTEN, TP_30MHZ, 30, 0, CAL_LEVEL, 50, -60), // 12 Measure atten step accuracy
TEST_CASE_STRUCT(TC_SIGNAL, TP_30MHZ_LNA, 30, 5, -23, 10, -75), // 13 Measure LNA
TEST_CASE_STRUCT(TC_SIGNAL, TP_30MHZ_LNA, 30, 5, CAL_LEVEL, 10, -75), // 13 Measure LNA
#define TEST_END 13
TEST_CASE_STRUCT(TC_END, 0, 0, 0, 0, 0, 0),
#define TEST_POWER 14
@ -5208,7 +5216,7 @@ const test_case_t test_case [] =
TEST_CASE_STRUCT(TC_MEASURE, TPH_30MHZ, 300, 4, -48, 10, -65), // 14 Calibrate power high mode
TEST_CASE_STRUCT(TC_MEASURE, TPH_30MHZ_SWITCH,300, 4, -40, 10, -65), // 14 Calibrate power high mode
#define TEST_ATTEN 22
TEST_CASE_STRUCT(TC_ATTEN, TP_30MHZ, 30, 0, -25, 50, -60), // 20 Measure atten step accuracy
TEST_CASE_STRUCT(TC_ATTEN, TP_30MHZ, 30, 0, CAL_LEVEL, 50, -60), // 20 Measure atten step accuracy
#define TEST_SPUR 23
TEST_CASE_STRUCT(TC_BELOW, TP_SILENT, 144, 8, -95, 0, 0), // 22 Measure 48MHz spur
#define TEST_LEVEL 24
@ -5797,14 +5805,16 @@ quit:
set_RBW(setting.frequency_step/100);
last_spur = 0;
for (int j = 0; j < 4; j++) {
int k=0;
p2 = PURE_TO_float(perform(false, 0, f, false));
vbwSteps = 1;
f += setting.frequency_step;
p1 = PURE_TO_float(perform(false, 1, f, false));
f += setting.frequency_step;
shell_printf("\n\rStarting with %4.2f, %4.2f and IF at %D and step of %D\n\r", p2, p1, setting.frequency_IF, setting.frequency_step );
while (f < DEFAULT_MAX_FREQ) {
while (f < DEFAULT_MAX_FREQ && !global_abort) {
if ((k++ % 1000) == 0)
shell_printf("Pass %d, freq %D\n\r", j, f);
int r = 0;
do {
p = PURE_TO_float(perform(false, 1, f, false));
@ -5817,7 +5827,7 @@ quit:
// if ( p2 < p1 - SPUR_DELTA && p < p1 - SPUR_DELTA) {
} while ( p2 < p - SPUR_DELTA && r++ < 4);
if (r >= 4) {
shell_printf("Spur of %4.2f at %D with count %d\n\r", p,f/1000, add_spur(f));
shell_printf("Pass %d, spur of %4.2f at %D with count %d\n\r", j, p,f/1000, add_spur(f));
}
p2 = (p2*9+p1)/10;
p1 = p;
@ -5826,7 +5836,7 @@ quit:
}
shell_printf("\n\rTable for IF at %d and step of %d\n\r", setting.frequency_IF, setting.frequency_step);
for (int j = 0; j < last_spur; j++) {
if ((int)stored_t[j] > 1)
if ((int)stored_t[j] >= 1)
shell_printf("%d, %d\n\r", ((int)temp_t[j])/1000, (int)stored_t[j]);
}
reset_settings(M_LOW);
@ -6061,14 +6071,15 @@ quit:
}
#ifdef TINYSA4
} else if (test == 7) { // RBW level test, param -1 keeps correction
int arg = setting.test_argument;
in_selftest = true;
ui_mode_normal();
set_scale(2);
set_reflevel(-22);
shell_printf("\n\r");
float first_level=-23.5;
float first_level=-35.0;
// setting.R = 3;
if (setting.test_argument < 0) {
if (arg == -1) {
switch_SI4463_RSSI_correction(false);
setting.test_argument = 0;
}
@ -6087,14 +6098,13 @@ quit:
test_acquire(TEST_LEVEL); // Acquire test
test_acquire(TEST_LEVEL); // Acquire test
test_validate(TEST_LEVEL); // Validate test
// if (j == SI4432_RBW_count-1)
// first_level = peakLevel;
if (j == SI4432_RBW_count-1)
first_level = peakLevel;
shell_printf("RBW = %7.1fk, level = %6.2f, corr = %6.2f\n\r",actual_rbw_x10/10.0 , peakLevel, (first_level - peakLevel)*10.0 );
if (setting.test_argument != 0)
break;
}
#if 1 // Does not center on frequency!!!!!
#if 1
for (int k = 0; k< 4; k++) {
shell_printf("\n\r%d ", k);
for (int j= SI4432_RBW_count-1; j >= 0; j-- ) {

@ -1597,7 +1597,8 @@ typedef struct {
static const RBW_t RBW_choices[] =
{
// BW register corr freq
#if 0
// BW register corr freq
{SI4463_RBW_02kHz, 20,3, 26},
{SI4463_RBW_1kHz, 23,10, 8},
{SI4463_RBW_3kHz, 17,30, 9},
@ -1607,6 +1608,17 @@ static const RBW_t RBW_choices[] =
{SI4463_RBW_300kHz, 4,3000, 10},
{SI4463_RBW_600kHz, -10,6000, 8},
{SI4463_RBW_850kHz, -9,8500, 8},
#else
{SI4463_RBW_02kHz, 15,3, 26},
{SI4463_RBW_1kHz, 15,10, 11},
{SI4463_RBW_3kHz, 10,30, 11},
{SI4463_RBW_10kHz, 10,100, 10},
{SI4463_RBW_30kHz, 10,300, 10},
{SI4463_RBW_100kHz, -2,1000, 21},
{SI4463_RBW_300kHz, 10,3000, 13},
{SI4463_RBW_600kHz, 25, 6000, 8},
{SI4463_RBW_850kHz, 20,8500, 18},
#endif
};
const uint8_t SI4432_RBW_count = ((int)(sizeof(RBW_choices)/sizeof(RBW_t)));

Loading…
Cancel
Save

Powered by TurnKey Linux.