-
Notifications
You must be signed in to change notification settings - Fork 7
Fix ADC Missed 1 Bit Error #28
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
base: master
Are you sure you want to change the base?
Conversation
I don't follow your numbers. There is information missing. |
I typed the unit wrongly. Should be mV instead of uV. I have edited the PR message with clearer descriptions. |
Thanks for the revised analysis. I'm not happy with the timing on that tDCNVSCKL. We want to ensure it's at least 10 ns plus the prop delay of the CNV driver by looking at the code! Since the SCK cycle is 10 ns in the code, there needs to be at least another 4 ns delay cycle between the CNV assertion and the start of the SCK shifting. Either through the FSM logic or buffer/IO registers. Also you don't make an attempt to argue why your change is the correct fix. You need to do that, otherwise it's accidental. Why not change the synthesizer reset value? Is that value correct? Don't look at your scope so much. The sample rate is set in the code. It was either wrong before and/or it's wrong now. Can you check the t_read calculation and whether it meets the timing requirements now? Regarding the sampling edge: "proof by example" doesn't work. Correct values are inconclusive. You have to analyze the code and the timings. If we touch this code, I would like the design to be correct. |
- To read the missed data bit in each transaction
9579716
to
0c5f99d
Compare
Correction: SCK should be 250MHz / 6 -> 83.3MHz. (Double Checked on oscilloscope) The original code was designed to be idle high on simulation. I think the original author forgot that the polarity of For the measurement I took, I used two Rigol Pvp2350 Probe, which has an 50 pF rated capacitance, to probe the IC24's Output. Looking at the datasheet, the fall time is way out of spec. Therefore, without probing the IC24's Output. the fall time should be way better. But, I agree with you that I should take a closer look at the timing. Previously, I didn't considered the IOB Delay. Turns out in the boundary cases, If I also take the IOB delay into account, t_DCNVSCKL will be violated if I do not adjust the Timings
Looking at the datasheet, swapping the polarity of Timing RequirementsSN65LVDS2DBVR propagation delay @ 30 degree = t_DCNVSDOZ should have no problem after flipping the SCK polarity. So, let's consider the worse case scenario for t_DCNVSCKL, let's name the delay to be Expected Timings Before Changet_DCNVSCKL = t_conv * sys_period + SCK_period/2 + Expected Timings After Changet_DCNVSCKL = t_conv * sys_period + sys_period + SimulationsI changed DO NOTE that as we cannot simulate any output primitives, the polarity Original Code
PR Code
Set the ddr_clk_synth Reset Value to
|
Certainly not.
Do that then! Less logic, fewer inversions, simpler. Changing t_rtt needs a rationale as well. t_rtt is not just for tDSCKLCNVH but also for synchronizing the ret->sys crossing (not for sdo sampling, that's done by the source synchronous design). Changing clock polarity then has an affect on both factors. |
Description of Changes
I found this when I was trying to add a register to read out the ADC data for artiq_sinara_tester for production test. There is one bit that is missed and not read for each transaction. This is due to SCK in the current gateware not being idle HIGH as specified in the LTC2323-16 datasheet. See below for reference.
Note: Timing Diagram from LTC2323-16 datasheet
To fix it, I flipped the SCK period and adjust the t_conv(3->4) and t_rtt(6->5) accordingly to meet the timings,
Original Code Captured Waveform
I probed the ADC input directly at the input capacitor. That is around -557.875mV across. Given Vref of 4.096V, the LSB size is 125uV (given in the datasheet Transfer Function Section). Therefore, if it is read correctly, the readings should be 0xEE91. However, the value read is 0xF748 instead. This is due to the last bit is not clocked in by the gateware.
Notice the SCK here in the original code is idle low. Since the ADC data is clocked out at the falling edge, at the end of the transaction, there is a bit missed and is not read by the gateware (circled in red). See the captured example waveform below.
To verify the gateware did missed the last bit, I added a phaser register to access the adc readings via Artiq. The gateware did miss the last bit of the adc readings.
Note: SCK is slowed down to account for the logic analyzer bandwidth.
PR Code Captured Waveforms
Flipping the output of SCK can already fix this issue. After the change, it now reads all the 16 bit readings and close to the theoretical value(0xEE91). See the captured waveform below.

Note: SCK is slowed down to account for the logic analyzer bandwidth.
See the captured waveform below for the t_DCNVSCKL timing requirement at the original SCK frequency(83.3MHz). SCK stays quiet for at least 10ns after the falling edge of CNVN.

Note: CNVN: IC24's Output | SCK+: R5 ADC_SCK_P Net
The sampling frequency remains unchanged.

At the original SCK speed with the PR fix, I read the adc readings via Artiq with the newly added phaser register. All 16 bits are present and the value read is closed to the theoretical value. So, the gateware is sampling on the right edge.