mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
Replace function wait_dsp(delay) by definition:
DSP_START(delay) //================================================ // Place some code thats need execute while delay //================================================ DSP_WAIT_READY Fix Band table description Add power stabilization delay on sweep start
This commit is contained in:
parent
12d53738bc
commit
e896f32803
32
main.c
32
main.c
|
|
@ -553,15 +553,6 @@ volatile int16_t wait_count = 0;
|
||||||
|
|
||||||
float measured[2][POINTS_COUNT][2];
|
float measured[2][POINTS_COUNT][2];
|
||||||
|
|
||||||
static void
|
|
||||||
wait_dsp(int count)
|
|
||||||
{
|
|
||||||
wait_count = count;
|
|
||||||
//reset_dsp_accumerator();
|
|
||||||
while (wait_count)
|
|
||||||
__WFI();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ENABLED_DUMP
|
#ifdef ENABLED_DUMP
|
||||||
static void
|
static void
|
||||||
duplicate_buffer_to_dump(int16_t *p)
|
duplicate_buffer_to_dump(int16_t *p)
|
||||||
|
|
@ -739,7 +730,8 @@ static const marker_t def_markers[MARKERS_MAX] = {
|
||||||
|
|
||||||
// Load propeties default settings
|
// Load propeties default settings
|
||||||
void loadDefaultProps(void){
|
void loadDefaultProps(void){
|
||||||
current_props.magic = CONFIG_MAGIC;
|
//Magic add on caldata_save
|
||||||
|
//current_props.magic = CONFIG_MAGIC;
|
||||||
current_props._frequency0 = 50000; // start = 50kHz
|
current_props._frequency0 = 50000; // start = 50kHz
|
||||||
current_props._frequency1 = 900000000; // end = 900MHz
|
current_props._frequency1 = 900000000; // end = 900MHz
|
||||||
current_props._sweep_points = POINTS_COUNT;
|
current_props._sweep_points = POINTS_COUNT;
|
||||||
|
|
@ -755,6 +747,8 @@ void loadDefaultProps(void){
|
||||||
current_props._active_marker = 0;
|
current_props._active_marker = 0;
|
||||||
current_props._domain_mode = 0;
|
current_props._domain_mode = 0;
|
||||||
current_props._marker_smith_format = MS_RLC;
|
current_props._marker_smith_format = MS_RLC;
|
||||||
|
//Checksum add on caldata_save
|
||||||
|
//current_props.checksum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -769,6 +763,9 @@ ensure_edit_config(void)
|
||||||
cal_status = 0;
|
cal_status = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define DSP_START(delay) wait_count = delay;
|
||||||
|
#define DSP_WAIT_READY while (wait_count) __WFI();
|
||||||
|
|
||||||
#define DELAY_CHANNEL_CHANGE 2
|
#define DELAY_CHANNEL_CHANGE 2
|
||||||
|
|
||||||
// main loop for measurement
|
// main loop for measurement
|
||||||
|
|
@ -777,15 +774,26 @@ bool sweep(bool break_on_operation)
|
||||||
int i, delay;
|
int i, delay;
|
||||||
// blink LED while scanning
|
// blink LED while scanning
|
||||||
palClearPad(GPIOC, GPIOC_LED);
|
palClearPad(GPIOC, GPIOC_LED);
|
||||||
|
// Power stabilization after LED off, also align timings
|
||||||
|
// Also touch made some
|
||||||
|
DSP_START(1); DSP_WAIT_READY;
|
||||||
for (i = 0; i < sweep_points; i++) { // 5300
|
for (i = 0; i < sweep_points; i++) { // 5300
|
||||||
delay = set_frequency(frequencies[i]); // 700
|
delay = set_frequency(frequencies[i]); // 700
|
||||||
tlv320aic3204_select(0); // 60 CH0:REFLECT
|
tlv320aic3204_select(0); // 60 CH0:REFLECT
|
||||||
wait_dsp(delay); // 1900
|
DSP_START(delay); // 1900
|
||||||
|
//================================================
|
||||||
|
// Place some code thats need execute while delay
|
||||||
|
//================================================
|
||||||
|
DSP_WAIT_READY;
|
||||||
// calculate reflection coefficient
|
// calculate reflection coefficient
|
||||||
(*sample_func)(measured[0][i]); // 60
|
(*sample_func)(measured[0][i]); // 60
|
||||||
|
|
||||||
tlv320aic3204_select(1); // 60 CH1:TRANSMISSION
|
tlv320aic3204_select(1); // 60 CH1:TRANSMISSION
|
||||||
wait_dsp(DELAY_CHANNEL_CHANGE); // 1700
|
DSP_START(DELAY_CHANNEL_CHANGE); // 1700
|
||||||
|
//================================================
|
||||||
|
// Place some code thats need execute while delay
|
||||||
|
//================================================
|
||||||
|
DSP_WAIT_READY;
|
||||||
// calculate transmission coefficient
|
// calculate transmission coefficient
|
||||||
(*sample_func)(measured[1][i]); // 60
|
(*sample_func)(measured[1][i]); // 60
|
||||||
// ======== 170 ===========
|
// ======== 170 ===========
|
||||||
|
|
|
||||||
11
si5351.c
11
si5351.c
|
|
@ -321,11 +321,12 @@ si5351_set_frequency(int channel, uint32_t freq, uint8_t drive_strength){
|
||||||
* +-----------------------------------------------------------------------------------------------------------------------+
|
* +-----------------------------------------------------------------------------------------------------------------------+
|
||||||
* | Band 1 | Band 2 | Band 3 | Band 2 | Band 3 |
|
* | Band 1 | Band 2 | Band 3 | Band 2 | Band 3 |
|
||||||
* +-----------------------------------------------------------------------------------------------------------------------+
|
* +-----------------------------------------------------------------------------------------------------------------------+
|
||||||
* | x1 : x1 | x1 : x1 | x1 : x1 | x3 : x5 | x3 : x5 | x5-x7 | x7-x9 | x9-x11 |
|
* | Direct mode x1 : x1 | x3 : x5 | x5-x7 | x7-x9 | x9-x11 |
|
||||||
|
* +-----------------------------------------------------------------------------------------------------------------------+
|
||||||
* | 50kHz - 100MHz | 100 - 150MHz | 150 - 300MHz | 300-450MHz | 450-900MHz | 900-1500MHz | 1500-2100MHz | 2100-2700MHz |
|
* | 50kHz - 100MHz | 100 - 150MHz | 150 - 300MHz | 300-450MHz | 450-900MHz | 900-1500MHz | 1500-2100MHz | 2100-2700MHz |
|
||||||
* +-----------------------------------------------------------------------------------------------------------------------+
|
* +-----------------------------------------------------------------------------------------------------------------------+
|
||||||
* | f = 50kHz-100MHz | f=100-150 | f=150-300 | f=150-300 | f=214-300 | f=233-300 |
|
* | f = 50kHz-300MHz | f=100-150 | f=150-300 | f=150-300 | f=214-300 | f=233-300 |
|
||||||
* | of = 50kHz-100MHz |of= 60- 90 |of= 90-180 |of=128-215 |of=166-234 |of=190-246 |
|
* | of = 50kHz-300MHz |of= 60- 90 |of= 90-180 |of=128-215 |of=166-234 |of=190-246 |
|
||||||
* +-----------------------------------------------------------------------------------------------------------------------+
|
* +-----------------------------------------------------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
static inline uint8_t si5351_getBand(uint32_t freq){
|
static inline uint8_t si5351_getBand(uint32_t freq){
|
||||||
|
|
@ -339,8 +340,8 @@ static inline uint8_t si5351_getBand(uint32_t freq){
|
||||||
// Additional delay for band 1 (remove unstable generation at begin)
|
// Additional delay for band 1 (remove unstable generation at begin)
|
||||||
#define DELAY_BAND_1 1
|
#define DELAY_BAND_1 1
|
||||||
// Band changes need additional delay after reset PLL
|
// Band changes need additional delay after reset PLL
|
||||||
#define DELAY_BANDCHANGE_1 3
|
#define DELAY_BANDCHANGE_1 2
|
||||||
#define DELAY_BANDCHANGE_2 3
|
#define DELAY_BANDCHANGE_2 2
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Maximum supported frequency = FREQ_HARMONICS * 9U
|
* Maximum supported frequency = FREQ_HARMONICS * 9U
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue