diff --git a/sa_core.c b/sa_core.c index 983e17d..ad23d26 100644 --- a/sa_core.c +++ b/sa_core.c @@ -3062,33 +3062,42 @@ void self_test(int test) for (int j= 0; j < 57; j++ ) { if (setting.test_argument != 0) j = setting.test_argument; -do_again: +// do_again: test_prepare(i); setting.spur = 0; +#if 1 // Disable for offset baseline scanning setting.step_delay_mode = SD_NORMAL; + setting.repeat = 1; +#else + setting.step_delay_mode = SD_FAST; + setting.repeat = 20; +#endif setting.step_delay = setting.step_delay * 5 / 4; + setting.offset_delay = setting.step_delay / 2; setting.rbw_x10 = SI4432_force_RBW(j); shell_printf("RBW = %f, ",setting.rbw_x10/10.0); +#if 0 + set_sweep_frequency(ST_SPAN, (uint32_t)(setting.rbw_x10 * 1000)); // Wide +#else if (setting.rbw_x10 < 1000) - set_sweep_frequency(ST_SPAN, (uint32_t)(setting.rbw_x10 * 5000)); + set_sweep_frequency(ST_SPAN, (uint32_t)(setting.rbw_x10 * 5000)); // Narrow else set_sweep_frequency(ST_SPAN, (uint32_t)(18000000)); - -// setting.repeat = 10; +#endif test_acquire(i); // Acquire test test_validate(i); // Validate test - if (test_value == 0) { - setting.step_delay = setting.step_delay * 4 / 5; - goto do_again; - } +// if (test_value == 0) { +// setting.step_delay = setting.step_delay * 4 / 5; +// goto do_again; +// } float saved_peakLevel = peakLevel; // if (peakLevel < -35) { // shell_printf("Peak level too low, abort\n\r"); // return; // } -#if 1 shell_printf("Start level = %f, ",peakLevel); +#if 1 // Enable for step delay tuning while (setting.step_delay > 10 && test_value != 0 && test_value > saved_peakLevel - 0.5) { test_prepare(i); setting.spur = 0; @@ -3111,6 +3120,7 @@ do_again: #endif setting.offset_delay = 1600; +#if 1 // Enable for offset tuning stepping test_value = saved_peakLevel; if ((uint32_t)(setting.rbw_x10 * 1000) / (sweep_points) < 8000) { // fast mode possible while (setting.offset_delay > 0 && test_value != 0 && test_value > saved_peakLevel - 1.5) { @@ -3128,7 +3138,7 @@ do_again: // shell_printf(" Step %f, %d",peakLevel, setting.step_delay); } } - +#endif shell_printf("End level = %f, step time = %d, fast delay = %d\n\r",peakLevel, setting.step_delay, setting.offset_delay*2); if (setting.test_argument != 0) break; diff --git a/si4432.c b/si4432.c index ec99b3b..d421554 100644 --- a/si4432.c +++ b/si4432.c @@ -243,63 +243,65 @@ typedef struct { static RBW_t RBW_choices[] = { // BW register corr freq - {IF_BW(0,5, 1), -5, 26}, // RBW 2.6 kHz - {IF_BW(0,5, 2), -5, 28}, - {IF_BW(0,5, 3), 0, 31}, - {IF_BW(0,5, 4), 0, 32}, - {IF_BW(0,5, 5), 0, 37}, - {IF_BW(0,5, 6), 0, 42}, - {IF_BW(0,5, 7), 5, 45}, - {IF_BW(0,4, 1), 5, 49}, - {IF_BW(0,4, 2), -5, 54}, - {IF_BW(0,4, 3), -5, 59}, - {IF_BW(0,4, 4), -5, 61}, - {IF_BW(0,4, 5), 0, 72}, - {IF_BW(0,4, 6), 0, 82}, - {IF_BW(0,4, 7), -5, 88}, - {IF_BW(0,3, 1), 0, 95}, - {IF_BW(0,3, 2), 0, 106}, - {IF_BW(0,3, 3), 0, 115}, - {IF_BW(0,3, 4), -5, 121}, - {IF_BW(0,3, 5), 0, 142}, - {IF_BW(0,3, 6), 0, 162}, - {IF_BW(0,3, 7), 0, 175}, - {IF_BW(0,2, 1), 0, 189}, - {IF_BW(0,2, 2), -5, 210}, - {IF_BW(0,2, 3), 0, 227}, - {IF_BW(0,2, 4), -5, 240}, - {IF_BW(0,2, 5), 0, 282}, - {IF_BW(0,2, 6), 0, 322}, - {IF_BW(0,2, 7), 0, 347}, - {IF_BW(0,1, 1), 0, 377}, - {IF_BW(0,1, 2), -5, 417}, - {IF_BW(0,1, 3), 0, 452}, - {IF_BW(0,1, 4), -5, 479}, - {IF_BW(0,1, 5), 0, 562}, - {IF_BW(0,1, 6), 0, 641}, - {IF_BW(0,1, 7), 0, 692}, - {IF_BW(0,0, 1), -5, 752}, - {IF_BW(0,0, 2), -5, 832}, - {IF_BW(0,0, 3), 0, 900}, - {IF_BW(0,0, 4), -5, 953}, - {IF_BW(0,0, 5), 0, 1121}, - {IF_BW(0,0, 6), 0, 1279}, - {IF_BW(0,0, 7), 0, 1379}, - {IF_BW(1,1, 4), 15, 1428}, - {IF_BW(1,1, 5), 20, 1678}, - {IF_BW(1,1, 9), -55, 1811}, - {IF_BW(1,0,15), -105, 1915}, - {IF_BW(1,0, 1), 15, 2251}, - {IF_BW(1,0, 2), 20, 2488}, - {IF_BW(1,0, 3), 20, 2693}, - {IF_BW(1,0, 4), 15, 2849}, - {IF_BW(1,0, 8), -15, 3355}, - {IF_BW(1,0, 9), -55, 3618}, - {IF_BW(1,0,10), -15, 4202}, - {IF_BW(1,0,11), -15, 4684}, - {IF_BW(1,0,12), -20, 5188}, - {IF_BW(1,0,13), -15, 5770}, - {IF_BW(1,0,14), -10, 6207} + {IF_BW(0,5,1),0,26}, + {IF_BW(0,5,2),0,28}, + {IF_BW(0,5,3),3,31}, + {IF_BW(0,5,4),-3,32}, + {IF_BW(0,5,5),6,37}, + {IF_BW(0,5,6),5,42}, + {IF_BW(0,5,7),5,45}, + {IF_BW(0,4,1),0,49}, + {IF_BW(0,4,2),0,54}, + {IF_BW(0,4,3),0,59}, + {IF_BW(0,4,4),0,61}, + {IF_BW(0,4,5),5,72}, + {IF_BW(0,4,6),5,82}, + {IF_BW(0,4,7),5,88}, + {IF_BW(0,3,1),0,95}, + {IF_BW(0,3,2),0,106}, + {IF_BW(0,3,3),2,115}, + {IF_BW(0,3,4),0,121}, + {IF_BW(0,3,5),5,142}, + {IF_BW(0,3,6),5,162}, + {IF_BW(0,3,7),5,175}, + {IF_BW(0,2,1),0,189}, + {IF_BW(0,2,2),0,210}, + {IF_BW(0,2,3),3,227}, + {IF_BW(0,2,4),0,240}, + {IF_BW(0,2,5),5,282}, + {IF_BW(0,2,6),5,322}, + {IF_BW(0,2,7),5,347}, + {IF_BW(0,1,1),0,377}, + {IF_BW(0,1,2),0,417}, + {IF_BW(0,1,3),1,452}, + {IF_BW(0,1,4),0,479}, + {IF_BW(0,1,5),5,562}, + {IF_BW(0,1,6),5,641}, + {IF_BW(0,1,7),5,692}, + {IF_BW(0,0,1),0,752}, + {IF_BW(0,0,2),0,832}, + {IF_BW(0,0,3),0,900}, + {IF_BW(0,0,4),-1,953}, + {IF_BW(0,0,5),9,1121}, + {IF_BW(0,0,6),2,1279}, + {IF_BW(0,0,7),5,1379}, + {IF_BW(1,1,4),20,1428}, + {IF_BW(1,1,5),26,1678}, + {IF_BW(1,1,9),-50,1811}, + {IF_BW(1,0,15),-100,1915}, + {IF_BW(1,0,1),20,2251}, + {IF_BW(1,0,2),22,2488}, + {IF_BW(1,0,3),21,2693}, + {IF_BW(1,0,4),15,2849}, + {IF_BW(1,0,8),-15,3355}, + {IF_BW(1,0,9),-53,3618}, + {IF_BW(1,0,10),-15,4202}, + {IF_BW(1,0,11),-13,4684}, + {IF_BW(1,0,12),-20,5188}, + {IF_BW(1,0,13),-14,5770}, + {IF_BW(1,0,14),-9,6207}, + + }; static pureRSSI_t SI4432_RSSI_correction = float_TO_PURE_RSSI(-120); @@ -308,6 +310,7 @@ uint16_t SI4432_force_RBW(int i) { SI4432_Write_Byte(SI4432_IF_FILTER_BW, RBW_choices[i].reg); // Write RBW settings to Si4432 SI4432_RSSI_correction = float_TO_PURE_RSSI(RBW_choices[i].RSSI_correction_x_10 - 1200)/10; // Set RSSI correction +// SI4432_RSSI_correction = float_TO_PURE_RSSI( - 1200)/10; // Set RSSI correction return RBW_choices[i].RBWx10; // RBW achieved by Si4432 in kHz * 10 }