-
Notifications
You must be signed in to change notification settings - Fork 4
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
converting for ADS7884 #3
Comments
The streaming code should almost work as-is; so long as the SPI clock is
being clocked, and the chip select is being selected, something should
emerge from the data line; I suggest you look at the binary data, which
really should contain something meaningful.
My earlier code used SPI Tx for the chip select because I didn't fully
understand how to use the auto-CS capability.
However, be aware that this isn't the easiest ADC to work with; the
datasheet describes the need for power decoupling capacitors, the
low-ish input impedance, and the dynamic (capacitative) sampling
technique, which presumably means the clock rate must be above a minimum
value - I can't remember what that is, but don't expect to get sensible
answers if the rate is too low.
…On 26/05/2021 01:12, BryceDrechselSmith wrote:
First I want to say thank you for your tutorials, they are very clear
and well written.
I am trying to adapt this code to work with the ADS7884 following your
streaming guide and the guide you wrote on fast data capture, but I am
having trouble getting it right. I need to get ~2.5Msamples/sec
some assumptions im making:
* In the streaming code it appears that you are using the PWM to
control the chip select, so i need to change this to SPI
* i need to change the adc_dma_init() func to match
adc_dma_samples_ads7884()
Is there anything else that needs to be done to stream dma from the
ads7884? Any insights you may have are greatly appreciated.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACNUSEV5IOWBBXPPRCZGTR3TPQ4HPANCNFSM45QPBEWA>.
|
so in the rpi_adc_stream I've changed the max sample rate to 2.5Msamples/sec, pwm_freq = 2.5M, max_spi_freq=4M, and SPI_frew = 2.5M. In this configuration running: sudo ./rpi_adc_stream -n 10 -r 200000 -s /tmp/adc.fifo and then monitoring the output in another window with: cat /tmp/adc.fifo shows that ~50% of the readings are good, and the others show 0V. I know that the RPi Zero has a 400Mhz clock, so theoretically i could push those numbers higher, but experimentation shows that doing so gives bad results. |
I don't understand how you'll get 2.5 M sample/s with an SPI clock of
2.5 MHz - at the very least, it takes 16 cycles for a conversion, and
probably more to include the chip select pulse. If you want to run the
SPI clock at 40+ MHz, you do need to keep the wiring short, with a
decent ground line, and supply decoupling capacitors - do take a look at
the datasheet.
Aside from that, I can't really speculate on the cause of this issue;
I'd just connect a scope or logic analyser to the SPI signals, and then
it'd be clear whether this was a ADC or DMA problem.
…On 27/05/2021 00:59, BryceDrechselSmith wrote:
so in the rpi_adc_stream I've changed the max sample rate to
2.5Msamples/sec, pwm_freq = 2.5M, max_spi_freq=4M, and SPI_frew =
2.5M. In this configuration running: sudo ./rpi_adc_stream -n 10 -r
200000 -s /tmp/adc.fifo and then monitoring the output in another
window with: cat /tmp/adc.fifo shows that ~50% of the readings are
good, and the others show 0V. I know that the RPi Zero has a 400Mhz
clock, so theoretically i could push those numbers higher, but
experimentation shows that doing so gives bad results.
Is it possible that this is a result of the way the information is
taken from the ADS7884 vs the MCP3008? In your paper you mentioned
that the number of bits is different and that you were using 3 dummy
bits as padding for the ADS7884.
I appreciate you taking the time to respond, and any insights into
what sections of the code might need changing to make the code run at
~2.6Msamples/sec like in your fast capture article would be very helpful
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACNUSEWQSQNJYDQ7XHXS56TTPWDNNANCNFSM45QPBEWA>.
|
First I want to say thank you for your tutorials, they are very clear and well written.
I am trying to adapt this code to work with the ADS7884 following your streaming guide and the guide you wrote on fast data capture, but I am having trouble getting it right. I need to get ~2.5Msamples/sec
some assumptions im making:
Is there anything else that needs to be done to stream dma from the ads7884? Any insights you may have are greatly appreciated.
The text was updated successfully, but these errors were encountered: