Commit ddc7cffb authored by Mattia Rizzi's avatar Mattia Rizzi

Added the "setpoint:%d" in the softpll debug messages

parent 77d1912e
......@@ -298,6 +298,7 @@ void spll_init(int mode, int slave_ref_channel, int align_pps)
PPSG->ESCR = 0;
PPSG->CR = PPSG_CR_CNT_EN | PPSG_CR_PWIDTH_W(PPS_WIDTH);
if(mode == SPLL_MODE_DISABLED)
s->seq_state = SEQ_DISABLED;
else
......@@ -462,12 +463,12 @@ void spll_show_stats()
if (softpll.mode > 0)
pp_printf("softpll: irqs %d seq %s mode %d "
"alignment_state %d HL%d ML%d HY=%d MY=%d DelCnt=%d\n",
"alignment_state %d HL%d ML%d HY=%d MY=%d DelCnt=%d setpoint:%d\n",
s->irq_count, stringlist_lookup(seq_states, s->seq_state),
s->mode, s->ext.align_state,
s->helper.ld.locked, s->mpll.ld.locked,
s->helper.pi.y, s->mpll.pi.y,
s->delock_count);
s->delock_count, s->mpll.phase_shift_current);
}
int spll_shifter_busy(int channel)
......@@ -638,10 +639,11 @@ int spll_update()
stats.del_cnt = softpll.delock_count;
stats.sequence++;
return ret != 0;
}
static int spll_measure_frequency(int osc)
int spll_measure_frequency(int osc)
{
volatile uint32_t *reg;
......@@ -659,7 +661,7 @@ static int spll_measure_frequency(int osc)
return 0;
}
timer_delay_ms(2000);
// timer_delay_ms(2000);
return (*reg ) & (0xfffffff);
}
......@@ -691,23 +693,24 @@ static int calc_apr(int meas_min, int meas_max, int f_center )
void check_vco_frequencies()
{
disable_irq();
//disable_irq();
int f_min, f_max;
pll_verbose("SoftPLL VCO Frequency/APR test:\n");
spll_set_dac(-1, 0);
// spll_set_dac(-1, 0);
f_min = spll_measure_frequency(SPLL_OSC_DMTD);
spll_set_dac(-1, 65535);
// spll_set_dac(-1, 65535);
f_max = spll_measure_frequency(SPLL_OSC_DMTD);
pll_verbose("DMTD VCO: Low=%d Hz Hi=%d Hz, APR = %d ppm.\n", f_min, f_max, calc_apr(f_min, f_max, 62500000));
spll_set_dac(0, 0);
// spll_set_dac(0, 0);
f_min = spll_measure_frequency(SPLL_OSC_REF);
spll_set_dac(0, 65535);
// spll_set_dac(0, 65535);
f_max = spll_measure_frequency(SPLL_OSC_REF);
pll_verbose("REF VCO: Low=%d Hz Hi=%d Hz, APR = %d ppm.\n", f_min, f_max, calc_apr(f_min, f_max, REF_CLOCK_FREQ_HZ));
f_min = spll_measure_frequency(SPLL_OSC_EXT);
pll_verbose("EXT clock: Freq=%d Hz\n", f_min);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment