Thank you for all your answers.
So far, I was not successful. I am trying with DIO_SMA
which is on port 0. IO0 to IO3 are set to input direction, IO4 to IO7 are set as output direction. Here is the snippet of my json configuration:
{
"type": "dio_spi",
"board": "DIO_SMA",
"ports": [0],
"spi": [
{
"name": "sma_spi",
"clk": 7,
"mosi": 5
}
]
},
and here the relevant lines from device_db.py
generated using artiq_ddb_template.exe
:
device_db["sma_spi0"] = {
"type": "local",
"module": "artiq.coredevice.spi2",
"class": "SPIMaster",
"arguments": {"channel": 0x000000}
}
If I attach the scope to IO4 and run this script
from artiq.experiment import *
class SPITest(EnvExperiment):
def build(self):
self.setattr_device("core")
self.setattr_device("sma_spi0")
@kernel
def run(self):
self.core.break_realtime()
data = 0xf0f0f0f0
for i in range(1000):
self.sma_spi0.write(data)
delay(1*ms)
I unfortunately don't see any output.
What confuses me is that while in the json file clk
is required, the channel number for clk
is not used in the creation of device_db.py
(see: https://github.com/m-labs/artiq/blob/376fbaafc5a4e33a956beda66ea0fbe0e198b363/artiq/frontend/artiq_ddb_template.py#L124). Same holds true for miso
and mosi
.
Are the channel numbers hard-coded? Or what determines which channel numbers have what functionality?