From a8bc98a77b83879c299ec607689a71f2088aa810 Mon Sep 17 00:00:00 2001 From: Etienne Wodey Date: Thu, 28 Jan 2021 17:33:55 +0100 Subject: [PATCH] coredevice/adf5356: fix initial device detection Signed-off-by: Etienne Wodey --- artiq/coredevice/adf5356.py | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/artiq/coredevice/adf5356.py b/artiq/coredevice/adf5356.py index 37505682f..dae2c97cb 100644 --- a/artiq/coredevice/adf5356.py +++ b/artiq/coredevice/adf5356.py @@ -82,18 +82,25 @@ class ADF5356: """ if not blind: # MUXOUT = VDD - self.write(ADF5356_REG4_MUXOUT(1) | 4) - delay(5000 * us) + self.regs[4] = ADF5356_REG4_MUXOUT_UPDATE(self.regs[4], 1) + self.sync() + delay(1000 * us) if not self.read_muxout(): raise ValueError("MUXOUT not high") - delay(1000 * us) + delay(800 * us) # MUXOUT = DGND - self.write(ADF5356_REG4_MUXOUT(2) | 4) - delay(5000 * us) + self.regs[4] = ADF5356_REG4_MUXOUT_UPDATE(self.regs[4], 2) + self.sync() + delay(1000 * us) if self.read_muxout(): raise ValueError("MUXOUT not low") - delay(1000 * us) + delay(800 * us) + + # MUXOUT = digital lock-detect + self.regs[4] = ADF5356_REG4_MUXOUT_UPDATE(self.regs[4], 6) + else: + self.sync() @kernel def set_att_mu(self, att): @@ -430,9 +437,9 @@ class ADF5356: self.regs[6] |= ADF5356_REG6_NEGATIVE_BLEED(1) # charge pump bleed current - # self.regs[6] |= ADF5356_REG6_CP_BLEED_CURRENT( - # int32(floor(24 * self.f_pfd / (61.44 * MHz))) - # ) + self.regs[6] |= ADF5356_REG6_CP_BLEED_CURRENT( + int32(floor(24 * self.f_pfd() / (61.44 * MHz))) + ) # direct feedback from VCO to N counter self.regs[6] |= ADF5356_REG6_FB_SELECT(1) @@ -474,6 +481,10 @@ class ADF5356: | ADF5356_REG9_TIMEOUT(0x67) ) + self.regs[9] |= ADF5356_REG9_VCO_BAND_DIVISION( + int32(ceil(self.f_pfd() / 160e3)) + ) + # REG10 # =====