diff options
-rw-r--r-- | usrp2/firmware/apps/app_common_v2.c | 2 | ||||
-rw-r--r-- | usrp2/firmware/lib/db_init.c | 6 | ||||
-rw-r--r-- | usrp2/firmware/lib/db_rfx.c | 35 | ||||
-rw-r--r-- | usrp2/firmware/lib/db_tvrx.c | 28 |
4 files changed, 40 insertions, 31 deletions
diff --git a/usrp2/firmware/apps/app_common_v2.c b/usrp2/firmware/apps/app_common_v2.c index f132e55fd..b048c3fca 100644 --- a/usrp2/firmware/apps/app_common_v2.c +++ b/usrp2/firmware/apps/app_common_v2.c @@ -506,10 +506,12 @@ void print_tune_result(char *msg, bool tune_ok, u2_fxpt_freq_t target_freq, struct tune_result *r) { +#if 0 printf("db_tune %s %s\n", msg, tune_ok ? "true" : "false"); putstr(" target_freq "); print_fxpt_freq(target_freq); newline(); putstr(" baseband_freq "); print_fxpt_freq(r->baseband_freq); newline(); putstr(" dxc_freq "); print_fxpt_freq(r->dxc_freq); newline(); putstr(" residual_freq "); print_fxpt_freq(r->residual_freq); newline(); printf(" inverted %s\n", r->inverted ? "true" : "false"); +#endif } diff --git a/usrp2/firmware/lib/db_init.c b/usrp2/firmware/lib/db_init.c index 160ed2942..6a70d19fc 100644 --- a/usrp2/firmware/lib/db_init.c +++ b/usrp2/firmware/lib/db_init.c @@ -123,6 +123,10 @@ lookup_dboard(int i2c_addr, struct db_base *default_db, char *msg) { struct db_base *db; int dbid = read_dboard_eeprom(i2c_addr); + + // FIXME removing this printf has the system hang if there are two d'boards + // installed. (I think the problem is in i2c_read/write or the way + // I kludge the zero-byte write to set the read address in eeprom_read.) printf("%s dbid: 0x%x\n", msg, dbid); if (dbid < 0){ // there was some kind of problem. Treat as Basic Tx @@ -250,7 +254,7 @@ db_init(void) rx_dboard->init(rx_dboard); m = determine_rx_mux_value(rx_dboard); dsp_rx_regs->rx_mux = m; - printf("rx_mux = 0x%x\n", m); + //printf("rx_mux = 0x%x\n", m); } /*! diff --git a/usrp2/firmware/lib/db_rfx.c b/usrp2/firmware/lib/db_rfx.c index 10313844f..974222508 100644 --- a/usrp2/firmware/lib/db_rfx.c +++ b/usrp2/firmware/lib/db_rfx.c @@ -142,9 +142,9 @@ struct db_rfx_400_rx db_rfx_400_rx = { .base.used_pins = 0x00FF, .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(400e6), .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(500e6), - //.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(xxx), + .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), + .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(45), + .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0.022), .base.is_quadrature = true, .base.i_and_q_swapped = true, .base.spectrum_inverted = false, @@ -203,9 +203,9 @@ struct db_rfx_900_rx db_rfx_900_rx = { .base.used_pins = 0x00FF, .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(800e6), .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(1000e6), - //.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(xxx), + .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), + .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(70), + .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0.034), .base.is_quadrature = true, .base.i_and_q_swapped = true, .base.spectrum_inverted = false, @@ -264,9 +264,9 @@ struct db_rfx_1200_rx db_rfx_1200_rx = { .base.used_pins = 0x00FF, .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(1150e6), .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(1350e6), - //.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(xxx), + .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), + .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(70), + .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0.034), .base.is_quadrature = true, .base.i_and_q_swapped = true, .base.spectrum_inverted = false, @@ -325,9 +325,9 @@ struct db_rfx_1800_rx db_rfx_1800_rx = { .base.used_pins = 0x00FF, .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(1600e6), .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(2000e6), - //.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(xxx), + .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), + .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(70), + .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0.034), .base.is_quadrature = true, .base.i_and_q_swapped = true, .base.spectrum_inverted = false, @@ -387,9 +387,9 @@ struct db_rfx_2400_rx db_rfx_2400_rx = { .base.used_pins = 0x00FF, .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(2300e6), .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(2700e6), - //.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(xxx), + .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), + .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(70), + .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0.034), .base.is_quadrature = true, .base.i_and_q_swapped = true, .base.spectrum_inverted = false, @@ -458,7 +458,6 @@ rfx_init_rx(struct db_base *dbb) // test gain dbb->set_gain(dbb,U2_DOUBLE_TO_FXPT_GAIN(45.0)); - printf("set the gain\n"); return true; } @@ -487,7 +486,7 @@ rfx_set_freq(struct db_base *dbb, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc) mdelay(10); spi_transact(SPI_TXONLY,db->common.spi_mask,N,24,SPIF_PUSH_FALL); - printf("A = %d, B = %d, N_DIV = %d\n",A, B, N_DIV); + //printf("A = %d, B = %d, N_DIV = %d\n",A, B, N_DIV); *dc = (N_DIV * phdet_freq) / db->common.freq_mult; return true; } @@ -509,7 +508,7 @@ rfx_set_gain_rx(struct db_base *dbb, u2_fxpt_gain_t gain) int offset_q8 = (int)(1.2/3.3*4096*(1<<15)); int slope_q8 = (int)(-1.0/45.0*4096/3.3*256); int dacword = ((slope_q8 * gain) + offset_q8)>>15; - printf("DACWORD %d\n",dacword); + //printf("DACWORD %d\n",dacword); lsdac_write_rx(1,dacword); return true; /* diff --git a/usrp2/firmware/lib/db_tvrx.c b/usrp2/firmware/lib/db_tvrx.c index 522dfa817..6b523d8fd 100644 --- a/usrp2/firmware/lib/db_tvrx.c +++ b/usrp2/firmware/lib/db_tvrx.c @@ -83,9 +83,9 @@ struct db_tvrx1 db_tvrx1 = { .base.used_pins = 0x0000, .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(50e6), .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(860e6), - //.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(xxx), + .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), + .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(95), + .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(1), .base.is_quadrature = false, .base.i_and_q_swapped = false, .base.spectrum_inverted = false, @@ -110,9 +110,9 @@ struct db_tvrx2 db_tvrx2 = { .base.used_pins = 0x0000, .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(50e6), .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(860e6), - //.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(xxx), + .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), + .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(95), + .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(1), .base.is_quadrature = false, .base.i_and_q_swapped = false, .base.spectrum_inverted = true, @@ -137,9 +137,9 @@ struct db_tvrx3 db_tvrx3 = { .base.used_pins = 0x0000, .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(50e6), .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(860e6), - //.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(xxx), + .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), + .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(95), + .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(1), .base.is_quadrature = false, .base.i_and_q_swapped = false, .base.spectrum_inverted = true, @@ -182,8 +182,10 @@ tvrx_set_freq(struct db_base *dbb, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc) if(N_DIV > 32767) return false; - printf("N_DIV = %d, actual_freq = %d, actual_lo_freq = %d\n", - N_DIV, u2_fxpt_freq_round_to_int(actual_freq),u2_fxpt_freq_round_to_int(actual_freq)); + if (0) + printf("N_DIV = %d, actual_freq = %d, actual_lo_freq = %d\n", + N_DIV, u2_fxpt_freq_round_to_int(actual_freq), + u2_fxpt_freq_round_to_int(actual_lo_freq)); unsigned char buf[4]; buf[0] = (N_DIV>>8) & 0xff; @@ -227,7 +229,9 @@ tvrx_set_gain(struct db_base *dbb, u2_fxpt_gain_t gain) lsdac_write_rx(0,rfdac); lsdac_write_rx(1,ifdac); - printf("Setting gain %d, rf %d, if %d\n",gain,rfdac,ifdac); + if (0) + printf("Setting gain %d, rf %d, if %d\n",gain,rfdac,ifdac); + return true; } |