Improved selftest 7

multi_trace
erikkaashoek 5 years ago
parent 5f13d6e097
commit b6822ab881

@ -1446,6 +1446,7 @@ extern bool ADF4351_frequency_changed;
extern bool SI4463_frequency_changed; extern bool SI4463_frequency_changed;
extern bool SI4463_offset_changed; extern bool SI4463_offset_changed;
extern int16_t SI4463_noise_correction_x10; extern int16_t SI4463_noise_correction_x10;
void switch_SI4463_RSSI_correction(bool);
extern int old_R; extern int old_R;
extern float Si446x_get_temp(void); extern float Si446x_get_temp(void);
#define ENBW_Hz SI4463_ENBW_Hz #define ENBW_Hz SI4463_ENBW_Hz

@ -4833,8 +4833,8 @@ const test_case_t test_case [] =
#define TEST_SPUR 23 #define TEST_SPUR 23
TEST_CASE_STRUCT(TC_BELOW, TP_SILENT, 144, 8, -95, 0, 0), // 22 Measure 48MHz spur TEST_CASE_STRUCT(TC_BELOW, TP_SILENT, 144, 8, -95, 0, 0), // 22 Measure 48MHz spur
#define TEST_LEVEL 24 #define TEST_LEVEL 24
TEST_CASE_STRUCT(TC_LEVEL, TP_30MHZ, 30.01, 0, CAL_LEVEL, 145, -55), // 23 Measure level TEST_CASE_STRUCT(TC_LEVEL, TP_30MHZ, 30.000, 0, CAL_LEVEL, 145, -55), // 23 Measure level
TEST_CASE_STRUCT(TC_LEVEL, TP_30MHZ_LNA, 30.01, 0, CAL_LEVEL, 145, -55), // 23 Measure level TEST_CASE_STRUCT(TC_LEVEL, TP_30MHZ_LNA, 30.000, 0, CAL_LEVEL, 145, -55), // 23 Measure level
TEST_CASE_STRUCT(TC_LEVEL, TPH_30MHZ, 150, 0, CAL_LEVEL-30, 145, -55), // 23 Measure level TEST_CASE_STRUCT(TC_LEVEL, TPH_30MHZ, 150, 0, CAL_LEVEL-30, 145, -55), // 23 Measure level
}; };
@ -5657,11 +5657,16 @@ quit:
shell_printf("%d: %9.3q\n\r",i, peakFreq); shell_printf("%d: %9.3q\n\r",i, peakFreq);
test_validate(TEST_SPUR); // Validate test test_validate(TEST_SPUR); // Validate test
} }
} else if (false && test == 7) { // RBW level test #ifdef TINYSA4
} else if (test == 7) { // RBW level test
in_selftest = true; in_selftest = true;
ui_mode_normal(); ui_mode_normal();
set_scale(2);
set_reflevel(-22);
shell_printf("\n\r"); shell_printf("\n\r");
float first_level=0; float first_level=-23.2;
setting.R = 3;
switch_SI4463_RSSI_correction(false);
for (int j= SI4432_RBW_count-1; j >= 0; j-- ) { for (int j= SI4432_RBW_count-1; j >= 0; j-- ) {
if (setting.test_argument != 0) if (setting.test_argument != 0)
j = setting.test_argument; j = setting.test_argument;
@ -5671,29 +5676,40 @@ quit:
setting.spur_removal = S_ON; setting.spur_removal = S_ON;
test_acquire(TEST_LEVEL); // Acquire test test_acquire(TEST_LEVEL); // Acquire test
test_validate(TEST_LEVEL); // Validate test test_validate(TEST_LEVEL); // Validate test
if (j == SI4432_RBW_count-1) // if (j == SI4432_RBW_count-1)
first_level = peakLevel; // 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 + 1.5)*10.0 ); 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) if (setting.test_argument != 0)
break; break;
} }
#if 0 // Does not center on frequency!!!!! #if 1 // Does not center on frequency!!!!!
shell_printf("\n\r");
for (int k = 0; k< 4; k++) {
shell_printf("\n\r%d ", k);
for (int j= SI4432_RBW_count-1; j >= 0; j-- ) { for (int j= SI4432_RBW_count-1; j >= 0; j-- ) {
if (setting.test_argument != 0) if (setting.test_argument != 0)
j = setting.test_argument; j = setting.test_argument;
test_prepare(TEST_LEVEL+2); test_prepare(TEST_RBW);
// setting.step_delay_mode = SD_PRECISE;
set_repeat(5);
setting.rbw_x10 = force_rbw(j); setting.rbw_x10 = force_rbw(j);
test_acquire(TEST_LEVEL+2); // Acquire test set_sweep_frequency(ST_SPAN, (freq_t)(setting.rbw_x10 * (1000 << k)));
test_validate(TEST_LEVEL+2); // Validate test test_acquire(TEST_RBW); // Acquire test
if (j == SI4432_RBW_count-1) test_validate(TEST_RBW); // Validate test
first_level = peakLevel; // if (j == SI4432_RBW_count-1)
shell_printf("RBW = %7.1fk, level = %6.2f, corr = %6.2f\n\r",actual_rbw_x10/10.0 , peakLevel, (first_level - peakLevel + 1.5)*10.0 ); // 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 );
shell_printf("%6.2f ", (first_level - peakLevel)*10.0 );
if (setting.test_argument != 0) if (setting.test_argument != 0)
break; break;
} }
}
#endif #endif
shell_printf("\n\r");
setting.R = 0;
switch_SI4463_RSSI_correction(true);
reset_settings(M_LOW); reset_settings(M_LOW);
#endif
} }
show_test_info = FALSE; show_test_info = FALSE;

