Description
Hi,
I hope to use your library to read an ADC, I need to be able to do the transfers with best possible speed. One application for example is the readout for a linear CCD (4k of 16 bit samples). In my lab we read long records at 500KSPS, to study slow charge mobility at microampere currents in organic electronics.
We are trying to adapt this now to the UNO R4, (an RA4M1).
I found some issues with the transfer16().
Here is code and a scope images for transfer16() on the UNO R4. The upper trace is the SPI clock. The lower trace is CS pin, which I am using to assert the CNVST of the ADC. Data is available 700 nsec after the rising edge of CNVST and falling edge enables SPI transfer.
Notice that there is a 2.5usec setup time for the transfer, and then the transfer occurs as two 8 byte transfers, separated by 1.2usec rather than as a single 16 bit transfer. I checked in your code, and indeed it is done as two 8 bit transfer.
So, I think what is need is a true 16 bit transfer16(). You already do something like that in the buffered transfer (the next function in the source code file after tansfer16()).
Also, for reading a long record from the ADC, it would be great is some of that setup time could be moved outside the loop.
I hesitate to do this myself. Looking at your code , you did a great job and wou are already quite expert in the part,
Thank you
digitalWrite(CNVSTPIN,HIGH;
DELAYNANOSECONDS(700)
digitalWrite(CNVSTPIN,LOW);
dataword = SPI.transfer16(0xFFFF);