forked from M-Labs/artiq
1
0
Fork 0

ad9910: simplify io_update pulsing on init, set_mu

Signed-off-by: Robert Jördens <rj@quartiq.de>
This commit is contained in:
Robert Jördens 2018-10-25 16:02:13 +00:00
parent 0b3b07a7da
commit 8dbf5f87fd
1 changed files with 5 additions and 6 deletions

View File

@ -136,7 +136,7 @@ class AD9910:
""" """
# Set SPI mode # Set SPI mode
self.write32(_AD9910_REG_CFR1, 0x00000002) self.write32(_AD9910_REG_CFR1, 0x00000002)
self.cpld.io_update.pulse(2*us) self.cpld.io_update.pulse(1*us)
delay(1*ms) delay(1*ms)
if not blind: if not blind:
# Use the AUX DAC setting to identify and confirm presence # Use the AUX DAC setting to identify and confirm presence
@ -146,13 +146,13 @@ class AD9910:
delay(50*us) # slack delay(50*us) # slack
# Configure PLL settings and bring up PLL # Configure PLL settings and bring up PLL
self.write32(_AD9910_REG_CFR2, 0x01400020) self.write32(_AD9910_REG_CFR2, 0x01400020)
self.cpld.io_update.pulse(2*us) self.cpld.io_update.pulse(1*us)
cfr3 = (0x0807c100 | (self.pll_vco << 24) | cfr3 = (0x0807c100 | (self.pll_vco << 24) |
(self.pll_cp << 19) | (self.pll_n << 1)) (self.pll_cp << 19) | (self.pll_n << 1))
self.write32(_AD9910_REG_CFR3, cfr3 | 0x400) # PFD reset self.write32(_AD9910_REG_CFR3, cfr3 | 0x400) # PFD reset
self.cpld.io_update.pulse(100*us) self.cpld.io_update.pulse(1*us)
self.write32(_AD9910_REG_CFR3, cfr3) self.write32(_AD9910_REG_CFR3, cfr3)
self.cpld.io_update.pulse(100*us) self.cpld.io_update.pulse(1*us)
if blind: if blind:
delay(100*ms) delay(100*ms)
return return
@ -172,7 +172,6 @@ class AD9910:
:param bits: power down bits, see datasheet :param bits: power down bits, see datasheet
""" """
self.write32(_AD9910_REG_CFR1, 0x00000002 | (bits << 4)) self.write32(_AD9910_REG_CFR1, 0x00000002 | (bits << 4))
delay(1*us)
self.cpld.io_update.pulse(1*us) self.cpld.io_update.pulse(1*us)
@kernel @kernel
@ -187,7 +186,7 @@ class AD9910:
:param asf: Amplitude scale factor: 14 bit unsigned. :param asf: Amplitude scale factor: 14 bit unsigned.
""" """
self.write64(_AD9910_REG_PR0, (asf << 16) | pow, ftw) self.write64(_AD9910_REG_PR0, (asf << 16) | pow, ftw)
self.cpld.io_update.pulse(10*ns) self.cpld.io_update.pulse_mu(8)
@portable(flags={"fast-math"}) @portable(flags={"fast-math"})
def frequency_to_ftw(self, frequency): def frequency_to_ftw(self, frequency):