no-OS
Loading...
Searching...
No Matches
ad9088_mcs.c File Reference

Multi-chip synchronization calibration for AD9088. More...

#include "ad9088.h"
#include "no_os_util.h"
Include dependency graph for ad9088_mcs.c:

Macros

#define AD9088_MCS_ALIGN_LIMIT_MILLICYCLES   400
 
#define AD9088_MCS_FS_PER_CYCLE_SCALE   1000000000000ULL
 

Functions

int ad9088_mcs_init_cal_setup (struct ad9088_phy *phy)
 Zero the desired internal-to-external SYSREF offsets before init cal.
 
int ad9088_delta_t_measurement_set (struct ad9088_phy *phy, uint32_t mode)
 Start a BSYNC delta-t measurement.
 
int ad9088_delta_t_measurement_get (struct ad9088_phy *phy, uint32_t mode, int64_t *apollo_delta_t)
 Read back the result of a BSYNC delta-t measurement.
 
int ad9088_mcs_init_cal_validate (struct ad9088_phy *phy, adi_apollo_mcs_cal_init_status_t *cal_status)
 Check that MCS init cal aligned the internal SYSREF and locked.
 
void ad9088_mcs_init_cal_status_print (struct ad9088_phy *phy, adi_apollo_mcs_cal_init_status_t *cal_status)
 Print the MCS init cal status and measurements.
 
int ad9088_mcs_tracking_cal_setup (struct ad9088_phy *phy, uint32_t mcs_track_decimation, uint16_t initialize_track_cal)
 Arm MCS tracking calibration.
 

Detailed Description

Multi-chip synchronization calibration for AD9088.

Author
CHegbeli (cipri.nosp@m.an.h.nosp@m.egbel.nosp@m.i@an.nosp@m.alog..nosp@m.com)

Copyright 2026(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ AD9088_MCS_ALIGN_LIMIT_MILLICYCLES

#define AD9088_MCS_ALIGN_LIMIT_MILLICYCLES   400

◆ AD9088_MCS_FS_PER_CYCLE_SCALE

#define AD9088_MCS_FS_PER_CYCLE_SCALE   1000000000000ULL

Function Documentation

◆ ad9088_delta_t_measurement_get()

int ad9088_delta_t_measurement_get ( struct ad9088_phy * phy,
uint32_t mode,
int64_t * apollo_delta_t )

Read back the result of a BSYNC delta-t measurement.

Parameters
phy- The device structure.
mode- 0 for the post-alignment difference, 1 for the delay that needs compensating.
apollo_delta_t- Read value, in femtoseconds.
Returns
- 0 in case of success, negative error code otherwise.

◆ ad9088_delta_t_measurement_set()

int ad9088_delta_t_measurement_set ( struct ad9088_phy * phy,
uint32_t mode )

Start a BSYNC delta-t measurement.

Mode 0 aligns against the incoming BSYNC. Mode 1 makes the device drive BSYNC back out so the provider can measure the return path; mode 2 stops it driving. Running 0 then 1 yields the two halves of the round-trip delay.

Parameters
phy- The device structure.
mode- 0 align, 1 output enable and loopback measure, 2 output disable.
Returns
- 0 in case of success, negative error code otherwise.

◆ ad9088_mcs_init_cal_setup()

int ad9088_mcs_init_cal_setup ( struct ad9088_phy * phy)

Zero the desired internal-to-external SYSREF offsets before init cal.

The offsets are what the calibration aims for; zero asks for the internal SYSREF to land on the external edge. Which offsets exist depends on whether the device runs one clock or two.

Parameters
phy- The device structure.
Returns
- 0 in case of success, negative error code otherwise.

◆ ad9088_mcs_init_cal_status_print()

void ad9088_mcs_init_cal_status_print ( struct ad9088_phy * phy,
adi_apollo_mcs_cal_init_status_t * cal_status )

Print the MCS init cal status and measurements.

Parameters
phy- The device structure.
cal_status- Init cal status read back from the device.

◆ ad9088_mcs_init_cal_validate()

int ad9088_mcs_init_cal_validate ( struct ad9088_phy * phy,
adi_apollo_mcs_cal_init_status_t * cal_status )

Check that MCS init cal aligned the internal SYSREF and locked.

The external and internal SYSREF must end up within +/- 0.4 device clock cycles of the offset the calibration recommended, and the relevant SYSREF must report locked. In dual clock mode both sides are checked and at least one must lock; in single clock mode only the center matters.

Parameters
phy- The device structure.
cal_status- Init cal status read back from the device.
Returns
- 0 when the calibration is good, negative otherwise.

◆ ad9088_mcs_tracking_cal_setup()

int ad9088_mcs_tracking_cal_setup ( struct ad9088_phy * phy,
uint32_t mcs_track_decimation,
uint16_t initialize_track_cal )

Arm MCS tracking calibration.

Tracking cal keeps the internal SYSREF on the external edge as the device clock drifts, by trimming the clock PLL. Only supported in single clock mode.

Parameters
phy- The device structure.
mcs_track_decimation- TDC decimation; higher is more precise.
initialize_track_cal- Initialize the tracking cal, needed unless the device profile already did it.
Returns
- 0 in case of success, negative error otherwise.