embeddedsw icon indicating copy to clipboard operation
embeddedsw copied to clipboard

RFSoC unable to set NCO phase to -180.0 deg

Open rikyborg opened this issue 1 year ago • 1 comments

It's possible to choose the phase offset in degrees of the NCO with the field PhaseOffset in the struct XRFdc_Mixer_Settings. However, it's not possible to set the phase to either -180.0 or +180.0 degrees. That is important in some scenarios, for example when an out-of-phase relation is required between NCOs on different ports, or when the NCO phase needs to be swept around the unit circle.

The issue seems to be the check in xrfdc_mixer.c:391:

	if ((MixerSettingsPtr->PhaseOffset >= XRFDC_MIXER_PHASE_OFFSET_UP_LIMIT) ||
	    (MixerSettingsPtr->PhaseOffset <= XRFDC_MIXER_PHASE_OFFSET_LOW_LIMIT)) {
		metal_log(METAL_LOG_ERROR, "\n Invalid phase offset value (%lf) for %s %u block %u in %s\r\n",
			  MixerSettingsPtr->PhaseOffset, (Type == XRFDC_ADC_TILE) ? "ADC" : "DAC", Tile_Id, Block_Id,
			  __func__);
		Status = XRFDC_FAILURE;
		goto RETURN_PATH;
	}

I believe the second condition should be changed from <= to < to allow setting phases in the half-open interval [-180.0, +180.0).

rikyborg avatar Jul 18 '24 07:07 rikyborg

Hi @rikyborg,

Thanks for taking the time to alert us to this issue.

I agree, we will make the necessary changes.

Thanks, Conall.

conallogriofaamd avatar Sep 12 '24 09:09 conallogriofaamd