This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADC read error RM48

Other Parts Discussed in Thread: HALCOGEN

hi,

I am facing a problem while reading the group of ADC channel.

I have connected 10 sensors to my ADC channel 1 in RM48.

if i connect all the sensors it is working fine all the outputs are ok. if i disconnect one from the 10 all the ADC read outputs are getting affected and showing the wrong results.

I have attached the halcogen configuration and codes below. please suggest some ideas to solve the problem.

ccs codes:

uint32 ADChex(int i){
gioSetBit(gioPORTB, 0, 1);
while((adcIsConversionComplete(adcREG1,adcGROUP1))==0);
ch_count = adcGetData(adcREG1, adcGROUP1,&adc_data[0]);
ch_count = ch_count;
gioSetBit(gioPORTB, 0, 0);
return adc_data[i].value;
}

void airpr()
{
ad = ADChex(4);
adc2dec = (ad/0x100)*256 + ((ad/0x10)%0x10)*16 + (ad%0x10)*1 ;
HP_Air= (1.5608*adc2dec)/819 - 1.2835;
HP_Air = HP_Air*100;

}

Halcogen con:

  • Hi,
    Can you try to increase the sampling time and try to see if it makes a difference? Currently your sampling time is 200ns. Try to increase it to 1000ns.
  • Hi, Mr.Charles,

    Thank you for the suggestion. I will try and update the result.

    regards

    K.Manjunathan

  • hi, Mr.charles,

    I have increase the sampling time to 1000ns and checked the output but the problem is not solved. The problem remains same as the sensor read outputs are not correct.

    please suggest some other ideas

    Thanks and regards
    K.Manjunathan
  • Hi,
    Can you elaborate a bit of what values are read? Can you show the 10 values before you disconnect one of the sensors and the 10 values after you disconnect the sensor. How much are they off?
  • Hi, Mr.charles.

    I have attached the problem description in  a word document. 

    Please check the document and if you need even more clear document I will again give you in a more elaborate document.5758.post.docx

  • Hi,
    In your scope shot, the flow is an input to the MCU, right? Please confirm. If the flow is a input to the MCU then it must be above 0 volts. I don't understand your scale. The Y-axis shows from -16 to 16. What is the unit? Also in your second figure the scale is from -8 to 8.

    Please check the actual ADC result memory and show what is the difference between the before and after. What if you instead of disconnecting one of the sensors and tie the input to either 3.3V or 0V?
  • Hi, Mr.Charles

    I need sometimes I will clearly document it and send you within two days.

  • Hi, Mr.charles,

    The screen shot i sent earlier was my instruments display (designed by us). Please don't consider the graph it is not fully coded yet but please consider the readings in the both the images.
    In bottom u can see set parameters (input to MCU - for example take vt 240 ml -input value to MCU) and in the right side u can see monitored parameters (sensor output converted into corresponding real world values from the relevant datasheets - for eg please check vt 234 ml in vertical blocks) both input and output are almost same.

    The figure 1 shows the correct output without any error. (Eg . set vt 240 ml in bottom scale and observed vt in vertical scale 234 ml) both are almost same there is negligible amount of error that's ok for me

    the figure 2 shows the wrong reading when fio2 sensor is disconnected (fio2 in figure 1 is 24% - correct reading and figure 2 is 81% - wrong reading ). the fio2 sensor value is fixed in my instrument and it is 24% .

    consider figure 2:
    I have disconnected fio2 sensor its shows wrong reading fio2 81% and also affects vt it is 168 ml while set is 240. it affects the vt value also.

    If it is not ok i will take few more screen shots and make a document for your clear understanding. If this explanation is not ok. please tell i will do it again Mr.charles.
  • Hi,
    Which ADC input is connected to FIO2? Do you have the identical code running when you disconnect FIO2? If the ADC input which is connected to the FIO2 is tied to 3.3V or 0V does that affect the result differently.

    A simple block diagram will help me. For example, you said there are 10 sensors connected to the ADC, right? One of the sensors is the FIO2, correct? You simply disconnect the FIO2 to the ADC and you see all 10 inputs with wrong readings. Is that the correct understanding?
  • HI,Charles

    Which ADC input is connected to FIO2? Ans: channel no 9. (if there is a change in any change in voltage of channel 9 it is affecting channel 0. and if I connect the channel 9 to the ground then channel 0 is working fine.

      Do you have the identical code running when you disconnect FIO2?  Ans: yes.

    If the ADC input which is connected to the FIO2 is tied to 3.3V or 0V does that affect the result differently. Ans:  I have tied the channel 9 to ground other ADC channels are working fine.

    you said there are 10 sensors connected to the ADC, right? One of the sensors is the FIO2, correct? You simply disconnect the FIO2 to the ADC and you see all 10 inputs with wrong readings. Is that the correct understanding?

    Ans: Yes not all the channels mostly if i disconnect channel 9. channel 0 and channel 8 are getting affected. other channels are working fine.

    Sensor read functions : coding:

    uint32 ADChex(int i){
    gioSetBit(gioPORTB, 0, 1);
    while((adcIsConversionComplete(adcREG1,adcGROUP1))==0);
    ch_count = adcGetData(adcREG1, adcGROUP1,&adc_data[0]);
    ch_count = ch_count;
    gioSetBit(gioPORTB, 0, 0);
    return adc_data[i].value;
    }

    void airpr()
    {
    ad = ADChex(4);
    adc2dec = (ad/0x100)*256 + ((ad/0x10)%0x10)*16 + (ad%0x10)*1 ;
    HP_Air= (1.5608*adc2dec)/819 - 1.2835;
    HP_Air = HP_Air*100;

    }

    void o2pr(){
    ad = ADChex(5);
    adc2dec = (ad/0x100)*256 + ((ad/0x10)%0x10)*16 + (ad%0x10)*1 ;
    Hp_O2= (1.5608*adc2dec)/819 - 1.2835;
    Hp_O2 = Hp_O2*100;

    }

    float airflow(){ //S/N: tsi840523 - 1219052; //Updated;

    float FS_ATMP;

    float a,b,c,FS_AFLW,Vf_std;
    int t_over;

    ad1 = ADChex(1);

    adc2dec = (ad1/0x100)*256 + ((ad1/0x10)%0x10)*16 + (ad1%0x10)*1 ;

    FS_ATMP=(adc2dec*1000)/819;
    FS_ATMP=FS_ATMP/1000;

    Ta = ((-8.0295*FS_ATMP*FS_ATMP*FS_ATMP*FS_ATMP*FS_ATMP)
    +(53.128*FS_ATMP*FS_ATMP*FS_ATMP*FS_ATMP)-(144.94*FS_ATMP*FS_ATMP*FS_ATMP)
    +(205.1*FS_ATMP*FS_ATMP)-(185.02*FS_ATMP)+113.71+0.2);
    Ta = Ta -0.5620628;

    ad2 = ADChex(0);

    adc2dec = (ad2/0x100)*256 + ((ad2/0x10)%0x10)*16 + (ad2%0x10)*1 ;

    FS_AFLW=(adc2dec*1000)/819;
    FS_AFLW=FS_AFLW/1000;

    if(Ta>=21.11)
    t_over=174;
    else
    t_over=190;

    Vf_std=(FS_AFLW+0.53790998)*(pow((t_over-21.11),0.5) / pow((t_over-Ta),0.5))-0.53790;

    if(Vf_std<0.25868)
    {
    a=-0.399304;
    b= 5.215665;
    c=43.420101;
    }
    else if(Vf_std<0.41288)
    {
    a=-0.53508;
    b=6.92152;
    c=30.5;
    }
    else if(Vf_std<0.58846)
    {
    a=-1.42355;
    b=11.95656;
    c= 18.38220;
    }
    else if(Vf_std<0.75597)
    {
    a=-2.82609;
    b=16.49881;
    c=13.54905;
    }
    else if(Vf_std<0.99178)
    {
    a=-4.32834;
    b=19.67331;
    c=11.86052;
    }
    else if(Vf_std<1.17879)
    {
    a=-15.24258;
    b=38.45006;
    c=5.19245;
    }
    else if(Vf_std<1.49696)
    {
    a=-25.08969;
    b=47.14514;
    c=3.91037;
    }
    else if(Vf_std<1.73973)
    {
    a=-86.78648;
    b=74.69264;
    c=2.54999;
    }
    else if(Vf_std<2.01587)
    {
    a=-86.78648;
    b=74.69264;
    c=2.54999;
    }
    else{}

    Qa = a+b*Vf_std*Vf_std+c*Vf_std*Vf_std*Vf_std*Vf_std*Vf_std;
    //Qa=0;
    return Qa;
    }

    float o2flow(){ //S/N: tsi840523 - 1219057

    float FS_OTMP;

    float a,b,c,FS_OFLW,Vf_std;
    int t_over;

    ad1 = ADChex(3);

    adc2dec = (ad1/0x100)*256 + ((ad1/0x10)%0x10)*16 + (ad1%0x10)*1 ;

    FS_OTMP=(adc2dec*1000)/819;
    FS_OTMP=FS_OTMP/1000;

    To = ((-8.0295*FS_OTMP*FS_OTMP*FS_OTMP*FS_OTMP*FS_OTMP)
    +(53.128*FS_OTMP*FS_OTMP*FS_OTMP*FS_OTMP)-(144.94*FS_OTMP*FS_OTMP*FS_OTMP)
    +(205.1*FS_OTMP*FS_OTMP)-(185.02*FS_OTMP)+113.71+0.2);
    To = To -0.65631;

    ad2 = ADChex(2);


    adc2dec = (ad2/0x100)*256 + ((ad2/0x10)%0x10)*16 + (ad2%0x10)*1 ;
    FS_OFLW=(adc2dec*1000)/819;
    FS_OFLW=FS_OFLW/1000;


    if(To>=21.11)
    t_over=174;
    else
    t_over=190;

    Vf_std=(FS_OFLW+0.5379)*(pow((t_over-21.11),0.5) / pow((t_over-To),0.5))-0.5379;

    if(Vf_std<0.25822)
    {
    a=-0.39532;
    b=5.18076;
    c=43.4201;
    }
    else if(Vf_std<0.41298)
    {
    a=-0.53274;
    b=6.89655;
    c=30.5;
    }
    else if(Vf_std<0.58855)
    {
    a=-1.39784;
    b=11.86447;
    c=18.38220;
    }
    else if(Vf_std<0.75635)
    {
    a=-3.05654;
    b=16.8552;
    c=13.54905;
    }
    else if(Vf_std<0.99039)
    {
    a=-4.37619;
    b=19.84090;
    c=11.86052;
    }
    else if(Vf_std<1.17898)
    {
    a=-14.58173;
    b=38.110671;
    c=5.19245;
    }
    else if(Vf_std<1.49598)
    {
    a=-26.46435;
    b=47.71259;
    c=3.91037;
    }
    else if(Vf_std<1.73836)
    {
    a=-84.49235;
    b=74.06126;
    c=2.54999;
    }
    else if(Vf_std<2.01595)
    {
    a=-84.49235;
    b=74.06126;
    c=2.54999;
    }
    else{}

    Qo = a+b*Vf_std*Vf_std+c*Vf_std*Vf_std*Vf_std*Vf_std*Vf_std;
    return Qo;
    }

    float Paw()

    {


    ad = ADChex(7);
    adc2dec = (ad/0x100)*256 + ((ad/0x10)%0x10)*16 + (ad%0x10)*1 ;
    LP_AW=(adc2dec*1000)/819;
    LP_AW=LP_AW/1000;
    LP_AW =((-18.903*LP_AW*LP_AW*LP_AW*LP_AW)+(232.19*LP_AW*LP_AW*LP_AW)
    -(1063.6*LP_AW*LP_AW)+(2266.1*LP_AW)-1913.4);
    return LP_AW;
    }

    float Bellow()
    {
    ad = ADChex(8);
    adc2dec = (ad/0x100)*256 + ((ad/0x10)%0x10)*16 + (ad%0x10)*1 ;
    LP_BW=(adc2dec*1000)/819;
    LP_BW=LP_BW/1000;
    /*LP_BW =((-18.903*LP_BW*LP_BW*LP_BW*LP_BW)+(232.19*LP_BW*LP_BW*LP_BW)
    -(1063.6*LP_BW*LP_BW)+(2266.1*LP_BW)-1913.4);*/
    //LP_BW = (LP_BW - 0.5*5/5*0.018)+4;
    LP_BW = (((111.11*LP_BW) - 277.78)-3);

    return LP_BW;
    }

    float fiO2(){
    ad = ADChex(9);
    adc2dec = (ad/0x100)*256 + ((ad/0x10)%0x10)*16 + (ad%0x10)*1 ;
    O2con=(adc2dec*1000)/819;
    O2con=O2con/1000;
    O2con = (22.012*O2con)-0.1532;
    return O2con;
    }

    float vtee(){
    ad = ADChex(6);
    adc2dec = (ad/0x100)*256 + ((ad/0x10)%0x10)*16 + (ad%0x10)*1 ;
    vte=(adc2dec*1000)/819;
    vte=vte/1000;
    vte = -(23.352*vte*vte) +(214.7*vte) -362.83;
    return vte;
    }

    halcogen configuration already attached: 

    Simple block diagram:

  • Hi,

     Do you have your own custom PCB board or you are using either the TI LaunchPad or the HDK? It seems to me that there could be some noise induced from one channel onto another. If you use your own custom board is it possible for you the replicate the same problem in the HDK?

     You are saying by disconnecting channel 9, the channel 0 and 8 are affected. Can you do an experiment? Disconnect one channel at a time and see how other channels behave? For example, first disconnect channel 0 and see what happens to other 9 channels from channel 1-9. Connect channel 0 to ground and see what happens to other 9 channels. Connect channel 0 to 3.3V and see what happens to other 9 channels. Now repeat the same test for other 9 channels such by disconnecting channel 1 and so on so forth.

    One thing that is worth trying is the sample discharge. This is to prevent the remanant charges on the capacitor from being carried from one channel conversion onto another.  Can you also play with the sample discharge to see if any effects?

    22.8.4 ADC Sample Capacitor Discharge Mode
    This mode allows the charge on the ADC core’s internal sampling capacitor to be discharged before
    starting the sampling phase of the next channel.
    The ADC Sample Cap Discharge Mode is enabled by setting the SAMP_DIS_EN bit of the group’s
    ADSAMPDISEN register. A discharge period for the sampling capacitor is added before the sampling
    period for each channel as shown in Figure 22-17. The duration of this discharge period is configurable via
    the corresponding group’s SAMP_DIS_CYC field in the ADSAMPDISEN register. The discharge time is
    specified in terms of number of ADCLK cycles.
    During the sample capacitor discharge period, the VREFLO reference voltage is connected to the input
    voltage terminal of the ADC core. This allows any charge collected on the sampling capacitor from the
    previous conversion to be discharged to ground. The VREFLO reference voltage is usually connected to
    ground.

  • Hi,Mr.charles,

    Yes, i am using customized board. Yes, this might be the reason for the errors. I will try all the comments and update the outcomes. Thank you for the support you have provided so far.

  • Hi, Mr.charles ,

    This EMI and EMC problem are creating lot of problem with the results in my customized board. i am checking with ti HDK