mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
Select CH0 reflect channel before set freq (in some rare cases dsp started but CH not ready)
Little code optimization Add commented 600kHz I2C bus timings (work, give x1.5 speed, but need change DSP ready timings not by wait_count, need use chVTGetSystemTimeX() its better)
This commit is contained in:
parent
c40d78d80f
commit
77b5d0bcc8
43
main.c
43
main.c
|
|
@ -787,8 +787,8 @@ bool sweep(bool break_on_operation)
|
||||||
// Also touch made some
|
// Also touch made some
|
||||||
DSP_START(1); DSP_WAIT_READY;
|
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
|
|
||||||
tlv320aic3204_select(0); // 60 CH0:REFLECT
|
tlv320aic3204_select(0); // 60 CH0:REFLECT
|
||||||
|
delay = set_frequency(frequencies[i]); // 700
|
||||||
DSP_START(delay); // 1900
|
DSP_START(delay); // 1900
|
||||||
//================================================
|
//================================================
|
||||||
// Place some code thats need execute while delay
|
// Place some code thats need execute while delay
|
||||||
|
|
@ -1296,35 +1296,18 @@ void
|
||||||
cal_collect(int type)
|
cal_collect(int type)
|
||||||
{
|
{
|
||||||
ensure_edit_config();
|
ensure_edit_config();
|
||||||
|
int dst, src;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case CAL_LOAD:
|
case CAL_LOAD: cal_status|= CALSTAT_LOAD; dst = CAL_LOAD; src = 0; break;
|
||||||
cal_status |= CALSTAT_LOAD;
|
case CAL_OPEN: cal_status|= CALSTAT_OPEN; dst = CAL_OPEN; src = 0; cal_status&= ~(CALSTAT_ES|CALSTAT_APPLY); break;
|
||||||
memcpy(cal_data[CAL_LOAD], measured[0], sizeof measured[0]);
|
case CAL_SHORT: cal_status|= CALSTAT_SHORT; dst = CAL_SHORT; src = 0; cal_status&= ~(CALSTAT_ER|CALSTAT_APPLY); break;
|
||||||
break;
|
case CAL_THRU: cal_status|= CALSTAT_THRU; dst = CAL_THRU; src = 1; break;
|
||||||
|
case CAL_ISOLN: cal_status|= CALSTAT_ISOLN; dst = CAL_ISOLN; src = 1; break;
|
||||||
case CAL_OPEN:
|
default:
|
||||||
cal_status |= CALSTAT_OPEN;
|
return;
|
||||||
cal_status &= ~(CALSTAT_ES|CALSTAT_APPLY);
|
|
||||||
memcpy(cal_data[CAL_OPEN], measured[0], sizeof measured[0]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CAL_SHORT:
|
|
||||||
cal_status |= CALSTAT_SHORT;
|
|
||||||
cal_status &= ~(CALSTAT_ER|CALSTAT_APPLY);
|
|
||||||
memcpy(cal_data[CAL_SHORT], measured[0], sizeof measured[0]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CAL_THRU:
|
|
||||||
cal_status |= CALSTAT_THRU;
|
|
||||||
memcpy(cal_data[CAL_THRU], measured[1], sizeof measured[0]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CAL_ISOLN:
|
|
||||||
cal_status |= CALSTAT_ISOLN;
|
|
||||||
memcpy(cal_data[CAL_ISOLN], measured[1], sizeof measured[0]);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
// Copy calibration data
|
||||||
|
memcpy(cal_data[dst], measured[src], sizeof measured[0]);
|
||||||
redraw_request |= REDRAW_CAL_STATUS;
|
redraw_request |= REDRAW_CAL_STATUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2209,6 +2192,10 @@ static const I2CConfig i2ccfg = {
|
||||||
STM32_TIMINGR_PRESC(5U) |
|
STM32_TIMINGR_PRESC(5U) |
|
||||||
STM32_TIMINGR_SCLDEL(3U) | STM32_TIMINGR_SDADEL(3U) |
|
STM32_TIMINGR_SCLDEL(3U) | STM32_TIMINGR_SDADEL(3U) |
|
||||||
STM32_TIMINGR_SCLH(3U) | STM32_TIMINGR_SCLL(9U),
|
STM32_TIMINGR_SCLH(3U) | STM32_TIMINGR_SCLL(9U),
|
||||||
|
// 600kHz @ SYSCLK 48MHz, manually get values, x1.5 I2C speed, but need calc timings
|
||||||
|
// STM32_TIMINGR_PRESC(3U) |
|
||||||
|
// STM32_TIMINGR_SCLDEL(2U) | STM32_TIMINGR_SDADEL(2U) |
|
||||||
|
// STM32_TIMINGR_SCLH(4U) | STM32_TIMINGR_SCLL(4U),
|
||||||
#else
|
#else
|
||||||
#error "Need Define STM32_I2C1SW and set correct TIMINGR settings"
|
#error "Need Define STM32_I2C1SW and set correct TIMINGR settings"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
32
plot.c
32
plot.c
|
|
@ -1636,27 +1636,17 @@ draw_cal_status(void)
|
||||||
ili9341_drawstring(c, x, y);
|
ili9341_drawstring(c, x, y);
|
||||||
y += YSTEP;
|
y += YSTEP;
|
||||||
}
|
}
|
||||||
|
int i;
|
||||||
if (cal_status & CALSTAT_ED) {
|
static const struct {char text, zero, mask;} calibration_text[]={
|
||||||
ili9341_drawstring("D", x, y);
|
{'D', 0, CALSTAT_ED},
|
||||||
y += YSTEP;
|
{'R', 0, CALSTAT_ER},
|
||||||
}
|
{'S', 0, CALSTAT_ES},
|
||||||
if (cal_status & CALSTAT_ER) {
|
{'T', 0, CALSTAT_ET},
|
||||||
ili9341_drawstring("R", x, y);
|
{'X', 0, CALSTAT_EX}
|
||||||
y += YSTEP;
|
};
|
||||||
}
|
for (i = 0; i < 5; i++, y+= YSTEP)
|
||||||
if (cal_status & CALSTAT_ES) {
|
if (cal_status & calibration_text[i].mask)
|
||||||
ili9341_drawstring("S", x, y);
|
ili9341_drawstring(&calibration_text[i].text, x, y);
|
||||||
y += YSTEP;
|
|
||||||
}
|
|
||||||
if (cal_status & CALSTAT_ET) {
|
|
||||||
ili9341_drawstring("T", x, y);
|
|
||||||
y += YSTEP;
|
|
||||||
}
|
|
||||||
if (cal_status & CALSTAT_EX) {
|
|
||||||
ili9341_drawstring("X", x, y);
|
|
||||||
y += YSTEP;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw battery level
|
// Draw battery level
|
||||||
|
|
|
||||||
2
si5351.c
2
si5351.c
|
|
@ -338,7 +338,7 @@ static inline uint8_t si5351_getBand(uint32_t freq){
|
||||||
// Minimum value is 2, freq change apply at next dsp measure, and need skip it
|
// Minimum value is 2, freq change apply at next dsp measure, and need skip it
|
||||||
#define DELAY_NORMAL 2
|
#define DELAY_NORMAL 2
|
||||||
// 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 2
|
#define DELAY_BANDCHANGE_1 2
|
||||||
#define DELAY_BANDCHANGE_2 2
|
#define DELAY_BANDCHANGE_2 2
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue