diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index 4408aa2..9c2ffe1 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + diff --git a/radio_config_Si4468_short.h b/radio_config_Si4468_short.h index 45554f5..7530743 100644 --- a/radio_config_Si4468_short.h +++ b/radio_config_Si4468_short.h @@ -11,6 +11,8 @@ #undef RF_GLOBAL_CLK_CFG_1 #define RF_GLOBAL_CLK_CFG_1 GLOBAL_CLK_CFG +//#undef RF_MODEM_RAW_SEARCH2_2_1 +//#define RF_MODEM_RAW_SEARCH2_2_1 0x11, 0x20, 0x02, 0x50, 0x94, 0x18 #if 1 #undef RADIO_CONFIGURATION_DATA_ARRAY diff --git a/sa_core.c b/sa_core.c index 66efe9a..e036f32 100644 --- a/sa_core.c +++ b/sa_core.c @@ -46,21 +46,6 @@ const int reffer_freq[] = {30000000, 15000000, 10000000, 4000000, 3000000, 20000 int in_selftest = false; -#if 0 -const char *dummy = "this is a very long string only used to fill memory so I know when the memory is full and I can remove some of this string to make more memory available\ -this is a very long string only used to fill memory so I know when the memory is full and I can remove some of this string to make more memory available\ -this is a very long string only used to fill memory so I know when the memory is full and I can remove some of this string to make more memory available\ -this is a very long string only used to fill memory so I know when the memory is full and I can remove some of this string to make more memory available\ -this is a very long string only used to fill memory so I know when the memory is full and I can remove some of this string to make more memory available\ -this is a very long string only used to fill memory so I know when the memory is full and I can remove some of this string to make more memory available\ -this is a very long string only used to fill memory so I know when the memory is full and I can remove some of this string to make more memory available\ -this is a very long string only used to fill memory so I know when the memory is full and I can remove some of this string to make more memory available\ -this is a very long string only used to fill memory so I know when the memory is full and I can remove some of this string to make more memory available\ -this is a very long string only used to fill memory so I know when the memory is full and I can remove some of this string to make more memory available\ -this is a very long string only used to fill memory so I know when the memory is full and I can remove some of this string to make more memory available" -; -#endif - void update_min_max_freq(void) { switch(setting.mode) { @@ -213,9 +198,9 @@ uint32_t calc_min_sweep_time_us(void) // Estimate minimum sweep time in t = 200*sweep_points; // 200 microseconds is the delay set in perform when sweeping in output mode else { uint32_t bare_sweep_time=0; -#ifdef __SI4432__ +//#ifdef __SI4432__ bare_sweep_time = (SI4432_step_delay + MEASURE_TIME) * (sweep_points); // Single RSSI delay and measurement time in uS while scanning -#endif +//#endif if (FREQ_IS_CW()) { bare_sweep_time = MINIMUM_SWEEP_TIME; // minimum sweep time in fast CW mode if (setting.repeat != 1 || setting.sweep_time_us >= 100*ONE_MS_TIME || setting.spur_removal != 0) // if no fast CW sweep possible @@ -2111,13 +2096,19 @@ modulation_again: // jump here if in zero span mode and all HW frequency setup is done. -#ifdef __SI4432__ #ifdef __FAST_SWEEP__ +#ifdef __SI4432__ if (i == 0 && setting.frequency_step == 0 && setting.trigger == T_AUTO && setting.spur_removal == 0 && SI4432_step_delay == 0 && setting.repeat == 1 && setting.sweep_time_us < 100*ONE_MS_TIME) { // if ultra fast scanning is needed prefill the SI4432 RSSI read buffer SI4432_Fill(MODE_SELECT(setting.mode), 0); } #endif +#ifdef __SI4463__ + if (i == 0 && setting.frequency_step == 0 && setting.trigger == T_AUTO && setting.spur_removal == 0 && SI4432_step_delay == 0 && setting.repeat == 1 && setting.sweep_time_us < 100*ONE_MS_TIME) { + // if ultra fast scanning is needed prefill the SI4432 RSSI read buffer + SI446x_Fill(MODE_SELECT(setting.mode), 0); + } +#endif #endif pureRSSI_t pureRSSI; // if ( i < 3) @@ -2174,6 +2165,11 @@ modulation_again: SI4432_Fill(MODE_SELECT(setting.mode), 1); // fast mode possible to pre-fill RSSI buffer } #endif +#ifdef __SI446x__ + if (setting.spur_removal == 0 && SI4432_step_delay == 0 && setting.repeat == 1 && setting.sweep_time_us < 100*ONE_MS_TIME) { + SI446x_Fill(MODE_SELECT(setting.mode), 1); // fast mode possible to pre-fill RSSI buffer + } +#endif #endif if (setting.trigger == T_SINGLE) { set_trigger(T_DONE); diff --git a/si4432.c b/si4432.c index 63b2f9d..b671a17 100644 --- a/si4432.c +++ b/si4432.c @@ -877,9 +877,9 @@ float Simulated_SI4432_RSSI(uint32_t i, int s) //uint32_t registers[6] = {0x320000, 0x8008011, 0x4E42, 0x4B3,0x8C803C , 0x580005} ; //25 MHz ref #ifdef TINYSA4_PROTO -uint32_t registers[6] = {0xA00000, 0x8000011, 0x4042, 0x4B3,0x9F003C , 0x580005} ; //10 MHz ref +uint32_t registers[6] = {0xA00000, 0x8000011, 0x4042, 0x4B3,0xDC003C , 0x580005} ; //10 MHz ref #else -uint32_t registers[6] = {0xA00000, 0x8000011, 0x4E42, 0x4B3,0x9F003C , 0x580005} ; //10 MHz ref +uint32_t registers[6] = {0xA00000, 0x8000011, 0x4E42, 0x4B3,0xDC003C , 0x580005} ; //10 MHz ref #endif int debug = 0; ioline_t ADF4351_LE[2] = { LINE_LO_SEL, LINE_LO_SEL}; @@ -934,7 +934,7 @@ void ADF4351_Setup(void) ADF4351_R_counter(1); - + ADF4351_CP(7); ADF4351_set_frequency(0,200000000); @@ -1700,8 +1700,57 @@ void set_RSSI_comp(void) } +#ifdef __FAST_SWEEP__ +extern deviceRSSI_t age[POINTS_COUNT]; +static int buf_index = 0; +static bool buf_read = false; + +void SI446x_Fill(int s, int start) +{ +#if 0 + set_SPI_mode(SPI_MODE_SI); + SI4432_Sel = s; + uint16_t sel = SI_nSEL[SI4432_Sel]; +#endif + + uint32_t t = setting.additional_step_delay_us; + systime_t measure = chVTGetSystemTimeX(); +// __disable_irq(); + +#if 1 + int i = start; + uint8_t data[3]; + do { + data[0] = SI446X_CMD_GET_MODEM_STATUS; + data[1] = 0xFF; + SI4463_do_api(data, 2, data, 3); + age[i]=(char)data[2]; + if (++i >= sweep_points) break; + if (t) + my_microsecond_delay(t); + } while(1); +#else + shiftInBuf(sel, SI4432_REG_RSSI, &age[start], sweep_points - start, t); +#endif +// __enable_irq(); + + setting.measure_sweep_time_us = (chVTGetSystemTimeX() - measure)*100; + buf_index = start; // Is used to skip 1st entry during level triggering + buf_read = true; +} +#endif + + + int16_t Si446x_RSSI(void) { +#ifdef __FAST_SWEEP__ + if (buf_read) { + if (buf_index == sweep_points-1) + buf_read = false; + return DEVICE_TO_PURE_RSSI(age[buf_index++]); + } +#endif int i = setting.repeat; int32_t RSSI_RAW = 0; @@ -1721,7 +1770,7 @@ int16_t Si446x_RSSI(void) SI4463_frequency_changed = false; } - int j = 1; //setting.repeat; + int j = 3; //setting.repeat; int RSSI_RAW_ARRAY[3]; do{ again: @@ -1736,7 +1785,7 @@ int16_t Si446x_RSSI(void) if (j == 0) break; my_microsecond_delay(100); }while(1); -#if 0 +#if 1 int t; if (RSSI_RAW_ARRAY[0] > RSSI_RAW_ARRAY[1]) { t = RSSI_RAW_ARRAY[1]; @@ -1768,6 +1817,8 @@ int16_t Si446x_RSSI(void) return RSSI_RAW; } + + void SI446x_set_AGC_LNA(uint8_t v) { diff --git a/si4432.h b/si4432.h index 93e3e26..38b48ac 100644 --- a/si4432.h +++ b/si4432.h @@ -189,6 +189,7 @@ void setState(si446x_state_t newState); extern const int SI4432_RBW_count; extern si446x_info_t SI4463_info; void Si446x_getInfo(si446x_info_t* info); +void SI446x_Fill(int s, int start); void SI4463_init(void); #define ADF4351_LO 3 #define ADF4351_LO2 4 diff --git a/ui_sa.c b/ui_sa.c index 1dee97b..eb62dca 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -462,6 +462,7 @@ static const menuitem_t menu_top[]; static const menuitem_t menu_reffer[]; static const menuitem_t menu_modulation[]; static const menuitem_t menu_drive_wide[]; +static const menuitem_t menu_settings3[]; #ifdef __ULTRA__ static const menuitem_t menu_tophigh[]; static const menuitem_t menu_topultra[]; @@ -1490,7 +1491,9 @@ static const menuitem_t menu_lowoutputmode[] = { { MT_FORM | MT_ADV_CALLBACK, 0, "LOW OUTPUT %s", menu_outputmode_acb}, { MT_FORM | MT_KEYPAD, KM_CENTER, "FREQ: %s", "10kHz..350MHz"}, { MT_FORM | MT_KEYPAD, KM_LOWOUTLEVEL, "LEVEL: %s", "-76..-6"}, - { MT_FORM | MT_ADV_CALLBACK, 0, "MOD: %s", menu_smodulation_acb}, +// { MT_FORM | MT_ADV_CALLBACK, 0, "MOD: %s", menu_smodulation_acb}, + { MT_FORM | MT_SUBMENU, 255, S_RARROW" Settings", menu_settings3}, + { MT_FORM | MT_KEYPAD, KM_SPAN, "SPAN: %s", "0..350MHz"}, { MT_FORM | MT_KEYPAD | MT_LOW, KM_LEVELSWEEP,"LEVEL CHANGE: %s", "-70..70"}, { MT_FORM | MT_KEYPAD, KM_SWEEP_TIME, "SWEEP TIME: %s", "0..600 seconds"},