|
|
View previous topic :: View next topic |
Author |
Message |
Marco27293
Joined: 09 May 2020 Posts: 126
|
ADS8867 3-Wire SPI communication with PIC18F47J53 |
Posted: Wed May 10, 2023 3:27 am |
|
|
Hi,
I'm using a pic18f47j53 with pch 5.090 ccs c compiler.
I need to read data from TI ADS8867 ADC using 3-Wire SPI communication.
Could you help me with a snippet code example ?
So far I worked with 4-wire (mode 0,0 or 1,1) SPI protocol with different ADCs and I don't understand how to perform a safe read using only 3 signals...
Link to ADC datasheet (see page 20 3-Wire CS mode paragraph):
https://www.ti.com/lit/ds/symlink/ads8867.pdf
Regards,
Marco |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Wed May 10, 2023 4:38 am |
|
|
The point is the device is a read only device. So it doesn't actually need
you to send a Dout. The Din pin on the chip can be wired high. Operated
like this you need to operate the CONVST pin to trigger the conversion,
and then clock the SPI, throwing away what is read, to actually perform
the conversion, and then drop CONVST, and read back the result.
Now, a lot depends on what PIC you are actually using. On older chips,
you could only do this with software SPI, or by not using the SDO pin. On
your 47J53, you can cheat, and assign the data out pin to the pin you use
for the CONVST. Then once the SPI is configured null this connection, and
use the pin. (Using SPI2) So:
Code: |
//You must have NOIOL1WAY fuse selected
//Choose the pins you want here
#define CONVST PIN_B5
#PIN_SELECT SDO2=CONVST //connect to CONVST
#PIN_SELECT SDI2=PIN_B6 //Connect to Dout
#PIN_SELECT SCK2=PIN_B7 //Connect to SCL
#USE_SPI(SPI2, MODE=1, BAUD=100000, STREAM=ADS)
//It shows the clock idle low, and reading on the falling edge
//of the clock, so 0,1 = mode1
void main(void)
{
int16 read_val;
int8 dummy;
//Then nullify the connection to DOUT
pin_select("NULL",CONVST); //nullify the SDO2 connection
output_low(CONVST);
delay_ms(10);
//Now this would normally be done as a function, but here to show
//Now we need to raise CONVST
output_high(CONVST);
dummy=spi_xfer(ADS,0,8); //clock a single byte 'out' (nothing sent)
output_low(CONVST);
read_val=spi_xfer(ADS,0,16); //clock the 16bit value back
//at this point we have the value read.
|
|
|
|
Marco27293
Joined: 09 May 2020 Posts: 126
|
ADS8867 input Noise in uVrms |
Posted: Wed May 10, 2023 7:10 am |
|
|
Thank You Ttelmah!
Now I'd like to compute ADC input noise in uVRMS.
I do not find this info in ADS8867 datasheet.
How can I find this value ?
Regards |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Thu May 11, 2023 1:48 am |
|
|
The noise performance of the system will depend on a host of other
parameters. The noise performance of your reference source, the input
amplifier, etc. etc..
You can calculate the internal noise, from the specified SNR.
SNR is 20log(RMS(signal)/RMS(noise))
Key point is that this is a high frequency ADC. You normally specify low
frequency ADC's in terms of noise mV, while high frequency ones are
specified in terms of SNR.
Have a look here to explain this difference:
[url]
https://www.electronicdesign.com/technologies/analog/adc/article/21801081/an-inside-look-at-highspeed-adc-accuracy-part-2
[/url]
The calculation I posted is there under section 4. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|