2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 03:08:27 +08:00

metlino_sayma_ttl: Fix RTIO frequency & demo code (#1516)

This commit is contained in:
Harry Ho 2020-09-03 15:08:31 +08:00 committed by GitHub
parent 47e88dfcbe
commit 458a411320
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 23 deletions

View File

@ -5,7 +5,7 @@ device_db = {
"type": "local",
"module": "artiq.coredevice.core",
"class": "Core",
"arguments": {"host": core_addr, "ref_period": 1/(8*125e6)}
"arguments": {"host": core_addr, "ref_period": 1/(8*150e6)}
},
"core_log": {
"type": "controller",

View File

@ -58,6 +58,17 @@ class Demo(EnvExperiment):
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
def drtio_is_up(self, drtio_index):
if not self.core.get_rtio_destination_status(drtio_index):
@ -77,15 +88,13 @@ class Demo(EnvExperiment):
led.pulse(100*ms)
delay(100*ms)
@kernel
def test_leds(self):
print("*** Testing LEDs.")
print("Check for blinking. Press ENTER when done.")
for i in range(len(self.leds)):
led = self.leds[i:i+1]
print("Testing LED:", i)
self.test_led([dev for _, dev in led][0])
for led_name, led_dev in self.leds:
print("Testing LED: {}".format(led_name))
self.test_led(led_dev)
@kernel
def test_ttl_out_chunk(self, ttl_chunk):
@ -100,7 +109,6 @@ class Demo(EnvExperiment):
delay(1*us)
delay(10*us)
@kernel
def test_ttl_outs(self):
print("*** Testing TTL outputs.")
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("Press ENTER when done.")
# for ttl_chunk in chunker(self.ttl_outs, 4):
for i in range(len(self.ttl_outs) // 4):
chunk_start, chunk_end = i*4, (i+1)*4
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])
for ttl_chunk in chunker(self.ttl_outs, 4):
print("Testing TTL outputs: {}.".format(", ".join(name for name, dev in ttl_chunk)))
self.test_ttl_out_chunk([dev for name, dev in ttl_chunk])
@kernel
def run(self):
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:
self.test_leds()