-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Half-duplex SPI readback options in NU mode #11
base: v1.3.x
Are you sure you want to change the base?
Conversation
Triage: to merge this we need to figure out how to handle the protocol revision incompatibility. Thanks for the pr! This looks like a good work around. But I'm worried about the comb logic to the async inputs of the flip flops. That looks problematic. |
How should we proceed with the proto_rev incompatibility? In our setups, we kept Second, how to make this work for >v1.3? The logic here can be copy-pasted without further ado (and the readback FIFO extended to 32 bits as more macrocells are available) and we could test this on hardware in Oxford any time.
Which flip flops are you referring to? When porting this to >v1.3, we should avoid this. It's possible I was forced into using more comb logic in order to fit the design into the small CPLD (while keeping optimisation goal timing). |
Unfortunately I currently don't have the bandwidth to review the compatibility and migration aspects through the entire supply and development landscape or help with design and implementation or test, debug and maintainance of these new aspects that you want to achieve here. |
It was brought to my attention that this feature is desired by many users (why else would I bother making this public?). I am proposing a backwards-compatible solution without incompatibilities, which is well tested already. |
We haven't had a single request or mention. And as you can clearly see here and on the other related PRs, nobody voiced their opinion or interest in this for the almost 1.5 years since this has been posted. Hence all the data that I have indicates that there is zero interest. |
We are very interested and I know others are too. I think the lack of comments and opinions are because this is something that has been working well in production at Oxford for a long time and we all know that. We are just waiting for it to get upstreamed so we can use it too. If this kind of work can't get upstreamed because of @jordens bandwidth or his personal take on user interest we have a problem. |
TL:DR; I'm annoyed by this attitude.
|
I proposed a way to handle the protocol revision incompatibility to address your concern. If you don't think this PR is a good work around anymore, could you explain why you changed your view so we can discuss it?
The redesign you reference doesn't propose a solution to the lack of SPI readback, the topic of this PR. Never mind the merits of a redesign, this PR solves a problem for many users, it is well tested, was developed for free, and - even if it may only be a "nice-to-have" in your personal opinion - this PR enables phase-coherent operation of suservo, something we rely heavily on and I have been asked to share. By all means, I don't mind sharing it on a forked channel as you suggest, but it seems unnecessary to diverge on a small feature like this. |
@jordens If you do not have the bandwidth to review something then I recommend that you simply refrain from commenting, or delegate the review to someone else. It certainly took you more time to write the rant above than it would have taken you to answer Peter's legitimate technical questions, with the very real possibility that an ensuing argument uses even more of your (and other people's) time. It is also not encouraging people to make contributions that we want to have, and squandering the goodwill that obviously went into making this PR and offering more tests. This sounds particularly counter-productive to me.
|
Ack – this is actually what we did internally at first as well. IIRC the reason we switched back to just keeping 8 was just because some people were using older ARTIQ versions. I'll have to leave explaining the flip-flop logic/clocking situation to Peter – I only vaguely remember that the obvious straightforward implementation didn't fit the smaller <v1.4 CPLD, but of course we need to find a glitch-free way of doing this nevertheless. |
Maybe we can implement this new feature on HW v1.4+ only, and keep proto_rev=8 on the v1.3 gateware. This works with the proposed scheme for the ARTIQ driver. (By "support all revisions" above, I meant no regressions with ARTIQ updates). |
@sbourdeauducq I chose to address the comments by @pmldrmota and @dtcallcock because they are structural issues that I see as high risk and impact compared to the technical ones. I see that you'd rather refrain from engaging. It's also not my job to recruit people to delegate reviews and maintenance to. Everybody had the chance to review and comment for 1.5 years and nobody bothered here and on #7. |
Is the revision addressed by this PR (v1.3.x) even affected by #7?
The fitter was running low on resources during synthesis.
Thank you @sbourdeauducq for the notes, I see now that the comb logic on the preset input of the FDPE is critical. I think the change from the one-hot The changes in this PR have two different purposes:
I should've asked this first. Is If
and clock For multi-chip sync delay calibration, we only need the four STA_SMP_ERR bits. At the moment, the STA_SMP_ERR bits are located after the RF switch status bits, which is why the readback shift register needs to be 8 bits long. It could also be 4 if we swap the location of STA_RF_SW and STA_SMP_ERR in the CFG register. This would be a breaking change though, and that's why I chose not to do it. Swapping them would make the task of fitting the design into v1.3.x a lot easier. |
Just did, and I have to correct myself: The one-hot doesn't cost any macrocells. Keeping the one-hot the issue with the async input shouldn't exist anymore, is that correct? |
Due to hardware constraints, the MISO line is unavailable in NU mode. Therefore, an optional half-duplex SPI protocol is implemented using an additional 8-bit shift register.
This is necessary to fit the design into XC2C128-6-TQ144
Avoids incompatibility with current ARTIQ coredevice driver.
Sorry for the force-push wave. I hope it is more readable now. |
This would still glitch. You need to register the one-hot signal synchronously to remove any possibility of glitch.
If it still meets timing and does not break Urukul synchronization (please test), I would think so. Do you absolutely need this feature on HW 1.3 or can you use it only on those v1.4+ boards you have? |
Ok, but this was the original implementation! I changed the code yesterday to remove all my changes from this part. What would be done differently on v1.4+? Now the only difference to the orginal code are
I had hoped that the original implementation was already glitch-free. |
I can't answer this for everyone interested. My experiment will continue to use it on 1.3, mainly because I don't think we have enough v1.4+ to replace them all. But this PR is here for everyone who wants this feature in the future, what do they prefer? I can do the testing on v1.4 and v1.5 as soon as/if this (in particular in the latest form of v1.3.x-rb (1d6a6b0)) or an alternative approach passes your reviews. |
Update: I tested the fixed-up revision (1d6a6b0) on a v1.3 in NU mode.
Are there any more tests you would like me to do? |
Hmm, that's bad. Would you be able to clean it up? |
I don't know how.
Assuming CS is asserted one SPI clock period before the first rising edge, shouldn't this be enough time (2 sysclk cycles) for |
I think this PR should be closed and another one opened for v1.4+, where the shift register can be made 32 bits wide, simplifying both the gateware and the ARTIQ driver significantly. I would agree with
|
Do you not understand the general/fundamental issue with combinatorial glitches into an asynchronous register input, or details of the Urukul CPLD code? |
I understand that it can be a problem. The author of this code @jordens must've been aware of this issue when they wrote it, so I'll leave it to them to explain. If a change is proposed, I'm happy to test it. # clock the latch domain from selection deassertion but only after
# there was a serial clock edge with asserted select (i.e. ignore
# glitches).
Instance("FDPE", p_INIT=1,
i_D=0, i_C=ClockSignal("sck1"), i_CE=~sel[0], i_PRE=sel[0],
o_Q=self.cd_le.clk), |
Due to hardware constraints, the MISO line is unavailable in NU mode. Therefore, an optional half-duplex SPI protocol is implemented using an additional 8-bit shift register.
Tested by @dnadlinger