Move input pin selection from readADC# to startADC# #21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is my attempt to fix #5.
readADC1()tostartADC1(pos,neg). This seems to be working well on ADS1262, but is not testing on ADS1263. I am getting the expected sample rates reading multiple inputs. See below for results example timing.dataReady()function and correspondingsetDrdyPin(uint8_t pin)(matches start pin architecture). Without drdy pin this always returns true.getGain()helper function. This gets the value of the constant used in setGain. Calluint8_t realGain = 1 << adc.getGain()to get actual gain V/V )_ads126x_delaymicro(uint16_t us)hardware definition to dial in the start_pin timing behaviour (as per datasheet section 9.4.1 conversion controls1)My logic is that we want to prep which pins to read BEFORE we start a conversion. When pin selection is in readADC, you are selecting pins after a conversion is already in the output register, but then reading that previous conversion immediately. This is therefore the result of whichever pins you had selected before, and you have to call it a second time to get the result of the pins you now have selected.
Results Example
This is 20SPS + FIR + CHOP (chop roughly doubles conversion time). Pins 0-1 are shorted together, and pins 3-4 are shorted together. Times are in microseconds and are captured at:
(reset timer here and continue loop)
When CHOP is off, time 1 is roughly
51890us- ends up being ~19SPS. You loose a little bit of time flipping between pins, but I think these are really positive results considering there is also multi-stage filtering happening. CHOP is obviously way slower but getting that voltage offset down is so nice.Special thanks to this fantastic review article: https://xdevs.com/review/ti_ads1262_p1/.
Footnotes
pulses should be 4x tCLK which tCLK = 1/fCLK = 1/7.3728Mhz = 1.35633681e-7... ≃ 5.43e-7 ≃ 0.5us. I rounded up to 2uS to be super generous with timing but it could probably be tightened up more. ↩