-
Notifications
You must be signed in to change notification settings - Fork 27
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
Adding documentation, updating DAC output timing #208
Adding documentation, updating DAC output timing #208
Conversation
Pretty sure the delay is two batches, not one. You'd measure from first sample of an ADC batch to (corresponding) first sample of a DAC batch. |
///! such, one of the ADCs will be sampled marginally earlier before the other because the DMA | ||
///! requests are generated simultaneously. This can be avoided by providing a known offset to the | ||
///! sample DMA requests, which can be completed by setting e.g. ADC0's comparison to a counter | ||
///! value of 0 and ADC1's comparison to a counter value of 1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should do that by default. The risk of having the sequence of ADC0/1 winning the bus arbitration race change between samples is worse than the constant skew.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ADC0/ADC1 never race for the bus because of natural priority of the DMA transfers (since they are using the same DMA peripheral). This means the DMA peripheral arbitrates between ADC0 and ADC1 internally in a deterministic manner.
///! simultaneously. If only a single ADC is used, it must always be ADC0, as ADC1 will not generate | ||
///! transfer-complete interrupts. | ||
///! | ||
///! There is a very small amount of latency between sampling of ADCs due to bus matrix priority. As |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How might we be able to calculate this latency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latency is 1 bus matrix clock. However, since the bus might be used by for example the CPU, it might get delayed further. Because this latency is in the range of a handful of AXI bus clocks, that's what I used the phrase "a very small amount"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Essentially, the latency is not deterministic, hence why it's not clearly specified here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we specify some sort of worst case number? This allows someone to make the determination of "I don't care about this latency".
///! | ||
///! # Note | ||
///! | ||
///! There is a very small amount of latency between updating the two DACs due to bus matrix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How much latency? We describe it in terms of "timer ticks" below, but nano- or microseconds would also be nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same as with the ADCs. It's actually an undeterministic number of AXI bus cycles, hence why it's unspecified.
Something that is implied but not plainly explained is how the ADC/DAC constraints sum up to create the constraints of the DSP application code. Something like:
How will the end user know that their DSP application code meets these constraints? Once this code is stabilized I imagine that we can provide equations to estimate how much time the DSP application has based on parameters like sampling rate and batch size. Will we eventually have some sort of burden reporting mechanism so the end user can test code and see how much more they can add before hitting one of the limits? |
Concerning my burden question, it seems like #166 might address it? |
Co-authored-by: Robert Jördens <[email protected]>
…er into feature/io-docs
@irwineffect I've added the blurb you provided to describe the DSP timing constraints - thanks for writing it up. In regard to knowing whether an application is meeting timing: The ADC inputs listen for an overrun on the SPI peripheral, which generates an interrupt that panics. Thus, if timing is not met, the firmware will panic and make it obvious to the end user that timing is not being met. Ultimately, #166 will also aid with this as you point out. |
///! simultaneously. If only a single ADC is used, it must always be ADC0, as ADC1 will not generate | ||
///! transfer-complete interrupts. | ||
///! | ||
///! There is a very small amount of latency between sampling of ADCs due to bus matrix priority. As |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we specify some sort of worst case number? This allows someone to make the determination of "I don't care about this latency".
Timing for batch sizes > 1 was verified. It was found that batch_size = 1 results in an extra batch delay from input -> output, and I haven't been able to figure out the cause. I spawned an issue in #229 so we can track it as necessary. |
This PR adds extensive documentation to the asynchronous IO modules on stabilizer. This fixes #171
This PR also updates the DAC codes so that DAC + ADC batches are always synchronous (DAC codes are exactly 2 batches after the ADC sample that generated them). In this implementation, DAC batches are always delayed by exactly 1 additional batch size from the original ADC sample batch that generated them.
There are thus two DAC batches with fixed output-zero codes at the very start of stabilizer processing.
This PR fixes #185
TODO: