Commit bce82e26 authored by Peter Jansweijer's avatar Peter Jansweijer

phase shift until is_align_10MHz

parent 2fe94f2e
......@@ -416,8 +416,7 @@ int wr_e2e_offset(struct pp_instance *ppi,
return 1;
}
int loop_cnt;
#define NUMBER_OF_SHIFTS 40
#include "board.h"
#define COARSE_SHIFT 8000
int wr_servo_update(struct pp_instance *ppi)
......@@ -500,7 +499,6 @@ int wr_servo_update(struct pp_instance *ppi)
* fine tuning
*/
s->state = WR_SYNC_PHASE;
loop_cnt = 0;
break;
case WR_SYNC_NSEC:
......@@ -511,9 +509,8 @@ int wr_servo_update(struct pp_instance *ppi)
break;
case WR_SYNC_PHASE:
if (loop_cnt < NUMBER_OF_SHIFTS) {
loop_cnt += 1;
pp_printf("SP: cnt: %d\n",loop_cnt);
if (is_aligned_10mhz() == 0) {
s->cur_setpoint += COARSE_SHIFT;
wrp->ops->adjust_phase(s->cur_setpoint);
} else {
......@@ -545,9 +542,9 @@ int wr_servo_update(struct pp_instance *ppi)
/* ts_to_picos() below returns phase alone */
remaining_offset = abs(ts_offset_picos);
if (loop_cnt < NUMBER_OF_SHIFTS) {
pp_printf("WOS: cnt: %d, remaining_offset: %d\n",loop_cnt, remaining_offset);
s->state = WR_SYNC_PHASE; // and loop to shift 200 ps again.
if (is_aligned_10mhz() == 0) {
pp_printf("WOS: remaining_offset: %d\n", remaining_offset);
s->state = WR_SYNC_PHASE; // and loop to shift COARSE_SHIFT again.
} else {
if(remaining_offset < WR_SERVO_OFFSET_STABILITY_THRESHOLD) {
wrp->ops->enable_timing_output(ppi, 1);
......
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