Proto updates

Removed_REF_marker
erikkaashoek 5 years ago
parent 3b8e51053d
commit 16c5d0f250

@ -55,7 +55,7 @@
/* on-board */
#if 1 // Set to 1 to build for prototype HW
#if 0 // Set to 1 to build for prototype HW
#define TINYSA4_PROTO
#define GPIO_LED 0
#define LINE_LED PAL_LINE(GPIOA,GPIO_LED)

@ -17,6 +17,7 @@
* Boston, MA 02110-1301, USA.
*/
#include "ch.h"
//#define TINYSA4_PROTO
//#ifdef TINYSA_F303
#include "adc_F303.h"
@ -46,7 +47,7 @@
#define __CALIBRATE__
#define __FAST_SWEEP__ // Pre-fill SI4432 RSSI buffer to get fastest sweep in zero span mode
// #define __AUDIO__
#define __HAM_BAND__
//#define __HAM_BAND__
//#define __ULTRA__ // Add harmonics mode on low input.
#define __SPUR__ // Does spur reduction by shifting IF
//#define __USE_SERIAL_CONSOLE__ // Enable serial I/O connection (need enable HAL_USE_SERIAL as TRUE in halconf.h)
@ -1115,5 +1116,6 @@ void set_modulo(uint32_t f);
extern volatile uint32_t ADF4350_modulo;
void ADF4351_Set(int channel);
void ADF4351_force_refresh(void);
void ADF4351_mux(int R);
#endif
/*EOF*/

@ -17,6 +17,7 @@
#pragma GCC push_options
#pragma GCC optimize ("Os")
uint32_t xtoi(char *t);
static int VFO = 0;
static int points = 101; // For 's' and 'm' commands
@ -355,11 +356,15 @@ VNA_SHELL_FUNCTION(cmd_v)
VNA_SHELL_FUNCTION(cmd_y)
{
int rvalue;
if (argc != 1 && argc != 2) {
shell_printf("usage: y {addr(0-95)} [value(0-0xFF)]\r\n");
uint8_t data[16];
if (argc < 1) {
shell_printf("usage: y {addr(0-FF)} [value(0-FF)]+\r\n");
return;
}
rvalue = my_atoui(argv[0]);
data[0] = xtoi(argv[0]);
for (int i=1; i < argc; i++) {
data[i] = xtoi(argv[i]);
}
#ifdef __SI4432__
int lvalue = 0;
SI4432_Sel = VFO;
@ -371,6 +376,12 @@ VNA_SHELL_FUNCTION(cmd_y)
shell_printf("%x\r\n", lvalue);
}
#endif
#ifdef __SI4463__
SI4463_do_api(data, argc, data, 16);
for (int i=0; i<16; i++)
shell_printf("%02x ", data[i]);
shell_printf("\r\n");
#endif
}
VNA_SHELL_FUNCTION(cmd_z)

@ -753,10 +753,11 @@ void auto_set_AGC_LNA(int auto_set, int agc)
#endif
#ifdef __SI4463__
unsigned char v;
if (auto_set)
if (auto_set) {
v = 0x00; // Enable AGC and disable LNA
else
v = 0x88+agc; // Disable AGC and enable LNA
} else {
v = 0xa8+agc; // Disable AGC and enable LNA
}
if (SI4432_old_v[0] != v) {
SI446x_set_AGC_LNA(v);
SI4432_old_v[0] = v;
@ -1421,7 +1422,7 @@ case M_GENHIGH: // Direct output from 1
ADF4351_enable_out(true);
#else
ADF4351_enable_aux_out(true);
ADF4351_enable_out(false);
ADF4351_enable_out(true); // Must be enabled to have aux output
#endif
ADF4351_aux_drive(setting.lo_drive);
enable_rx_output(false);
@ -1704,6 +1705,8 @@ static void calculate_static_correction(void) // Calculate the
- get_signal_path_loss()
+ float_TO_PURE_RSSI(
+ get_level_offset()
- (S_STATE(setting.agc)? 0 : +12)
- (S_STATE(setting.lna)? 0 : +21)
+ get_attenuation()
+ (setting.extra_lna ? -20.0 : 0) // TODO <------------------------- set correct value
- setting.offset);

@ -881,7 +881,7 @@ uint32_t registers[6] = {0xA00000, 0x8000011, 0x4E42, 0x4B3,0xDC003C , 0x580005
int debug = 0;
ioline_t ADF4351_LE[2] = { LINE_LO_SEL, LINE_LO_SEL};
int ADF4351_Mux = 7;
//int ADF4351_Mux = 7;
int ADF4351_frequency_changed = false;
@ -934,8 +934,9 @@ void ADF4351_Setup(void)
ADF4351_set_frequency(0,2000000000);
ADF4351_set_frequency(0,200000000);
ADF4351_mux(6); // Show lock on led
// ADF4351_set_frequency(1,150000000,0);
// ADF4351_Set(0);
@ -1052,6 +1053,13 @@ static int old_R;
ADF4351_Set(0);
}
void ADF4351_mux(int R)
{
registers[2] &= ~ (((unsigned long)0x7) << 26);
registers[2] |= (((unsigned long)R & (unsigned long)0x07) << 26);
ADF4351_Set(0);
}
void ADF4351_CP(int p)
{
registers[2] &= ~ (((unsigned long)0xF) << 9);
@ -1388,12 +1396,13 @@ static uint8_t gpio_state[4] = { 7,8,0,0 };
void SI4463_refresh_gpio(void)
{
#ifndef TINYSA4_PROTO
uint8_t data[] =
{
0x11, 0x00, 0x01, 0x01, 0x40 // GLOBAL_CLK_CFG Enable divided clock
};
SI4463_do_api(data, sizeof(data), NULL, 0);
#endif
uint8_t data2[] =
{
0x13, gpio_state[0], gpio_state[1], gpio_state[2], gpio_state[3], 0, 0, 0
@ -2352,9 +2361,9 @@ void enable_rx_output(int s)
void enable_high(int s)
{
if (s)
SI4463_set_gpio(2,GPIO_HIGH);
else
SI4463_set_gpio(2,GPIO_LOW);
else
SI4463_set_gpio(2,GPIO_HIGH);
}

@ -408,7 +408,7 @@ enum {
KM_ACTUALPOWER, KM_IF, KM_SAMPLETIME, KM_DRIVE, KM_LOWOUTLEVEL, KM_DECAY, KM_NOISE,
KM_10MHZ, KM_REPEAT, KM_OFFSET, KM_TRIGGER, KM_LEVELSWEEP, KM_SWEEP_TIME, KM_OFFSET_DELAY,
KM_FAST_SPEEDUP, KM_GRIDLINES, KM_MARKER, KM_MODULATION,KM_COR_AM,KM_COR_WFM, KM_COR_NFM, KM_IF2,
KM_R,KM_MOD,
KM_R,KM_MOD,KM_MUX,
KM_NONE // always at enum end
};
@ -448,6 +448,7 @@ static const struct {
{keypads_freq , "IF2"}, // KM_IF2
{keypads_positive , "R"}, // KM_R
{keypads_positive , "MODULO"}, // KM_MOD
{keypads_positive , "MUX"}, // KM_MUX
};
@ -1703,6 +1704,7 @@ static const menuitem_t menu_settings3[] =
// { MT_KEYPAD | MT_LOW, KM_IF2, "IF2 FREQ", "Set to zero for no IF2"},
{ MT_KEYPAD, KM_R, "R", "Set R"},
{ MT_KEYPAD, KM_MOD, "MODULO", "Set MODULO"},
{ MT_KEYPAD, KM_MUX, "MUX", "Set MUX"},
#ifdef __HAM_BAND__
{ MT_ADV_CALLBACK, 0, "HAM\nBANDS", menu_settings_ham_bands},
@ -2174,6 +2176,9 @@ set_numeric_value(void)
break;
case KM_MOD:
set_modulo(uistat.value);
break;
case KM_MUX:
ADF4351_mux((int)uistat.value);
// config_save();
break;
case KM_SAMPLETIME:

Loading…
Cancel
Save

Powered by TurnKey Linux.