Fast tune working

Removed_REF_marker
erikkaashoek 5 years ago
parent efe18e0baf
commit bc2b27d2f0

@ -71,8 +71,13 @@ void update_min_max_freq(void)
maxFreq = HIGH_MAX_FREQ_MHZ * 1000000; maxFreq = HIGH_MAX_FREQ_MHZ * 1000000;
break; break;
case M_GENHIGH: case M_GENHIGH:
#if 0
minFreq = 135000000; minFreq = 135000000;
maxFreq = 4290000000U; maxFreq = 4290000000U;
#else
minFreq = 850000000;
maxFreq = 1150000000U;
#endif
break; break;
} }
} }
@ -174,7 +179,7 @@ void reset_settings(int m)
break; break;
case M_GENHIGH: case M_GENHIGH:
setting.lo_drive=1; setting.lo_drive=1;
set_sweep_frequency(ST_CENTER, 300000000); set_sweep_frequency(ST_CENTER, (minFreq + maxFreq)/2 );
set_sweep_frequency(ST_SPAN, 0); set_sweep_frequency(ST_SPAN, 0);
setting.sweep_time_us = 10*ONE_SECOND_TIME; setting.sweep_time_us = 10*ONE_SECOND_TIME;
break; break;
@ -1459,7 +1464,7 @@ case M_GENHIGH: // Direct output from 1
SI4432_Transmit(setting.drive); SI4432_Transmit(setting.drive);
#endif #endif
#ifdef __SI4468__ #ifdef __SI4468__
SI4463_init_rx(); SI4463_init_tx();
#endif #endif
ADF4351_enable(true); ADF4351_enable(true);
#ifndef TINYSA4_PROTO #ifndef TINYSA4_PROTO
@ -1481,6 +1486,10 @@ case M_GENHIGH: // Direct output from 1
void update_rbw(void) // calculate the actual_rbw and the vbwSteps (# steps in between needed if frequency step is largen than maximum rbw) void update_rbw(void) // calculate the actual_rbw and the vbwSteps (# steps in between needed if frequency step is largen than maximum rbw)
{ {
if (!MODE_INPUT(setting.mode)) {
vbwSteps = 1;
return;
}
if (setting.frequency_step > 0 && MODE_INPUT(setting.mode)) { if (setting.frequency_step > 0 && MODE_INPUT(setting.mode)) {
setting.vbw_x10 = (setting.frequency_step)/100; setting.vbw_x10 = (setting.frequency_step)/100;
} else { } else {
@ -2079,8 +2088,13 @@ modulation_again:
} else if (setting.mode == M_HIGH) { } else if (setting.mode == M_HIGH) {
set_freq (SI4463_RX, lf); // sweep RX, local_IF = 0 in high mode set_freq (SI4463_RX, lf); // sweep RX, local_IF = 0 in high mode
} else if (setting.mode == M_GENHIGH) { } else if (setting.mode == M_GENHIGH) {
set_freq (ADF4351_LO, lf); // sweep LO, local_IF = 0 in high mode #if 1 // Let SI TX only
} set_freq (SI4463_RX, lf); // sweep RX, local_IF = 0 in high mode
local_IF = 0;
#else
set_freq (ADF4351_LO, lf); // sweep LO, local_IF = 0 in high mode
#endif
}
// STOP_PROFILE; // STOP_PROFILE;
#endif #endif
} }

@ -2145,7 +2145,7 @@ uint16_t force_rbw(int f)
SI4463_short_start_rx(); // This can cause recalibration SI4463_short_start_rx(); // This can cause recalibration
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 = float_TO_PURE_RSSI(RBW_choices[f].RSSI_correction_x_10 - 1200)/10; // Set RSSI correction
return RBW_choices[f].RBWx10; // RBW achieved by SI4463 in kHz * 10 return RBW_choices[f].RBWx10; // RBW achieved by SI4463 in kHz * 10
} }
@ -2210,16 +2210,34 @@ void SI4463_set_freq(uint32_t freq)
my_microsecond_delay(10); my_microsecond_delay(10);
} }
if ((SI4463_band == prev_band)) { if ((SI4463_band == prev_band)) {
uint8_t data[] = { int vco = 2091 + (((freq - 850000000)/1000) * 492) / 200000;
if (SI4463_in_tx_mode) {
uint8_t data[] = {
0x37,
(uint8_t) R, // R data[4]
(uint8_t) ((F>>16) & 255), // F2,F1,F0 data[5] .. data[7]
(uint8_t) ((F>> 8) & 255), // F2,F1,F0 data[5] .. data[7]
(uint8_t) ((F ) & 255), // F2,F1,F0 data[5] .. data[7]
(vco>>8) & 0xff,
vco & 0xff,
0x00,
0x32
};
SI4463_do_api(data, sizeof(data), NULL, 0);
} else {
uint8_t data[] = {
0x36, 0x36,
(uint8_t) R, // R data[4] (uint8_t) R, // R data[4]
(uint8_t) ((F>>16) & 255), // F2,F1,F0 data[5] .. data[7] (uint8_t) ((F>>16) & 255), // F2,F1,F0 data[5] .. data[7]
(uint8_t) ((F>> 8) & 255), // F2,F1,F0 data[5] .. data[7] (uint8_t) ((F>> 8) & 255), // F2,F1,F0 data[5] .. data[7]
(uint8_t) ((F ) & 255), // F2,F1,F0 data[5] .. data[7] (uint8_t) ((F ) & 255), // F2,F1,F0 data[5] .. data[7]
0x09, (vco>>8) & 0xff,
0x66 vco & 0xff
}; };
SI4463_do_api(data, sizeof(data), NULL, 0); SI4463_do_api(data, sizeof(data), NULL, 0);
}
SI4463_frequency_changed = true; SI4463_frequency_changed = true;
// SI4463_set_gpio(3,GPIO_LOW); // SI4463_set_gpio(3,GPIO_LOW);
return; return;
@ -2275,7 +2293,6 @@ void SI4463_set_freq(uint32_t freq)
}; };
SI4463_do_api(data2, sizeof(data2), NULL, 0); SI4463_do_api(data2, sizeof(data2), NULL, 0);
// my_microsecond_delay(30000); // my_microsecond_delay(30000);
prev_band = SI4463_band;
} }
@ -2305,6 +2322,7 @@ void SI4463_set_freq(uint32_t freq)
SI4463_wait_for_cts(); SI4463_wait_for_cts();
// SI4463_set_gpio(3,GPIO_LOW); // SI4463_set_gpio(3,GPIO_LOW);
SI4463_frequency_changed = true; SI4463_frequency_changed = true;
prev_band = SI4463_band;
} }
void SI4463_init_rx(void) void SI4463_init_rx(void)

Loading…
Cancel
Save

Powered by TurnKey Linux.