forked from M-Labs/artiq
1
0
Fork 0

Merge pull request #1596 from airwoodix/fix-adf5356-init

coredevice/adf5356: fix initial device detection
This commit is contained in:
Robert Jördens 2021-02-02 18:20:08 +01:00 committed by GitHub
commit 2f5ea67b69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 9 deletions

View File

@ -82,18 +82,25 @@ class ADF5356:
""" """
if not blind: if not blind:
# MUXOUT = VDD # MUXOUT = VDD
self.write(ADF5356_REG4_MUXOUT(1) | 4) self.regs[4] = ADF5356_REG4_MUXOUT_UPDATE(self.regs[4], 1)
delay(5000 * us) self.sync()
delay(1000 * us)
if not self.read_muxout(): if not self.read_muxout():
raise ValueError("MUXOUT not high") raise ValueError("MUXOUT not high")
delay(1000 * us) delay(800 * us)
# MUXOUT = DGND # MUXOUT = DGND
self.write(ADF5356_REG4_MUXOUT(2) | 4) self.regs[4] = ADF5356_REG4_MUXOUT_UPDATE(self.regs[4], 2)
delay(5000 * us) self.sync()
delay(1000 * us)
if self.read_muxout(): if self.read_muxout():
raise ValueError("MUXOUT not low") 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 @kernel
def set_att_mu(self, att): def set_att_mu(self, att):
@ -430,9 +437,9 @@ class ADF5356:
self.regs[6] |= ADF5356_REG6_NEGATIVE_BLEED(1) self.regs[6] |= ADF5356_REG6_NEGATIVE_BLEED(1)
# charge pump bleed current # charge pump bleed current
# self.regs[6] |= ADF5356_REG6_CP_BLEED_CURRENT( self.regs[6] |= ADF5356_REG6_CP_BLEED_CURRENT(
# int32(floor(24 * self.f_pfd / (61.44 * MHz))) int32(floor(24 * self.f_pfd() / (61.44 * MHz)))
# ) )
# direct feedback from VCO to N counter # direct feedback from VCO to N counter
self.regs[6] |= ADF5356_REG6_FB_SELECT(1) self.regs[6] |= ADF5356_REG6_FB_SELECT(1)
@ -474,6 +481,10 @@ class ADF5356:
| ADF5356_REG9_TIMEOUT(0x67) | ADF5356_REG9_TIMEOUT(0x67)
) )
self.regs[9] |= ADF5356_REG9_VCO_BAND_DIVISION(
int32(ceil(self.f_pfd() / 160e3))
)
# REG10 # REG10
# ===== # =====