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.

LMP90080 basic question

Other Parts Discussed in Thread: LMP90080, LMP90100

Hi 

I am newby to LMP90080...

I have developed a PIC interfacing LMP90080 and i am able to communicate to the device

I am trying to read analog voltage on CH0 (single ended input - not differential).

The device is configured as follows:

  1. run from internal clock: CLK_EXT_DET=1 CLK_SEL=0
  2. Excluded buffer from signal path on channel 0: CH0_CONFIG BUF_EN = 1

Now I poll for ADC_DONE to be 0xFF and read ADC_OUTH and ADC_OUTL registers.

I am getting all the time the same value although i change a Vin voltage applied to CH0

The question is which steps in config I am missing? Probably some basic steps...but from DS it is unclear to me

Thanks in advance

  • Hi Igor,

    give a look to the demo-app-3 in the example codes folder :http://www.ti.com/lit/zip/snac029.

    It shows how to configure a channel and how to configure the ADC to retrieve the data.

    The code has been written for the LMP90100, but this basic code works also for the LMP90080.

    regards,

    Domenico

  • Hi

    I have looked into the code and I have implemented the functionality almost as it is there. Yet I get incorrect values upon reading.

    The following is my LMP init procedure:

    Write RESETCN 0x53

    Write ADC_RESTART 0x01

    Write SPI_DRDYBCN_REG 0x83

    Write ADC_AUXCN 0x20

    Write CH0_INPUTCN 0x07

    Write CH0_CONFIG 0x71

    Write CH_SCAN 0x80 (continious sampling of channel 0 only)

    Read ADC_DONE in loop while value is 0xFF

    Read ADCH

    Read ADCL

    The values read are incorrect...

    Note that write operations were validated by read, thus i know that values i write are written correctly over SPI.

    Also i use single byte read mode (no streaming for now)

    Also we are not using DRDY rather we read ADC_DONE indication

    We configure ourselves into internal clock and bypass external clock detection.

    We attempted set BGCALCN to 0x02 - this did not improve anything. Can someone let me know what is wrong in described above process?

    From HW perspective we apply 3 V to power the chip.

    CH0 Vinp is between 0-3 V while Vinn of channel 0 is grounded.

    Vref is also 3 V...

    This is starting to be very urgent to be able to read correct values from LMP...

    Thanks

  • Hi Igor,

    I've gone through your code, I think that there are some errors:

    Write RESETCN 0x53 should be 0xC3

    Write CH_SCAN 0x80 should be 0x00 

     fix it and let me know if it works.

    regards,

    Domenico

  • Hi Domenico

    "Write RESETCN 0x53 should be 0xC3" - the error is in text, it was typo I do write 0xC3 to the register already :-)

    I have tried to set channel scan configuration to 0.

    The result is the same.

    On top of that I have tried after each reading set ADC_RESTART to 1.

    Still I am getting the same result.

    The loop for reading ADC values is below:

    void LMP90080_ReadVin(char mask)
    {
        char done = 0xFF, i;
    
        LMP90080_WriteRegister(CH0_INPUTCN, 0x7);
        done = LMP90080_ReadRegister(CH0_INPUTCN);
    
        if (done != 0x7)
        {
    
            while (1)
            {
                asm("nop");
                asm("nop");
                asm("nop");
            }
        }
        // Configure Channel 0: 6 SPS without any buffer on the way
        LMP90080_WriteRegister(CH0_CONFIG, 0x31);
    
        done = LMP90080_ReadRegister(CH0_CONFIG);
    
        if (done != 0x31)
        {
            while (1)
            {
                asm("nop");
                asm("nop");
                asm("nop");
            }
        }
    
        status = LMP90080_ReadRegister(CH_STS);
        done = 0xFF;
    
          // For debugger
        asm("nop");
        asm("nop");
    
    
        // Configure Channel scan mode to be continious scan of channel 0
        LMP90080_WriteRegister(CH_SCAN, 0x00);
        done = LMP90080_ReadRegister(CH_SCAN);
    
        if (done != 0x00)
        {
            while (1)
            {
                asm("nop");
                asm("nop");
                asm("nop");
            }
        }
        done = 0xFF;
        while (1)
        {
    		while (done == 0xFF)
    		{
    			for (i = 0; i < 100; i ++)
    			{
    				asm("nop");
    			}
    
    			done = LMP90080_ReadRegister(ADC_DONE);
    		}
    
    		// Read the data out
    		adcl = LMP90080_ReadRegister(ADC_DOUTL);
    		adch = LMP90080_ReadRegister(ADC_DOUTH);
                    status = LMP90080_ReadRegister(CH_STS);
                   
                    done = 0xFF;
                    //i = 1;
                    //LMP90080_WriteRegister(ADC_RESTART, i);
    
                      // For debugger Put a BP here
                    asm("nop");
                    asm("nop");
                    asm("nop");
    	}
    }
    
    The initialization function is below:
    void LMP90080_Init(void)
    {
        unsigned long delay =0;
    
        // First of all reset the device
        data = 0xC3;
        LMP90080_WriteRegister(RESETCN, data);
        data = 0;
        while (delay < 8000)
        {
            asm("nop");
            asm("nop");
            asm("nop");
            delay ++;
        }
        
        data = 1;
        LMP90080_WriteRegister(ADC_RESTART, data);
        
        data = 0;
        //LMP90080_WriteRegister(PWRCN, data);
        data = LMP90080_ReadRegister(PWRCN);
        data ++;
        asm("nop");
        asm("nop");
        asm("nop");
    
        // Re-route data ready to DOUT6
        data = 0x83;
        LMP90080_WriteRegister(SPI_DRDYBCN_REG, data);
    
        data = LMP90080_ReadRegister(SPI_DRDYBCN_REG);
    
        if (data != 0x83)
        {
            // Error?
            while (1)
            {
                asm("nop");
                asm("nop");
                asm("nop");
            }
        }
    
        // Bypass ext clock
        data = 0x20;
        LMP90080_WriteRegister(ADC_AUXCN, data);
        data = LMP90080_ReadRegister(ADC_AUXCN);
    
        if (data != 0x20)
        {
            // Error?
            while (1)
            {
                asm("nop");
                asm("nop");
                asm("nop");
            }
        }
    }

    Any other ideas?

    Thanks

    Igor

     

  • Anyone can read/answer the post?:-)

  • Few more information:

    Vin is 3 V, VrefP is also 3V VrefN is ground

    The power applied to VIN1 is between 0 to 3 V

  • Hi Igor,

    the signal needs to be applied at VIN0 pin and not VIN1.

    Moreover since it is single anded, from your Channel configuration CH0_INPUTCN =0x07, the GND needs to be applied to VIN7.

    regards,

    Domenico