diff --git a/sa_core.c b/sa_core.c index b1a7325..d42dfd1 100644 --- a/sa_core.c +++ b/sa_core.c @@ -3939,7 +3939,10 @@ enum { }; enum { - TP_SILENT, TPH_SILENT, TP_10MHZ, TP_10MHZEXTRA, TP_10MHZ_SWITCH, TP_30MHZ, TPH_30MHZ, TPH_30MHZ_SWITCH + TP_SILENT, TPH_SILENT, TP_10MHZ, TP_10MHZEXTRA, TP_10MHZ_SWITCH, TP_30MHZ, TPH_30MHZ, TPH_30MHZ_SWITCH, +#ifdef TINYSA4 + TP_30MHZ_ULTRA, TP_30MHZ_LNA, +#endif }; #define TEST_COUNT (sizeof test_case / sizeof test_case[0]) @@ -3947,7 +3950,7 @@ enum { #define W2P(w) (sweep_points * w / 100) // convert width in % to actual sweep points #ifdef TINYSA4 -#define CAL_LEVEL -29.5 +#define CAL_LEVEL -23.5 #else #define CAL_LEVEL (has_esd ? -26.2 : -25) #endif @@ -3969,34 +3972,35 @@ typedef struct test_case { const test_case_t test_case [] = #ifdef TINYSA4 {// Condition Preparation Center Span Pass Width(%)Stop - TEST_CASE_STRUCT(TC_BELOW, TP_SILENT, 0.005, 0.01, 0, 0, 0), // 1 Zero Hz leakage - TEST_CASE_STRUCT(TC_BELOW, TP_SILENT, 0.015, 0.01, -30, 0, 0), // 2 Phase noise of zero Hz - TEST_CASE_STRUCT(TC_SIGNAL, TP_30MHZ, 30, 7, -30, 10, -90), // 3 - TEST_CASE_STRUCT(TC_SIGNAL, TP_30MHZ, 60, 7, -70, 10, -90), // 4 + TEST_CASE_STRUCT(TC_BELOW, TP_SILENT, 0.05, 0.1, -10, 0, 0), // 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_SIGNAL, TP_30MHZ_ULTRA, 900, 1, -75, 10, -85), // 4 #define TEST_SILENCE 4 - TEST_CASE_STRUCT(TC_BELOW, TP_SILENT, 200, 100, -75, 0, 0), // 5 Wide band noise floor low mode - TEST_CASE_STRUCT(TC_BELOW, TPH_SILENT, 600, 720, -75, 0, 0), // 6 Wide band noise floor high mode - TEST_CASE_STRUCT(TC_SIGNAL, TP_10MHZEXTRA, 30, 14, -20, 27, -80), // 7 BPF loss and stop band + 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, -20, 27, -70), // 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, 400, 60, -75, 0, -75), // 9 LPF cutoff - TEST_CASE_STRUCT(TC_SIGNAL, TP_10MHZ_SWITCH,20, 7, -39, 10, -60), // 10 Switch isolation using high attenuation - TEST_CASE_STRUCT(TC_DISPLAY, TP_30MHZ, 30, 0, -25, 145, -60), // 11 Measure atten step accuracy + TEST_CASE_STRUCT(TC_BELOW, TP_30MHZ, 900, 1, -90, 0, -90), // 9 LPF cutoff + TEST_CASE_STRUCT(TC_SIGNAL, TP_10MHZ_SWITCH,20, 7, -29, 10, -50), // 10 Switch isolation using high attenuation + TEST_CASE_STRUCT(TC_DISPLAY, TP_30MHZ, 30, 0, -25, 145, -60), // 11 test display TEST_CASE_STRUCT(TC_ATTEN, TP_30MHZ, 30, 0, CAL_LEVEL, 145, -60), // 12 Measure atten step accuracy -#define TEST_END 12 + TEST_CASE_STRUCT(TC_SIGNAL, TP_30MHZ_LNA, 30, 5, -23, 10, -75), // 13 Measure LNA +#define TEST_END 13 TEST_CASE_STRUCT(TC_END, 0, 0, 0, 0, 0, 0), -#define TEST_POWER 13 +#define TEST_POWER 14 TEST_CASE_STRUCT(TC_MEASURE, TP_30MHZ, 30, 7, CAL_LEVEL, 10, -55), // 12 Measure power level and noise TEST_CASE_STRUCT(TC_MEASURE, TP_30MHZ, 270, 4, -50, 10, -75), // 13 Measure powerlevel and noise TEST_CASE_STRUCT(TC_MEASURE, TPH_30MHZ, 270, 4, -40, 10, -65), // 14 Calibrate power high mode TEST_CASE_STRUCT(TC_END, 0, 0, 0, 0, 0, 0), -#define TEST_RBW 17 +#define TEST_RBW 18 TEST_CASE_STRUCT(TC_MEASURE, TP_30MHZ, 30, 1, CAL_LEVEL, 10, -60), // 16 Measure RBW step time TEST_CASE_STRUCT(TC_END, 0, 0, 0, 0, 0, 0), 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 21 +#define TEST_ATTEN 22 TEST_CASE_STRUCT(TC_ATTEN, TP_30MHZ, 30, 0, -25, 145, -60), // 20 Measure atten step accuracy -#define TEST_SPUR 22 +#define TEST_SPUR 23 TEST_CASE_STRUCT(TC_BELOW, TP_SILENT, 144, 8, -95, 0, 0), // 22 Measure 48MHz spur }; #else @@ -4116,7 +4120,7 @@ int validate_signal_within(int i, float margin) markers[0].index = (markers[2].index + markers[1].index)/2; } test_fail_cause[i] = "Frequency "; - if (peakFreq < test_case[i].center * 1000000 - 100000 || test_case[i].center * 1000000 + 100000 < peakFreq ) + if (peakFreq < test_case[i].center * 1000000 - 400000 || test_case[i].center * 1000000 + 400000 < peakFreq ) return TS_FAIL; test_fail_cause[i] = ""; return TS_PASS; @@ -4327,6 +4331,9 @@ void test_prepare(int i) setting.atten_step = false; #ifdef TINYSA4 setting.frequency_IF = config.frequency_IF1; // Default frequency + config.ultra = true; + config.ultra_threshold = 2000000000; + setting.extra_lna = false; #else setting.frequency_IF = DEFAULT_IF; // Default frequency #endif @@ -4389,9 +4396,13 @@ common_silent: for (int j = setting._sweep_points/2 - W2P(test_case[i].width); j < setting._sweep_points/2 + W2P(test_case[i].width); j++) stored_t[j] = test_case[i].pass; break; +#ifdef TINYSA4 + case TP_30MHZ_ULTRA: + case TP_30MHZ_LNA: +#endif case TP_30MHZ: set_mode(M_LOW); - maxFreq = 520000000; // needed to measure the LPF rejection + maxFreq = 2000000000; // needed to measure the LPF rejection set_refer_output(0); dirty = true; // set_step_delay(1); // Do not set !!!!! @@ -4408,6 +4419,15 @@ common_silent: goto common; } switch(test_case[i].setup) { // Prepare test conditions +#ifdef TINYSA4 + case TP_30MHZ_ULTRA: + config.ultra_threshold = 0; + break; + case TP_30MHZ_LNA: + setting.extra_lna = true; + chThdSleepMilliseconds(200); + break; +#endif case TP_10MHZ_SWITCH: set_attenuation(32); // This forces the switch to transmit so isolation can be tested break; @@ -4505,6 +4525,12 @@ void self_test(int test) sweep_mode = SWEEP_ENABLE; ili9341_clear_screen(); +#ifdef TINYSA4 + config_recall(); + config.cor_am = 0; + config.cor_nfm = 0; + config.cor_wfm = 0; +#endif reset_settings(M_LOW); set_refer_output(-1); #ifdef TINYSA4 diff --git a/si4468.c b/si4468.c index ff2fa5c..4f55478 100644 --- a/si4468.c +++ b/si4468.c @@ -2364,7 +2364,7 @@ static const RBW_t RBW_choices[] = {SI4463_RBW_30kHz, 0,300}, {SI4463_RBW_100kHz,0,1000}, {SI4463_RBW_300kHz,0,3000}, - {SI4463_RBW_850kHz,0,6000}, + {SI4463_RBW_850kHz,0,8500}, }; const uint8_t SI4432_RBW_count = ((int)(sizeof(RBW_choices)/sizeof(RBW_t))); diff --git a/ui_sa.c b/ui_sa.c index 097f614..d74c66b 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -1010,15 +1010,18 @@ static UI_FUNCTION_ADV_CALLBACK(menu_measure_acb) markers[i].mtype = M_DELTA;// | M_TRACKING; #endif } - freq_t center, span; #ifdef TINYSA4 + freq_t span; markers[0].mtype = M_REFERENCE | M_TRACKING; #else + freq_t center, span; markers[0].mtype = M_REFERENCE;// | M_TRACKING; #endif kp_help_text = "Frequency of signal"; ui_mode_keypad(KM_CENTER); +#ifdef TINYSA3 center = uistat.value; +#endif kp_help_text = "Modulation frequency: 3 .. 10kHz"; ui_mode_keypad(KM_SPAN); // if (uistat.value < 3000) @@ -1286,8 +1289,8 @@ static UI_FUNCTION_CALLBACK(menu_limit_disable_cb) #endif #ifdef TINYSA4 -static const uint16_t rbwsel_x10[]={0,3,10,30,100,300,1000,3000,6000}; -static const char* rbwsel_text[]={"auto","300","1k","3k","10k","30k","100k","300k","600k"}; +static const uint16_t rbwsel_x10[]={0,3,10,30,100,300,1000,3000,8500}; +static const char* rbwsel_text[]={"auto","300","1k","3k","10k","30k","100k","300k","850k"}; #else static const uint16_t rbwsel_x10[]={0,30,100,300,1000,3000,6000}; #endif