Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1946e3c3cd7a
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 07b41763c20a
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Jul 4, 2016

  1. Copy the full SHA
    cda20ab View commit details
  2. Copy the full SHA
    07b4176 View commit details
Showing with 16 additions and 8 deletions.
  1. +15 −7 artiq/coredevice/spi.py
  2. +1 −1 artiq/gateware/spi.py
22 changes: 15 additions & 7 deletions artiq/coredevice/spi.py
Original file line number Diff line number Diff line change
@@ -38,6 +38,21 @@ class SPIMaster:
* If desired, :meth:`write` ``data`` queuing the next
(possibly chained) transfer.
**Notes**:
* In order to chain a transfer onto an in-flight transfer without
deasserting ``cs`` in between, the second :meth:`write` needs to
happen strictly later than ``2*ref_period_mu`` (two coarse RTIO
cycles) but strictly earlier than ``xfer_period_mu + write_period_mu``
after the first. Note that :meth:`write` already applies a delay of
``xfer_period_mu + write_period_mu``.
* A full transfer takes ``write_period_mu + xfer_period_mu``.
* Chained transfers can happen every ``xfer_period_mu``.
* Read data is available every ``xfer_period_mu`` starting
a bit after xfer_period_mu (depending on ``clk_phase``).
* As a consequence, in order to chain transfers together, new data must
be written before the pending transfer's read data becomes available.
:param channel: RTIO channel number of the SPI bus to control.
"""
def __init__(self, dmgr, channel, core_device="core"):
@@ -48,13 +63,6 @@ def __init__(self, dmgr, channel, core_device="core"):
self.write_period_mu = int(0, 64)
self.read_period_mu = int(0, 64)
self.xfer_period_mu = int(0, 64)
# A full transfer takes write_period_mu + xfer_period_mu.
# Chained transfers can happen every xfer_period_mu.
# The second transfer of a chain can be written 2*ref_period_mu
# after the first. Read data is available every xfer_period_mu starting
# a bit after xfer_period_mu (depending on clk_phase).
# To chain transfers together, new data must be written before
# pending transfer's read data becomes available.

@portable
def frequency_to_div(self, f):
2 changes: 1 addition & 1 deletion artiq/gateware/spi.py
Original file line number Diff line number Diff line change
@@ -125,7 +125,7 @@ def __init__(self, data_width, clock_width, bits_width):
NextState("WAIT"),
)
).Else(
self.reg.shift.eq(1),
self.reg.shift.eq(~self.start),
NextState("SETUP"),
)
)