@ -1360,7 +1360,7 @@ int16_t Si446x_RSSI(void)
// SI4463_WAIT_CTS; // Wait for CTS // SI4463_WAIT_CTS; // Wait for CTS
do{ do{
// if (MODE_INPUT(setting.mode) && RSSI_R // if (MODE_INPUT(setting.mode) && RSSI_R
#define SAMPLE_COUNT 1 #define SAMPLE_COUNT 3
int j = SAMPLE_COUNT; //setting.repeat; int j = SAMPLE_COUNT; //setting.repeat;
int RSSI_RAW_ARRAY[3]; int RSSI_RAW_ARRAY[3];
do{ do{
@ -1523,20 +1523,21 @@ typedef struct {
static const RBW_t RBW_choices[] = static const RBW_t RBW_choices[] =
{ {
// BW register corr freq // BW register corr freq
{SI4463_RBW_02kHz, 18,3,42}, {SI4463_RBW_02kHz, 16,3,42},
{SI4463_RBW_1kHz, 18,10,29}, {SI4463_RBW_1kHz, 20,10,29},
{SI4463_RBW_3kHz, 12,30,28}, {SI4463_RBW_3kHz, 15,30,28},
{SI4463_RBW_10kHz, 7,100,26}, {SI4463_RBW_10kHz, 5,100,26},
{SI4463_RBW_30kHz, 10,300,22}, {SI4463_RBW_30kHz, 11,300,22},
{SI4463_RBW_100kHz,2,1000,19}, {SI4463_RBW_100kHz,9,1000,19},
{SI4463_RBW_300kHz,2,3000,7}, {SI4463_RBW_300kHz,8,3000,5},
{SI4463_RBW_600kHz,3,6000,-1}, {SI4463_RBW_600kHz,9,6000,-1},
{SI4463_RBW_850kHz,12,8500,-9}, {SI4463_RBW_850kHz,19,8500,-9},
}; };
const uint8_t SI4432_RBW_count = ((int)(sizeof(RBW_choices)/sizeof(RBW_t))); const uint8_t SI4432_RBW_count = ((int)(sizeof(RBW_choices)/sizeof(RBW_t)));
static pureRSSI_t SI4463_RSSI_correction = float_TO_PURE_RSSI(-120); static pureRSSI_t SI4463_RSSI_correction = float_TO_PURE_RSSI(-120);
bool SI4463_RSSI_correction_enabled = true;
int16_t SI4463_noise_correction_x10; int16_t SI4463_noise_correction_x10;
static int prev_band = -1; static int prev_band = -1;
@ -1544,6 +1545,10 @@ pureRSSI_t getSI4463_RSSI_correction(void){
return SI4463_RSSI_correction; return SI4463_RSSI_correction;
}; };
void switch_SI4463_RSSI_correction(bool enabled){
SI4463_RSSI_correction_enabled = enabled;
};
uint16_t force_rbw(int f) uint16_t force_rbw(int f)
{ {
@ -1562,7 +1567,7 @@ uint16_t force_rbw(int f)
// SI4463_wait_for_cts(); // SI4463_wait_for_cts();
set_RSSI_comp(); set_RSSI_comp();
// prev_band = -1; // prev_band = -1;
SI4463_RSSI_correction = float_TO_PURE_RSSI(RBW_choices[f].RSSI_correction_x_10 - 1200)/10; // Set RSSI correction SI4463_RSSI_correction = ( SI4463_RSSI_correction_enabled ? float_TO_PURE_RSSI(RBW_choices[f].RSSI_correction_x_10 - 1200)/10 : float_TO_PURE_RSSI(-120) ) ; // Set RSSI correction
SI4463_noise_correction_x10 = RBW_choices[f].noise_correction_x10; SI4463_noise_correction_x10 = RBW_choices[f].noise_correction_x10;
return RBW_choices[f].RBWx10; // RBW achieved by SI4463 in kHz * 10 return RBW_choices[f].RBWx10; // RBW achieved by SI4463 in kHz * 10
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.