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.

FDC1004: Sensor is not working

Part Number: FDC1004

Hi,

I am using FDC1004 for capacitance measurement. I set configuration and FDC register but still, I am getting 255 in 0x00 and  0x01 Registers of FDC1004. I feel that FDC got saturated. Please look into the attachment for more details.

Fdc1004 with pic16f877a.c
{
.
.
.
unsigned long data1,data2;
.
.
.
}

   
   while(1)
    {
    i=1;
    Lcd4_Clear();
    Call_senor(); // FDC1004

    result = data1; // 0x00 Reg
    Lcd4_Set_Cursor(2,1);
    send_data_to_LCD(result);
    __delay_ms(2000); 
      
    result = data2; //0x01 Reg
    Lcd4_Set_Cursor(2,1);
    send_data_to_LCD(result);
    __delay_ms(2000); 
    }
}



/*
 *This function is used to call the I2C driver and acquire the data.
 */

void Call_senor()
{
   I2C_Start();
    while(I2C_Write_Byte(0xA0)==1) // Write address
    {
        I2C_Start();
    }
    I2C_Write_Byte(0x08); // Conf reg
    I2C_Write_Byte(0x0C); //MSB
    I2C_Write_Byte(0x00); //LSB
    I2C_Stop();

    I2C_Start();
    while(I2C_Write_Byte(0xA0)==1)
    {
        I2C_Start();
    }
    I2C_Write_Byte(0x0C); //FDC reg
    I2C_Write_Byte(0x05); //MSB
    I2C_Write_Byte(0x80); //LSB
    I2C_Stop();

    __delay_ms(50);
    
    I2C_Start();
    while(I2C_Write_Byte(0xA0)==1)
    {
        I2C_Start();
    }
    I2C_Write_Byte(0x00);
    I2C_ReStart();
    I2C_Write_Byte(0xA0);


    data1 = I2C_Read_Byte(); // 0x00 register data
    I2C_Send_ACK();
    data2 = I2C_Read_Byte(); // 0x01 register data
    I2C_Send_NACK();
    
    I2C_Stop(); 

}

  • Are you able to read other registers from the FDC1004 correctly using your code? If you confirm that the I2C is correct, then you can double check your register settings by using the Sensing Solutions GUI + the FDC1004EVM.
  • No. I am getting same response from all other registers too.
  • Yeah, There was a problem in I2C I rectified it. Here I need some clarification,

    Step1:

    Setting Configuration and FDC register each reg is 16 bit, So I need to split it into 8-bit data and send through I2C.

    0x08 (Configuration register) > 0x09F0:

    So I am sending 0x09 and 0xF0 next

    0x0C (FDC register) > 0x0580

    0x05 and 0x80 

    step2; Acquiring data from 0x00, 0x01

    data1=0x00;

    data2= 0x01;

    step3: conversion

    16bitdata = (data1<<8)+data2;

    24bitdata = (16bitdata<<8)+0x00;

    2scomplement = ~24bitdata+1;

    step4: Applying in formula

    Cap = ((2scomplement)/5,24,288) + Offset;

    Is this process is correct?

    but I am getting wrong values.

    Kindly help me to resolve this problem

  • This doesn't look quite right:

    16bitdata = (data1<<8)+data2;

    24bitdata = (16bitdata<<8)+0x00;

    data0 and data1 are each 16 bits, and you will only use the 8 MSB bits of data1. Adding on zeroes to the end of your "16bitdata" to create the "24bitdata" does not make sense because their should be a full 24 bits of data.

    There should be sample MSP430 code available through the FDC1004 TI designs.