forked from M-Labs/artiq
metlino_sayma_ttl: Fix RTIO frequency & demo code (#1516)
This commit is contained in:
parent
47e88dfcbe
commit
458a411320
|
@ -5,7 +5,7 @@ device_db = {
|
||||||
"type": "local",
|
"type": "local",
|
||||||
"module": "artiq.coredevice.core",
|
"module": "artiq.coredevice.core",
|
||||||
"class": "Core",
|
"class": "Core",
|
||||||
"arguments": {"host": core_addr, "ref_period": 1/(8*125e6)}
|
"arguments": {"host": core_addr, "ref_period": 1/(8*150e6)}
|
||||||
},
|
},
|
||||||
"core_log": {
|
"core_log": {
|
||||||
"type": "controller",
|
"type": "controller",
|
||||||
|
|
|
@ -58,6 +58,17 @@ class Demo(EnvExperiment):
|
||||||
shiftreg_bits(1, dio_bank0_out_pins | dio_bank1_out_pins)
|
shiftreg_bits(1, dio_bank0_out_pins | dio_bank1_out_pins)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@kernel
|
||||||
|
def init(self):
|
||||||
|
self.core.break_realtime()
|
||||||
|
print("*** Waiting for DRTIO ready...")
|
||||||
|
drtio_indices = [7]
|
||||||
|
for i in drtio_indices:
|
||||||
|
while not self.drtio_is_up(i):
|
||||||
|
pass
|
||||||
|
|
||||||
|
self.fmcdio_dirctl.set(self.dirctl_word)
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def drtio_is_up(self, drtio_index):
|
def drtio_is_up(self, drtio_index):
|
||||||
if not self.core.get_rtio_destination_status(drtio_index):
|
if not self.core.get_rtio_destination_status(drtio_index):
|
||||||
|
@ -77,15 +88,13 @@ class Demo(EnvExperiment):
|
||||||
led.pulse(100*ms)
|
led.pulse(100*ms)
|
||||||
delay(100*ms)
|
delay(100*ms)
|
||||||
|
|
||||||
@kernel
|
|
||||||
def test_leds(self):
|
def test_leds(self):
|
||||||
print("*** Testing LEDs.")
|
print("*** Testing LEDs.")
|
||||||
print("Check for blinking. Press ENTER when done.")
|
print("Check for blinking. Press ENTER when done.")
|
||||||
|
|
||||||
for i in range(len(self.leds)):
|
for led_name, led_dev in self.leds:
|
||||||
led = self.leds[i:i+1]
|
print("Testing LED: {}".format(led_name))
|
||||||
print("Testing LED:", i)
|
self.test_led(led_dev)
|
||||||
self.test_led([dev for _, dev in led][0])
|
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def test_ttl_out_chunk(self, ttl_chunk):
|
def test_ttl_out_chunk(self, ttl_chunk):
|
||||||
|
@ -100,7 +109,6 @@ class Demo(EnvExperiment):
|
||||||
delay(1*us)
|
delay(1*us)
|
||||||
delay(10*us)
|
delay(10*us)
|
||||||
|
|
||||||
@kernel
|
|
||||||
def test_ttl_outs(self):
|
def test_ttl_outs(self):
|
||||||
print("*** Testing TTL outputs.")
|
print("*** Testing TTL outputs.")
|
||||||
print("Outputs are tested in groups of 4. Touch each TTL connector")
|
print("Outputs are tested in groups of 4. Touch each TTL connector")
|
||||||
|
@ -108,25 +116,12 @@ class Demo(EnvExperiment):
|
||||||
print("pulses corresponds to its number in the group.")
|
print("pulses corresponds to its number in the group.")
|
||||||
print("Press ENTER when done.")
|
print("Press ENTER when done.")
|
||||||
|
|
||||||
# for ttl_chunk in chunker(self.ttl_outs, 4):
|
for ttl_chunk in chunker(self.ttl_outs, 4):
|
||||||
for i in range(len(self.ttl_outs) // 4):
|
print("Testing TTL outputs: {}.".format(", ".join(name for name, dev in ttl_chunk)))
|
||||||
chunk_start, chunk_end = i*4, (i+1)*4
|
self.test_ttl_out_chunk([dev for name, dev in ttl_chunk])
|
||||||
ttl_chunk = self.ttl_outs[chunk_start:chunk_end]
|
|
||||||
print("Testing TTL outputs:", chunk_start, chunk_start+1, chunk_start+2, chunk_start+3)
|
|
||||||
self.test_ttl_out_chunk([dev for _, dev in ttl_chunk])
|
|
||||||
|
|
||||||
@kernel
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.core.reset()
|
self.core.reset()
|
||||||
delay(10*ms)
|
|
||||||
print("*** Waiting for DRTIO ready...")
|
|
||||||
drtio_indices = [7]
|
|
||||||
for i in drtio_indices:
|
|
||||||
while not self.drtio_is_up(i):
|
|
||||||
pass
|
|
||||||
|
|
||||||
self.fmcdio_dirctl.set(self.dirctl_word)
|
|
||||||
delay(10*ms)
|
|
||||||
|
|
||||||
if self.leds:
|
if self.leds:
|
||||||
self.test_leds()
|
self.test_leds()
|
||||||
|
|
Loading…
Reference in New Issue