Hi, I am trying to sync the DAC output with an external clock. I’ve been looking through the manual and xrfdc code to help, but am nonetheless having difficulties. My understanding is that (within the base overlay) I can change the mixer settings in the DAC to have:

channel.dac_block.MixerSettings[‘EventSource’] = xrfdc.EVNT_SRC_SYSREF

Then, the mixer should now update relative to the sys ref. But, I get the error:

RuntimeError: Function XRFdc_UpdateEvent call failed
stdout: metal: error:
Invalid Event Source (1), this should be issued external to the driver for DAC 0 block 0 in XRFdc_UpdateEvent

It says I should be changing the event source outside of the DAC, but it is unclear to me where I should do this. Is there anyway using the base overlay and pynq python wrapper to adjust the clocking source? If so, what code could I run to do so? Any help is appreciated!

1 Like

Hi there,

Don’t think I’ve encountered this myself. Do you have a small reproducible example of how you’re calling the code? Are you doing it like in e.g. the QPSK demo here? There’s one code snippet of the procedure for using sysref in the rfdc manual, p180 that might be a useful reference to look at. Hope this helps.


Hi Shawn,

I don’t think this is exactly like the QPSK demo and may even be more basic. I am trying to follow the steps on page 180 for MTS. I added the following to xrfdc as part of the RFdc class.

    def RunMTS(self):
        self._DAC_Sync_Config ="XRFdc_MultiConverter_Sync_Config*")
        self._ADC_Sync_Config ="XRFdc_MultiConverter_Sync_Config*")


        self._DAC_Sync_Config.Tiles = 0x3
        self._DAC_Sync_Config.SysRef_Enable = 1
        self._DAC_Sync_Config.Target_Latency = 296
        self.status1 = _lib.XRFdc_MultiConverter_Sync(self._instance, _lib.XRFDC_DAC_TILE,self._DAC_Sync_Config)

    def sysrefDisable(self):
        self.status3 = _lib.XRFdc_MTS_Sysref_Config(self._instance, self._DAC_Sync_Config,self._ADC_Sync_Config, self.enable[0])

    def sysrefEnable(self):
        self.status3 = _lib.XRFdc_MTS_Sysref_Config(self._instance, self._DAC_Sync_Config, self._ADC_Sync_Config, self.enable[0])

    def printLatency(self):
        for i in range(2):
            print("Dac Latency: "+str(self._DAC_Sync_Config.Latency[i]))
            print("Dac offset: "+str(self._DAC_Sync_Config.Offset[i]))

Then, in my data collection I run

base = BaseOverlay('base.bit')

gain=0.33[0].dac_block[1].dac_block[0].control.enable = True[0].control.gain = gain[1].control.enable = True[1].control.gain = gain

dac00.NyquistZone = 1
dac00.MixerSettings['EventSource'] = xrfdc.EVNT_SRC_SYSREF
dac00.MixerSettings['Freq'] = freq[0].SetupFIFO(True)

dac01.NyquistZone = 1
dac01.MixerSettings['EventSource'] = xrfdc.EVNT_SRC_SYSREF
dac01.MixerSettings['Freq'] = freq[1].SetupFIFO(True)

which gives output:
Dac Latency: 0
Dac offset: 0
Dac Latency: 0
Dac offset: 0

The zero latencies are definitely a sign that this is not working. I also have the outputs connected to an oscilloscope and can see that they are not synced :confused: Do you see an reason this is failing?

Thank you!

P.S. Credit to fjtoralza as my code is largely drawn from their post.