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.

Unable to read the ADC register values of LMC90100

Other Parts Discussed in Thread: LMP90100

Hi to all,

            I am working with the LMP90100 multi-channel ADC. I do the inferface with pic controller communication is working fine i am getting the default values from register and Displaying in LCD giving the exect values mention in the datasheet but when i am  trying to get/read the value from the ADC register we are getting the erratic values.

please help us out where i doing wrong below is my program :-

void main()
{


unsigned char Cont=0,port_data=0;
MCU_Init();
Int_Lcoal_Variable=0;
Lcd_Out(2,1,"Testing");
Spi_Init();
Delay_100ms();
LM_90100_Init();


//Power Config
LM90100_Spi_Read_Write_Single_Value(TI_LMP90100_PWRCN_REG,0); //Active Mode


//AUXCN
LM90100_Spi_Read_Write_Single_Value(TI_LMP90100_ADC_AUXCN_REG,0x0A); //Config AuxChannel

//Channel Config
LM90100_Spi_Read_Write_Single_Value(TI_LMP90100_CH0_CONFIG_REG,0x41); //Config Channel Zero
LM90100_Spi_Read_Write_Single_Value(TI_LMP90100_CH1_CONFIG_REG,0x41); //Config Channel One

LM90100_Spi_Read_Write_Single_Value(TI_LMP90100_BGCALCN_REG,0x00); //Confif TI_LMP90100_BGCALCN_REG

//Channel Input
LM90100_Spi_Read_Write_Single_Value(TI_LMP90100_CH0_INPUTCN_REG,0x41); //Confif TI_LMP90100_CH0_INPUTCN_REG
//LM90100_Spi_Read_Write_Single_Value(TI_LMP90100_CH1_INPUTCN_REG,0x41);


LM90100_Spi_Read_Write_Single_Value(TI_LMP90100_ADC_RESTART_REG,1); //REset the ADC Register

while(1)
{

LM90100_Spi_Read_Write_Single_Value(TI_LMP90100_CH_SCAN_REG,0x00);
LM_90100_Spi_Writing_Address_Data(TI_LMP90100_CH_STS_REG,LM90100_Read_Ptr,1,SPI_READ);

//Storing the CH_STS_REG Value to the LM90100_Read_Ptr
if(*LM90100_Read_Ptr<0xff) //Checking the CH_STS_REG Status
{

LM_90100_Spi_Writing_Address_Data(TI_LMP90100_ADC_DOUT2_REG,LM90100_Read_Ptr,3,SPI_READ);
Display_Int2Float(1,1,*LM90100_Read_Ptr,_One_Degree,0); ///Reading the Upper register value
Display_Int2Float(2,1,*(LM90100_Read_Ptr+1),_One_Degree,0); ///Reading the Middle register value
Display_Int2Float(2,10,*(LM90100_Read_Ptr+2),_One_Degree,0); ///Reading the Lower register value
Display_Int2Float(1,10,Cont++,_One_Degree,0); //Just to know where the programm is comming to this while loop or not.
port_data=~port_data;
LM90100_Spi_Read_Write_Single_Value(TI_LMP90100_GPIO_DAT_REG,port_data); // Complimenting the GPIO ports this is also WORKING we had testing using the multimeter.

          Delay_ms(1000);
}

}  

}

Thanks & Regards

  • Hi Arun,

    Would it be possible for you to provide a schematic or possibly describe you hardware setup for us?

  • Hi tom,

      Thanks for your replay !

      we are using LMP90100 Evaluation board, so as per the datasheet we had done the same connection. Evening when we connect with SPIO-4 digital controller board the temperature is showing on the PC. Now we just remove the SPIO-4 Board and give the SIP connection to our micro-controller board. I hope i answer your quotation.

    Now my major concern is step before init the ADC what we are doing is right or not?

  • Hi Tom,

    We are using EVM directly as our set-up. We're connecting the SPI signals from LMP90100 board to our microcontroller.  Connections seem to be fine since we are able to see voltage levels at GPIO pins of LMP90100 board.

    However, we are not able to read data from ADC registers. We are concerned whether our initialization for the ADC is okay. Here's the excerpt from the code section -

    LM90100_Spi_Read_Write_Single_Value(TI_LMP90100_PWRCN_REG,0); //Active Mode

    //LM_90100_Spi_Writing_Address_Data(TI_LMP90100_CH_STS_REG,LM90100_Read_Ptr,1,SPI_READ); //Power Mode Control and Status
    //AUXCN
    LM90100_Spi_Read_Write_Single_Value(TI_LMP90100_ADC_AUXCN_REG,0x0A); //Config AuxChannel

    //Channel Config
    LM90100_Spi_Read_Write_Single_Value(TI_LMP90100_CH0_CONFIG_REG,0x41); //Config Channel Zero
    LM90100_Spi_Read_Write_Single_Value(TI_LMP90100_CH1_CONFIG_REG,0x41); //Config Channel One

    LM90100_Spi_Read_Write_Single_Value(TI_LMP90100_BGCALCN_REG,0x00); //Confif TI_LMP90100_BGCALCN_REG

    //Channel Input
    LM90100_Spi_Read_Write_Single_Value(TI_LMP90100_CH0_INPUTCN_REG,0x41); //Confif TI_LMP90100_CH0_INPUTCN_REG
    //LM90100_Spi_Read_Write_Single_Value(TI_LMP90100_CH1_INPUTCN_REG,0x41);

    //
    LM90100_Spi_Read_Write_Single_Value(TI_LMP90100_ADC_RESTART_REG,1); //REset the ADC Register
    // LM90100_Spi_Read_Write_Single_Value(TI_LMP90100_CH_SCAN_REG,0x70);
    lcd_cmd(_LCD_CLEAR);

    Please let us know if we above routine is okay.  After initialization, we are reading the registers of LMP90100, but nothing comes up.

    Appreciate your time and help.

    Regards,

    Arun Luthra

  • Hi Arun,

     LM90100_Spi_Read_Write_Single_Value(TI_LMP90100_CH_SCAN_REG,0x70); doesn't match with your first post and the latest and since this is related to configuration you can have this done outside the while loop.

    Can you confirm if DRDYB is pulsing ? You can bring out DRDYB on D6 and monitor it.

    Also, have you tested the function used for ADC data read on other registers? Please make sure there is no problem with read function.

    Regards,
    Murali 

  • Hi Arun,

    What is the reference resistor value that is used to generate reference ? I see that you are using Vref 2 which is muxed on Vin6 and Vin7.

    Regards,
    Murali 

  • Hi Murali,

          Thanks for your replay!

          1. Related to the CH_SCAN_REG in my first post we had given the default as per mention the datasheet of LMP90100. After we are not getting the result we had just write 0x70 into  CH_SCAN_REG for ScanMode1 : One or more Channels single scan. Yes you are right we should not write this instruction into the while loop.

       2.  Related to the pulsing of DRDYB we had made the D6 as general purpose IO pin and we are toggling the D6 before reading the ADC.   

      3. We write to the PWRCN : Power control and status register and then read the value we are getting the same  result which confirm that our read function is working fine.