|
|
View previous topic :: View next topic |
Author |
Message |
baybars
Joined: 13 Apr 2007 Posts: 8
|
LTC2418 SPI, and noise |
Posted: Fri Apr 13, 2007 4:24 pm |
|
|
Hi,
I am using LTC2418 to read T-type thermocouples for my project. Hence, for 1 C resolution is needed about 50uV.
its 24 bit, 5-7hz sampling, high presicion high accurate ADC.
LTC2418 has 1uV layout noise and 0.2ppm noise. total noise musnt get higher than 2uV.
i used max6126 , 2.048V , high presicion voltage refrence.
I can reach each channels with code, i can read voltages,but with noise up to 20mV noise!!!
The problem is , i see noise up to 20mV !!! oscillating noise. There is a 50/60 Hz digital FIR filter inside. I conencted to VCC for 50hz rejection
I used faraday shield, i cahnged layout carefully. Hovever, noise still there...
Hence , i suppose, there can be something wrong with my code.
below data flow of ltc2418,
and channel selection below;
Below my code, simplicified for one reading, for channel 0, at differential mode.
Code: | #include <16F877A.h>
#device adc=8
#fuses NOWDT,HS, PUT, NOPROTECT, NODEBUG, NOBROWNOUT, NOLVP, NOCPD, NOWRT
#use delay(clock=10000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=9)
#define cslow output_low(pin_D0)
void main()
{
int i;
float sign=1;
int8 v1,v2,v3,v4,config;
signed int32 value;
float voltage;
double carpan=2.048/8388608.0;
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(SPI_MASTER|SPI_L_TO_H| SPI_XMIT_L_TO_H |SPI_CLK_DIV_64);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
config = 160; // Differential mode(SGL=0) ,Odd/sign=0 => 160 (+ channel number)
cslow;
delay_ms(500);
for(;;){
v1 = spi_read(config);// write config for next reading
v2 = spi_read(0);
v3 = spi_read(0);
v4 = spi_read(0);
value = make32(v1 & 0x1F, v2, v3, v4 & 0xC0); //make 32
for(i = 0; i <= 5; ++i)
rotate_right(&value,4); // remove 6lsb
if ((v1 & 0x20) == 0){ // check sign bit
value = value - 8388608; // if zero, take twos complement
}
voltage=value;
printf("value=%ld ",value);
voltage=voltage*carpan;
printf("Voltaj degeri = %f\r",voltage);
delay_ms(500);
}
} |
What do you think, is there sometihng wrong with code?
if not, do you think what might be the problem?
Thanks,
Baybars |
|
|
Ttelmah Guest
|
|
Posted: Sat Apr 14, 2007 3:20 am |
|
|
I doubt if it is code.
Remember that you will be transferring noise 'inside' the Faraday cage, with the digital signals. Now you say you have 'changed the layout', and talk about a high precision reference chip, but the layout round this whole area (and the supplies etc.), needs to be very carefully done. I'd suggest a 'virtual ground' ring, round the input pins, and the Vref source. Look really carefully at how each line routes. Do you have access to a spectrum analyser?. If so, you can almost certainly identify the noise source, by looking at the frequencies that are present. Is your capacitance load on the ADC, inside the spec, even at the frequencies concerned (remember that a capacitor will actually have different real capacitances at different frequencies, and that high gain circuits like this, can be unstable, if the selected capacitor has poor HF performance).
Best Wishes |
|
|
baybars
Joined: 13 Apr 2007 Posts: 8
|
|
Posted: Sat Apr 14, 2007 2:29 pm |
|
|
Thanks Ttelmah for reply and advices,
I had used faraday cage, after i see a noise, than reslut, noise not changed. And as you said, its not working .
My pins not rounded.
I can use a spectrum analyser after sunday. I will try to determine noise source.
However, noise( about 5-15 mV usually, and can reach 20mV) isnt too high?
With 10bit pic877 's ADC, i can read voltage with 10mV sensitive, and there noise is not higher than 5mV. Although its layout is not very caregfully draw. Now i have high presicion chip and noise is very high.
Thanks again,
Regards, |
|
|
Ttelmah Guest
|
|
Posted: Sat Apr 14, 2007 2:39 pm |
|
|
Which is one reason why I am particularly suspicious it might be a problem with the Vref (having had problems with the Maxim units before...).
Best Wishes |
|
|
baybars
Joined: 13 Apr 2007 Posts: 8
|
|
Posted: Sat Apr 14, 2007 5:25 pm |
|
|
On the code,
i read four 8 bits, for 4 integers, they are v1, v2 ,v3 ,v4.
i have to remove 3 Most significiant bits from v1,
and i have to remove 6 least significiant bits from v4
hence, i make 32 them and i suppose i am removing 6 significiant bits as below
Code: |
value = make32(v1 & 0x1F, v2, v3, v4 & 0xC0); //make 32, remove 3MSB form v1, take v4's 2 MSB,
for(i = 0; i <= 5; ++i)
rotate_right(&value,4); // remove 6lsb, is it right???
|
is it right code? |
|
|
Ttelmah Guest
|
|
Posted: Sun Apr 15, 2007 2:34 am |
|
|
[quote="baybars"]On the code,
i read four 8 bits, for 4 integers, they are v1, v2 ,v3 ,v4.
i have to remove 3 Most significiant bits from v1,
and i have to remove 6 least significiant bits from v4
hence, i make 32 them and i suppose i am removing 6 significiant bits as below
[code]
value = make32(v1 & 0x1F, v2, v3, v4 & 0xC0); //make 32, remove 3MSB form v1, take v4's 2 MSB,
for(i = 0; i <5>> construct, or division (the compiler is smart enough to code a binary division as a shift)?.
So:
value = value>>6;
or
value = value/64;
I'd use 'shift' operations, rather than rotation operations, this way you don't need to mask the low bits in the 'make32', since they will be removed, rather than rotated round into the top of the number. There are sometimes problems wth some of the CCS operations like this, when a 'construct', rather than a variable is used (the temporary variables used by the compiler can get corrupted), so I'd probably just do:
[code]
value = make32(v1 , v2, v3, v4 );
value = ((value>>6) & 0x7FFFFF);
[/code]
Or (potentially quicker), just mask V1 first, so:
[code]
v1 &= 0x1F;
value = make32(v1 , v2, v3, v4 );
value /=64;
[/code]
The latter, is I think about as efficient as it can be done.
Best Wishes |
|
|
baybars
Joined: 13 Apr 2007 Posts: 8
|
|
Posted: Sat Apr 21, 2007 4:54 am |
|
|
Ttelmah, Thanks for your help,
i didnt able to acces spectrum analyser, but i used oscilloscope yesterday,
I found the noise source, it is PIC16f877 !!! its strange,
on pics ground pins,i see 40mV peak- to-peak, 10MHz (same with crystals frequency) noise. When i fallow graound trace from pic to the supply's ground, noise was reduced.
Same problem, i see on VCC pins,
Hence, i made star connection for VCC pins, For LTC2418 and pic.
I connect 100nF cap between power pins pf PIC,
now, noise is reduced to 6-7 uV. i need 50uV resolution abd its enough for me. However, it will be reduced more.
The solution is very easy, when you know the way,
Thank you again Ttelmah, |
|
|
|
|
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
|