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.

In my custom board with AFE4404 i am getting random values on putting any object on to the sensor, what could be the issue ?

Other Parts Discussed in Thread: AFE4404

Hello Folks,

I  am working on AFE4404 on my custom board,

I am following  7b powering up sequence.

I also have Requested TI's AFE4404EVMFWSRC-v1.4 and did follow the powering up sequence as per this example. and as a result i am able to see the glowing LEDs on my SFH7060 module  also i am reading and writing AFE registers as per the the sample code i just mentioned(taken into consideration of signed bits also ).

Now my query is when i read the 0x2A to 0x2F registers i am getting all of sudden changes and values which are being return by I2C readings are randomly changing,

I took some tests as putting finger on it , in open environment ,Black strip on it , white strip on it but getting same kind of changes in all of the cases.

For Example lets talk about 0x2F register( LED1-ALED1VAL) with black strip upon the LEDs so the values are in continuous iteration, which seems un-expected. 

1) 0xFFF10200

2) 0xFFFE0000

3) 0x00D80100

4) 0x00940000

5) 0xFFFA0100

6) 0xFFEF0000

7) 0x008DFFFF

8) 0x00DBFEFF

9) 0x0085FFFF

10) 0xFFE9FEFF

I also have EVM connected with SFH7060 and if i configure same settings of PRF and LED and others relative, i am getting values in some specific range if i put anything upon the sensor, and they follows the same values of range which is expected.

So are these above 10 example values which i am getting from my custom board are worth or is there any mistake or needs any changes ?
If it needs changes to be done, what could be the probably issue i should dig into ?

Any help on this would be great appreciable.

Please let me know if i can provide any other information from my side.

Thanks & Regards,

