Merge branch 'master' into tinySA-V4-SI4463

Removed_REF_marker
erikkaashoek 5 years ago
commit 15cfc56ec9

@ -784,7 +784,7 @@ VNA_SHELL_FUNCTION(cmd_scanraw)
for (uint32_t i = 0; i<points; i++) { for (uint32_t i = 0; i<points; i++) {
int val = perform(false, i, start +(freq_t)(f_step * i), false) + float_TO_PURE_RSSI(EXT_ZERO_LEVEL); int val = perform(false, i, start +(freq_t)(f_step * i), false) + float_TO_PURE_RSSI(EXT_ZERO_LEVEL);
if (operation_requested) // break on operation in perform if (operation_requested && SDU1.config->usbp->state != USB_ACTIVE) // break on operation in perform
break; break;
streamPut(shell_stream, 'x'); streamPut(shell_stream, 'x');
streamPut(shell_stream, (uint8_t)(val & 0xFF)); streamPut(shell_stream, (uint8_t)(val & 0xFF));

@ -1789,10 +1789,12 @@ static freq_t spur_table[] = // Frequencies to
10960000, 10960000,
11600000, 11600000,
12960000, 12960000,
14933000,
14960000, 14960000,
16960000, 16960000,
18960000, 18960000,
21600000, 21600000,
// 22960000, // 22960000,
24960000, 24960000,
28960000, 28960000,
@ -2003,7 +2005,7 @@ pureRSSI_t perform(bool break_on_operation, int i, freq_t f, int tracking) /
} }
if (MODE_INPUT(setting.mode)) { if (MODE_INPUT(setting.mode)) {
calculate_static_correction(); calculate_static_correction();
clock_above_48MHz(); if (!in_selftest) clock_above_48MHz();
is_below = false; is_below = false;
} }
// if (MODE_OUTPUT(setting.mode) && setting.additional_step_delay_us < 500) // Minimum wait time to prevent LO from lockup during output frequency sweep // if (MODE_OUTPUT(setting.mode) && setting.additional_step_delay_us < 500) // Minimum wait time to prevent LO from lockup during output frequency sweep
@ -2417,6 +2419,37 @@ modulation_again:
#endif #endif
} }
#if 1 // No 72MHz spur avoidance yet
if (setting.mode == M_LOW && !in_selftest /* && !(SDU1.config->usbp->state == USB_ACTIVE) */ ) { // Avoid 72MHz spur
int set_below = false;
#ifdef TINYSA4
if (lf < 40000000) {
uint32_t tf = lf;
while (tf > 4000000) tf -= 4000000;
if (tf < 2000000 )
set_below = true;
} else
#endif
if (lf > 40000000){
uint32_t tf = lf;
while (tf > 48000000) tf -= 48000000;
if (tf < 20000000 )
set_below = true;
}
if (set_below) { // If below 48MHz
if (!is_below) {
clock_below_48MHz();
is_below = true;
}
} else {
if (is_below) {
clock_above_48MHz();
is_below = false;
}
}
}
#endif
// ----------- Set IF ------------------ // ----------- Set IF ------------------
if (local_IF != 0) // When not in one of the high modes if (local_IF != 0) // When not in one of the high modes
@ -3481,7 +3514,9 @@ const test_case_t test_case [] =
{TC_MEASURE, TPH_30MHZ, 300, 4, -48, 10, -65 }, // 14 Calibrate power high mode {TC_MEASURE, TPH_30MHZ, 300, 4, -48, 10, -65 }, // 14 Calibrate power high mode
{TC_MEASURE, TPH_30MHZ_SWITCH,300, 4, -40, 10, -65 }, // 14 Calibrate power high mode {TC_MEASURE, TPH_30MHZ_SWITCH,300, 4, -40, 10, -65 }, // 14 Calibrate power high mode
#define TEST_ATTEN 21 #define TEST_ATTEN 21
{TC_ATTEN, TP_30MHZ, 30, 0, -25, 145, -60 } // 20 Measure atten step accuracy {TC_ATTEN, TP_30MHZ, 30, 0, -25, 145, -60 }, // 20 Measure atten step accuracy
#define TEST_SPUR 22
{TC_BELOW, TP_SILENT, 144, 8, -95, 0, 0 }, // 22 Measure 48MHz spur
}; };
@ -4106,9 +4141,27 @@ void self_test(int test)
set_sweep_frequency(ST_SPAN, 0); set_sweep_frequency(ST_SPAN, 0);
break; break;
} }
in_selftest = false;
#endif #endif
} else if (test == 6) {
in_selftest = true; // Spur search
reset_settings(M_LOW);
test_prepare(TEST_SPUR);
setting.extra_lna = true;
for (int i = 0; i < 31; i++) {
hsical = (RCC->CR & 0xff00) >> 8;
RCC->CR &= RCC_CR_HSICAL;
RCC->CR |= ( (hsical) << 8 );
RCC->CR &= RCC_CR_HSITRIM | RCC_CR_HSION; /* CR Reset value. */
RCC->CR |= (i << 3 ) & RCC_CR_HSITRIM;
set_RBW(100);
test_acquire(TEST_SPUR); // Acquire test
shell_printf("%d: %9.3q\n\r",i, peakFreq);
test_validate(TEST_SPUR); // Validate test
}
} }
show_test_info = FALSE; show_test_info = FALSE;
in_selftest = false; in_selftest = false;
test_wait = false; test_wait = false;

Loading…
Cancel
Save

Powered by TurnKey Linux.