Rutvij

  • hello Rutvij,

    could you provide your afe register settings?
    It is not clear based on your explanation if the EVM is also giving similar results as your custom board.
    Could you please clarify?

    Are you seeing similar 10 example values you have mentioned in all the 0x2A to 0x2F registers?
    Is the device responsive to the changes in the PD current?
    For example: you could provide a modulated light to the PD and check if the ADC output also modulates?
  • Hi Praveen Aroul,

    Thank you very much for your quick response.

    I set register of AFE in my code using AFE's GUI only,
    My settings are from GUI are as per below,

    External clock of 4MHZ,

    Tx stage - LED1 current in mA = 24
    Tx stage - LED2 current in mA = 16
    Tx stage - LED3 current in mA = 16

    Rx stage - TIA_GAIN = 25k, TIA_CF =22.5p
    Rx stage - TIA_GAIN_SEP = 25k, TIA_CF_SEP =22.5p

    PRF = 100Hz, DUTY CYCLE = 1%

    while setting the above settings into GUI while reading the register from the same GUI i am getting values in particular range and i am not seeing any sudden hike or any sudden fall into the value,here are my values with the above listed settings for 0x2F register.

    1) 0x00010F
    2) 0x000118
    3) 0x00016D
    4) 0x00011c
    5) 0x00015c
    6) 0x000132
    7) 0x000104
    8) 0x000139

    now below are my register setting implemented into source code which are taken from this above GUI settings it self. Please apologise me for putting in such a mess format.

    AFE4404_Reg_Write(1, 80); //AFE_LED2STC
    AFE4404_Reg_Write(2, 399); //AFE_LED2ENDC
    AFE4404_Reg_Write(3, 800); //AFE_LED1LEDSTC
    AFE4404_Reg_Write(4, 1199); //AFE_LED1LEDENDC
    AFE4404_Reg_Write(5, 480); //AFE_ALED2STC
    AFE4404_Reg_Write(6, 799); //AFE_ALED2ENDC
    AFE4404_Reg_Write(7, 880); //AFE_LED1STC
    AFE4404_Reg_Write(8, 1199); //AFE_LED1ENDC
    AFE4404_Reg_Write(9, 0); //AFE_LED2LEDSTC
    AFE4404_Reg_Write(10, 399); //AFE_LED2LEDENDC
    AFE4404_Reg_Write(11, 1279); //AFE_ALED1STC
    AFE4404_Reg_Write(12, 1598); //AFE_ALED1ENDC
    AFE4404_Reg_Write(13, 408); //AFE_LED2CONVST
    AFE4404_Reg_Write(14, 1467); //AFE_LED2CONVEND
    AFE4404_Reg_Write(15, 1476); //AFE_ALED2CONVST
    AFE4404_Reg_Write(16, 2535); //AFE_ALED2CONVEND
    AFE4404_Reg_Write(17, 2544); //AFE_LED1CONVST
    AFE4404_Reg_Write(18, 3603); //AFE_LED1CONVEND
    AFE4404_Reg_Write(19, 3612); //AFE_ALED1CONVST
    AFE4404_Reg_Write(20, 4671); //AFE_ALED1CONVEND
    AFE4404_Reg_Write(21, 401); //AFE_ADCRSTSTCT0
    AFE4404_Reg_Write(22, 407); //AFE_ADCRSTENDCT0
    AFE4404_Reg_Write(23, 1469); //AFE_ADCRSTSTCT1
    AFE4404_Reg_Write(24, 1475); //AFE_ADCRSTENDCT1
    AFE4404_Reg_Write(25, 2537); //AFE_ADCRSTSTCT2
    AFE4404_Reg_Write(26, 2543); //AFE_ADCRSTENDCT2
    AFE4404_Reg_Write(27, 3605); //AFE_ADCRSTSTCT3
    AFE4404_Reg_Write(28, 3611); //AFE_ADCRSTENDCT3
    AFE4404_Reg_Write(54, 400); //AFE_LED3LEDSTC
    AFE4404_Reg_Write(55, 799); //AFE_LED3LEDENDC
    AFE4404_Reg_Write(29, 39999); //AFE_PRPCOUNT
    AFE4404_Reg_Write(30, 0x000103); //AFE_CONTROL1
    AFE4404_Reg_Write(32, 0x00803C); //AFE_TIA_SEP_GAIN
    AFE4404_Reg_Write(33, 0x00003C); //AFE_TIA_GAIN
    AFE4404_Reg_Write(58, 0x000000); //AFE_DAC_SETTING_REG
    AFE4404_Reg_Write(34, 0x00A28F); //LEDCTRL
    AFE4404_Reg_Write(35, 0x124018); // //AFE_CONTROL2
    AFE4404_Reg_Write(57, 0); //CLKDIV_PRF
    AFE4404_Reg_Write(50, 5471); //AFE_DPD1STC
    AFE4404_Reg_Write(51, 39199); //AFE_DPD1ENDC

    so now i should be having same(approx nearer) values same as in the case of GUI's but its not happening in my case, instead i am getting the above 10 values mentioned in earlier question.


    Also i have found that in the provided source code of TI's AFE4404EVMFWSRC-v1.4 while reading the the register , they are checking weather the values are positive or negative (i have separated them with comments in below code )as per below,


    signed long AFE4404_Reg_Read(unsigned char Reg_address)
    {
    static uint8_t val[3];
    signed long retVal;

    I2C_start(I2C2, AFE4404_SLAVE_ADD, I2C_Direction_Transmitter);
    I2C_write(I2C2, Reg_address);

    /* Regenerate a start condition */
    I2C_start(I2C2, AFE4404_SLAVE_ADD, I2C_Direction_Receiver);
    // as per the data sheet this will be the seqance
    val[2] = I2C_read_ack(I2C2); //{23:16} bits
    val[1] = I2C_read_ack(I2C2); //{15:08} bits
    val[0] = I2C_read_nack(I2C2); //{07:00} bits
    retVal = val[0];
    retVal = (retVal << 8) | val[1];
    retVal = (retVal << 8) | val[2];

    /*================================= checking for +ve/-ve ============================================*/
    if (Reg_address >= 0x2A && Reg_address <= 0x2F)
    {
    if (retVal & 0x00200000) // check if the ADC value is positive or negative
    {
    retVal &= 0x003FFFFF; // convert it to a 22 bit value
    return (retVal^0xFFC00000);
    }
    }

    /*=============================================================================*/
    return retVal;
    }

    So is the same thing is being done while the reading register from the GUI ?

    i hope this will help you to understand my scenario.

    Please let me know if i can provide any more details regarding this issue.

    Thanks & regards,
    Rutvij
  • Hi Praveen Aroul,
    Thank you very much for your quick response.
    i set the register settings from AFE4404's GUI my register settings from GUI are as per below,

    External clock = 4Mhz

    Tx stage = LED1 Current in mA =24
    Tx stage = LED2 Current in mA =16
    Tx stage = LED3 Current in mA =16

    Rx stage TIA_GIAN =25K TI_CF = 22.5p
    Rx stage TIA_GIAN_SEP =25K TI_CF_SEO= 22.5p

    PRF = 100Hz, DUTY CYCLE =1%
    whit the above settings when i read the register from the GUI i am getting values in some particular rang, which are not being go through sudden hike or sudden fall, the values of 0x2F register with the same black strip considering above settings reding values are as per below,

    1)0x00018c
    2)0x000171
    3)0x0001Ac
    4)0x0001c3
    5)0x0001c8
    6)0x000193
    7)0x000194
    8)0x000107
    9)0x000132
    10)0x000135
    11)0x000181
    12)0x000142

    I took same register configuration from the GUI to get implemented with my custom boards source code settings are as per below,please forgive me for posting them into messy format.

    AFE4404_Reg_Write(1, 80); //AFE_LED2STC
    AFE4404_Reg_Write(2, 399); //AFE_LED2ENDC
    AFE4404_Reg_Write(3, 800); //AFE_LED1LEDSTC
    AFE4404_Reg_Write(4, 1199); //AFE_LED1LEDENDC
    AFE4404_Reg_Write(5, 480); //AFE_ALED2STC
    AFE4404_Reg_Write(6, 799); //AFE_ALED2ENDC
    AFE4404_Reg_Write(7, 880); //AFE_LED1STC
    AFE4404_Reg_Write(8, 1199); //AFE_LED1ENDC
    AFE4404_Reg_Write(9, 0); //AFE_LED2LEDSTC
    AFE4404_Reg_Write(10, 399); //AFE_LED2LEDENDC
    AFE4404_Reg_Write(11, 1279); //AFE_ALED1STC
    AFE4404_Reg_Write(12, 1598); //AFE_ALED1ENDC
    AFE4404_Reg_Write(13, 408); //AFE_LED2CONVST
    AFE4404_Reg_Write(14, 1467); //AFE_LED2CONVEND
    AFE4404_Reg_Write(15, 1476); //AFE_ALED2CONVST
    AFE4404_Reg_Write(16, 2535); //AFE_ALED2CONVEND
    AFE4404_Reg_Write(17, 2544); //AFE_LED1CONVST
    AFE4404_Reg_Write(18, 3603); //AFE_LED1CONVEND
    AFE4404_Reg_Write(19, 3612); //AFE_ALED1CONVST
    AFE4404_Reg_Write(20, 4671); //AFE_ALED1CONVEND
    AFE4404_Reg_Write(21, 401); //AFE_ADCRSTSTCT0
    AFE4404_Reg_Write(22, 407); //AFE_ADCRSTENDCT0
    AFE4404_Reg_Write(23, 1469); //AFE_ADCRSTSTCT1
    AFE4404_Reg_Write(24, 1475); //AFE_ADCRSTENDCT1
    AFE4404_Reg_Write(25, 2537); //AFE_ADCRSTSTCT2
    AFE4404_Reg_Write(26, 2543); //AFE_ADCRSTENDCT2
    AFE4404_Reg_Write(27, 3605); //AFE_ADCRSTSTCT3
    AFE4404_Reg_Write(28, 3611); //AFE_ADCRSTENDCT3
    AFE4404_Reg_Write(54, 400); //AFE_LED3LEDSTC
    AFE4404_Reg_Write(55, 799); //AFE_LED3LEDENDC
    AFE4404_Reg_Write(29, 39999); //AFE_PRPCOUNT
    AFE4404_Reg_Write(30, 0x000103); //AFE_CONTROL1
    AFE4404_Reg_Write(32, 0x00803C); //AFE_TIA_SEP_GAIN (LED2)
    AFE4404_Reg_Write(33, 0x00003C); //AFE_TIA_GAIN (LED1) LED1/LED1AMB
    AFE4404_Reg_Write(58, 0x000000); //AFE_DAC_SETTING_REG
    AFE4404_Reg_Write(34, 0x00A28F); //LEDCTRL
    AFE4404_Reg_Write(35, 0x124018); AFE_CONTROL2
    AFE4404_Reg_Write(57, 0); //CLKDIV_PRF
    AFE4404_Reg_Write(50, 5471); //AFE_DPD1STC
    AFE4404_Reg_Write(51, 39199); //AFE_DPD1ENDC

    Configuring above register setting i should be getting approx same reading values as in the case of GUI but instead i am getting some random values(10 values) which are mentioned in the earlier question.

    I hope the above will help you to understand my scenario.
    Please let me know if i can provide any further details.

    I have noted that in the source code of TI's AFE4404EVMFWSRC-v1.4 while the reading the register values they are checking positive and negative values, i have separated them with the comment in below posted code ,

    @code starts

    signed long AFE4404_Reg_Read(unsigned char Reg_address)
    {
    static uint8_t val[3];
    signed long retVal;

    I2C_start(I2C2, AFE4404_SLAVE_ADD, I2C_Direction_Transmitter);
    I2C_write(I2C2, Reg_address);

    /* Regenerate a start condition */
    I2C_start(I2C2, AFE4404_SLAVE_ADD, I2C_Direction_Receiver);
    // as per the data sheet this will be the seqance
    val[2] = I2C_read_ack(I2C2); //{23:16} bits
    val[1] = I2C_read_ack(I2C2); //{15:08} bits
    val[0] = I2C_read_nack(I2C2); //{07:00} bits
    retVal = val[0];
    retVal = (retVal << 8) | val[1];
    retVal = (retVal << 8) | val[2];

    /*==================== checking for +ve/ -ve values===================================*/
    if (Reg_address >= 0x2A && Reg_address <= 0x2F)
    {
    if (retVal & 0x00200000) // check if the ADC value is positive or negative
    {
    retVal &= 0x003FFFFF; // convert it to a 22 bit value
    return (retVal^0xFFC00000);
    }
    }
    /*=============================================================================*/
    return retVal;
    }
    @code ends

    So is it the same thing being done while reading the register in the GUI ?
    Does GUI also performs the same thing while reading the 0x2A to 0x2F register as mentioned in the Ti's above sample code ?

    So it would be great if you can help in this issue.

    Thanks & Regards,
    Rutvij.