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.

AFE4404: Unable to read LED values on AFE4404

Part Number: AFE4404
Other Parts Discussed in Thread: AFE4403

Hi,

We have integrated the AFE4404 with SFH7060 on our device.

We are able to drive Green, RED and IR led intensity from SFH7060, configure clock ...

When a measure is started, we receive interrupt from AFE4404 as expected, but when we read registers we get this :

LED2VAL       : 00 00 00
LED3VAL       : 00 00 00
LED1VAL       : 00 00 00
ALED1VAL      : 00 00 00
LED2_ALED2VAL : 00 00 00
LED1_ALED1VAL : 00 00 XX

Where XX are random values.
For testing purpose, we put a white light source on the sensors XX becomes 00.

On I2C, the AFE4404 send ACK for all frames.

If we put the finger on the sensors, the values does not reflect the presence or not of the finger.

Here the configurations we used :

Config 1 : (based on MSP430 code from TI)

  AFE4404_Reg_Write(1, 100);    //AFE_LED2STC
  AFE4404_Reg_Write(2, 399);    //AFE_LED2ENDC
  AFE4404_Reg_Write(3, 802);    //AFE_LED1LEDSTC
  AFE4404_Reg_Write(4, 1201);   //AFE_LED1LEDENDC
  AFE4404_Reg_Write(5, 501);    //AFE_ALED2STC
  AFE4404_Reg_Write(6, 800);    //AFE_ALED2ENDC
  AFE4404_Reg_Write(7, 902);    //AFE_LED1STC
  AFE4404_Reg_Write(8, 1201);   //AFE_LED1ENDC
  AFE4404_Reg_Write(9, 0);      //AFE_LED2LEDSTC
  AFE4404_Reg_Write(10, 399);   //AFE_LED2LEDENDC
  AFE4404_Reg_Write(11, 1303);  //AFE_ALED1STC
  AFE4404_Reg_Write(12, 1602);  //AFE_ALED1ENDC
  AFE4404_Reg_Write(13, 409);   //AFE_LED2CONVST
  AFE4404_Reg_Write(14, 1468);  //AFE_LED2CONVEND
  AFE4404_Reg_Write(15, 1478);  //AFE_ALED2CONVST
  AFE4404_Reg_Write(16, 2537);  //AFE_ALED2CONVEND
  AFE4404_Reg_Write(17, 2547);  //AFE_LED1CONVST
  AFE4404_Reg_Write(18, 3606);  //AFE_LED1CONVEND
  AFE4404_Reg_Write(19, 3616);  //AFE_ALED1CONVST
  AFE4404_Reg_Write(20, 4675);  //AFE_ALED1CONVEND
  AFE4404_Reg_Write(21, 401);   //AFE_ADCRSTSTCT0
  AFE4404_Reg_Write(22, 407);   //AFE_ADCRSTENDCT0
  AFE4404_Reg_Write(23, 1470);  //AFE_ADCRSTSTCT1
  AFE4404_Reg_Write(24, 1476);  //AFE_ADCRSTENDCT1
  AFE4404_Reg_Write(25, 2539);  //AFE_ADCRSTSTCT2
  AFE4404_Reg_Write(26, 2545);  //AFE_ADCRSTENDCT2
  AFE4404_Reg_Write(27, 3608);  //AFE_ADCRSTSTCT3
  AFE4404_Reg_Write(28, 3614);  //AFE_ADCRSTENDCT3
  AFE4404_Reg_Write(54, 401);   //AFE_LED3LEDSTC
  AFE4404_Reg_Write(55, 800);   //AFE_LED3LEDENDC
  AFE4404_Reg_Write(29, 39999); //AFE_PRPCOUNT
  AFE4404_Reg_Write(30, 0x000100);    //AFE_CONTROL1 TimerEN = 1; NUMAV = 3
  AFE4404_Reg_Write(32, 0x008003);  //AFE_TIA_SEP_GAIN (LED2) ENSEPGAIN = 1; LED2/LED3 gain = 50K
  AFE4404_Reg_Write(33, 0x000003);  //AFE_TIA_GAIN (LED1) LED1/LED1AMB gain = 50K
  AFE4404_Reg_Write(58, 0x000000);  //AFE_DAC_SETTING_REG
  AFE4404_Reg_Write(34, 0x0030CF);     //LED3 - 3.125mA; LED2 - 3.125mA; LED1 - 12.5mA
  AFE4404_Reg_Write(35, 0x124018 | (1 << 9));     //DYN1, LEDCurr, DYN2, Ext CLK, DYN3, DYN4 //0x000200); - 0x200 Osc mode //AFE_CONTROL2
  AFE4404_Reg_Write(49, 0x000020);     //ENABLE_INPUT_SHORT
  AFE4404_Reg_Write(57, 0);         //CLKDIV_PRF
  AFE4404_Reg_Write(50, 5475);      //AFE_DPD1STC
  AFE4404_Reg_Write(51, 39199);     //AFE_DPD1ENDC

Config 2 (based on AFE4403 GUI application) :
    AFE4404_Reg_Write(AFE_CONTROL0,0x000000);
    AFE4404_Reg_Write(AFE_LED2STC,0x0017C0);
    AFE4404_Reg_Write(AFE_LED2ENDC, 0x01F3E);
    AFE4404_Reg_Write(AFE_LED2LEDSTC, 0x01770);
    AFE4404_Reg_Write(AFE_LED2LEDENDC, 0x01F3F);
    AFE4404_Reg_Write(AFE_ALED2STC, 0x00050);
    AFE4404_Reg_Write(AFE_ALED2ENDC, 0x007CE);
    AFE4404_Reg_Write(AFE_LED1STC, 0x00820);
    AFE4404_Reg_Write(AFE_LED1ENDC, 0x00F9E);
    AFE4404_Reg_Write(AFE_LED1LEDSTC, 0x007D0);
    AFE4404_Reg_Write(AFE_LED1LEDENDC, 0x00F9F);
    AFE4404_Reg_Write(AFE_ALED1STC, 0x00FF0);
    AFE4404_Reg_Write(AFE_ALED1ENDC, 0x0176E);
    AFE4404_Reg_Write(AFE_LED2CONVST, 0x00006);
    AFE4404_Reg_Write(AFE_LED2CONVEND, 0x007CF);
    AFE4404_Reg_Write(AFE_ALED2CONVST, 0x007D6);
    AFE4404_Reg_Write(AFE_ALED2CONVEND, 0x00F9F);
    AFE4404_Reg_Write(AFE_LED1CONVST, 0x00FA6);
    AFE4404_Reg_Write(AFE_LED1CONVEND, 0x0176F);
    AFE4404_Reg_Write(AFE_ALED1CONVST, 0x01776);
    AFE4404_Reg_Write(AFE_ALED1CONVEND, 0x01F3F);
    AFE4404_Reg_Write(AFE_ADCRSTSTCT0, 0x00000);
    AFE4404_Reg_Write(AFE_ADCRSTENDCT0, 0x00005);
    AFE4404_Reg_Write(AFE_ADCRSTSTCT1, 0x007D0);
    AFE4404_Reg_Write(AFE_ADCRSTENDCT1, 0x007D5);
    AFE4404_Reg_Write(AFE_ADCRSTSTCT2, 0x00FA0);
    AFE4404_Reg_Write(AFE_ADCRSTENDCT2, 0x00FA5);
    AFE4404_Reg_Write(AFE_ADCRSTSTCT3, 0x01770);
    AFE4404_Reg_Write(AFE_ADCRSTENDCT3, 0x01775);
    AFE4404_Reg_Write(AFE_PRPCOUNT, 0x01F3F);
    AFE4404_Reg_Write(AFE_CONTROL1, 0x00101);
    AFE4404_Reg_Write(AFE_SPARE1, 0x00000);
    AFE4404_Reg_Write(AFE_TIAGAIN, 0x00000);
    AFE4404_Reg_Write(AFE_TIAAMBGAIN, 0x00002); // 0x21
    AFE4404_Reg_Write(AFE_LEDCNTRL, 0x11414);
    AFE4404_Reg_Write(AFE_CONTROL2, 0x00000);
    AFE4404_Reg_Write(AFE_SPARE2, 0x00000);
    AFE4404_Reg_Write(AFE_SPARE3, 0x00000);
    AFE4404_Reg_Write(AFE_SPARE4, 0x00000);
    AFE4404_Reg_Write(AFE_RESERVED1, 0x00000);
    AFE4404_Reg_Write(AFE_RESERVED2, 0x00000);
    AFE4404_Reg_Write(AFE_ALARM, 0x00000);
    AFE4404_Reg_Write(AFE_LED2VAL, 0x00000);
    AFE4404_Reg_Write(AFE_ALED2VAL, 0x00000);
    AFE4404_Reg_Write(AFE_LED1VAL, 0x00000);
    AFE4404_Reg_Write(AFE_ALED1VAL, 0x00000);
    AFE4404_Reg_Write(AFE_PDNCYCLESTC, 0x00000);
    AFE4404_Reg_Write(AFE_PDNCYCLEENDC, 0x00000);

    AFE4404_Reg_Write(35, (1 << 9));

Same result with both configurations. I also tried with configuration from AFE4404 linux driver source code, with exact same result.

Any help would be appreciate.

Best regards.

  • Hi Charles,

    We are sorry for the delayed response. This happened because, the question was posted in Optical forum instead of Medical forum. 

    Here are the following things to try :

    1) Write some register and read it back. This verifies there in no firmware issues regarding read. Don't read register 0x00, for e.g.

    a) Reg_Write(29, 39999);

    b) Reg_Write(0, 1);

    c)Reg_Read (29);

    d)Reg_Write(0,0);

    2) If step 1 gives expected result, try enabling some Offset Cancellation DAC in each phase. Disconnect the SFH7060 sensor for this test. Now you should get output as (I_OFFSET_x)*2*RF.

    These tests should give us clue regarding the issue.

    Regards,

    Prabin

  • Hi Prabin,

    Thank you for your answer. I have tried the following :

    1°)
    long a ;
    AFE4404_Reg_Write(29, 39999);
    AFE4404_Reg_Write(0, 1);
    a = AFE4404_Reg_Read(29);
    AFE4404_Reg_Write(0,0);

    a = 38975

    There's an issue ?

    2°) I cannot disconnect the SFH7060 as it's a custom board.

    Thank you for your help.

    Charles.
  • Hi Charles,

    For 1st test you should get 39999. Looks like D10 ( i.e. 11th bit) is stuck to 0. Can you try writing 0xAAAAAA to all the register except 0x0 and reading back. Repeat the test with 0x555555.

    For test 2: You can turn off the LEDs and do the test in the black box.

    Regards,
    Prabin
  • Prabin,

    here the code :
    log_log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 0xAAAAAA");

    for (uint32_t reg = 0x01; reg < 0x40 ;reg++)
    {
    long a;
    AFE4404_Reg_Write(reg,0xAAAAAA);
    a = AFE4404_Reg_Read(reg);
    if (a != 0xAAAAAA)
    {
    log_error("Register %X mistmatch",reg);
    }
    }

    log_log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 0x555555");

    for (uint32_t reg = 0x01; reg < 0x40 ;reg++)
    {
    long a;
    AFE4404_Reg_Write(reg,0x555555);
    a = AFE4404_Reg_Read(reg);
    if (a != 0x555555)
    {
    log_error("Register %X mistmatch",reg);
    }
    }

    And the output ("LOG : read len" is displayed by AFE4404_Reg_Read() func) :

    LOG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 0xAAAAAA
    LOG : read len 00 02 80
    ERROR : Register 1 mistmatch
    LOG : read len 00 0A 2A
    ERROR : Register 2 mistmatch
    LOG : read len 00 02 80
    ERROR : Register 3 mistmatch
    LOG : read len 00 0A 8A
    ERROR : Register 4 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 5 mistmatch
    LOG : read len 00 02 8A
    ERROR : Register 6 mistmatch
    LOG : read len 00 08 20
    ERROR : Register 7 mistmatch
    LOG : read len 00 0A 8A
    ERROR : Register 8 mistmatch
    LOG : read len 00 02 20
    ERROR : Register 9 mistmatch
    LOG : read len 00 0A 00
    ERROR : Register A mistmatch
    LOG : read len 00 00 A0
    ERROR : Register B mistmatch
    LOG : read len 00 02 2A
    ERROR : Register C mistmatch
    LOG : read len 00 00 02
    ERROR : Register D mistmatch
    LOG : read len 00 02 8A
    ERROR : Register E mistmatch
    LOG : read len 00 02 82
    ERROR : Register F mistmatch
    LOG : read len 00 0A 8A
    ERROR : Register 10 mistmatch
    LOG : read len 00 0A A2
    ERROR : Register 11 mistmatch
    LOG : read len 00 02 2A
    ERROR : Register 12 mistmatch
    LOG : read len 00 02 22
    ERROR : Register 13 mistmatch
    LOG : read len 00 0A 3F
    ERROR : Register 14 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 15 mistmatch
    LOG : read len 00 00 05
    ERROR : Register 16 mistmatch
    LOG : read len 00 05 40
    ERROR : Register 17 mistmatch
    LOG : read len 00 05 14
    ERROR : Register 18 mistmatch
    LOG : read len 00 06 80
    ERROR : Register 19 mistmatch
    LOG : read len 00 03 A5
    ERROR : Register 1A mistmatch
    LOG : read len 00 15 20
    ERROR : Register 1B mistmatch
    LOG : read len 00 00 20
    ERROR : Register 1C mistmatch
    LOG : read len 00 08 2A
    ERROR : Register 1D mistmatch
    LOG : read len 00 00 00
    ERROR : Register 1E mistmatch
    LOG : read len 00 00 00
    ERROR : Register 1F mistmatch
    LOG : read len 00 00 00
    ERROR : Register 20 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 21 mistmatch
    LOG : read len 01 00 00
    ERROR : Register 22 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 23 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 24 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 25 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 26 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 27 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 28 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 29 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 2A mistmatch
    LOG : read len 00 00 00
    ERROR : Register 2B mistmatch
    LOG : read len 00 00 00
    ERROR : Register 2C mistmatch
    LOG : read len 00 00 00
    ERROR : Register 2D mistmatch
    LOG : read len 00 00 00
    ERROR : Register 2E mistmatch
    LOG : read len 00 00 90
    ERROR : Register 2F mistmatch
    LOG : read len 00 00 00
    ERROR : Register 30 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 31 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 32 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 33 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 34 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 35 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 36 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 37 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 38 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 39 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 3A mistmatch
    LOG : read len 00 00 00
    ERROR : Register 3B mistmatch
    LOG : read len 00 00 00
    ERROR : Register 3C mistmatch
    LOG : read len 00 00 00
    ERROR : Register 3D mistmatch
    LOG : read len 00 00 00
    ERROR : Register 3E mistmatch
    LOG : read len 00 00 00
    ERROR : Register 3F mistmatch
    LOG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 0x555555
    LOG : read len 00 15 40
    ERROR : Register 1 mistmatch
    LOG : read len 00 15 14
    ERROR : Register 2 mistmatch
    LOG : read len 00 05 50
    ERROR : Register 3 mistmatch
    LOG : read len 00 05 15
    ERROR : Register 4 mistmatch
    LOG : read len 00 00 50
    ERROR : Register 5 mistmatch
    LOG : read len 00 05 44
    ERROR : Register 6 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 7 mistmatch
    LOG : read len 00 05 14
    ERROR : Register 8 mistmatch
    LOG : read len 00 15 50
    ERROR : Register 9 mistmatch
    LOG : read len 00 15 00
    ERROR : Register A mistmatch
    LOG : read len 00 00 50
    ERROR : Register B mistmatch
    LOG : read len 00 15 44
    ERROR : Register C mistmatch
    LOG : read len 00 00 04
    ERROR : Register D mistmatch
    LOG : read len 00 05 45
    ERROR : Register E mistmatch
    LOG : read len 00 05 54
    ERROR : Register F mistmatch
    LOG : read len 00 05 15
    ERROR : Register 10 mistmatch
    LOG : read len 00 05 04
    ERROR : Register 11 mistmatch
    LOG : read len 00 15 45
    ERROR : Register 12 mistmatch
    LOG : read len 00 15 54
    ERROR : Register 13 mistmatch
    LOG : read len 00 15 3F
    ERROR : Register 14 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 15 mistmatch
    LOG : read len 00 00 05
    ERROR : Register 16 mistmatch
    LOG : read len 00 05 40
    ERROR : Register 17 mistmatch
    LOG : read len 00 05 14
    ERROR : Register 18 mistmatch
    LOG : read len 00 06 80
    ERROR : Register 19 mistmatch
    LOG : read len 00 03 A5
    ERROR : Register 1A mistmatch
    LOG : read len 00 15 20
    ERROR : Register 1B mistmatch
    LOG : read len 00 00 51
    ERROR : Register 1C mistmatch
    LOG : read len 00 11 15
    ERROR : Register 1D mistmatch
    LOG : read len 00 01 01
    ERROR : Register 1E mistmatch
    LOG : read len 00 00 00
    ERROR : Register 1F mistmatch
    LOG : read len 00 00 00
    ERROR : Register 20 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 21 mistmatch
    LOG : read len 01 00 00
    ERROR : Register 22 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 23 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 24 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 25 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 26 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 27 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 28 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 29 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 2A mistmatch
    LOG : read len 00 00 00
    ERROR : Register 2B mistmatch
    LOG : read len 00 00 00
    ERROR : Register 2C mistmatch
    LOG : read len 00 00 00
    ERROR : Register 2D mistmatch
    LOG : read len 00 00 00
    ERROR : Register 2E mistmatch
    LOG : read len 00 00 08
    ERROR : Register 2F mistmatch
    LOG : read len 00 00 00
    ERROR : Register 30 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 31 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 32 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 33 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 34 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 35 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 36 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 37 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 38 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 39 mistmatch
    LOG : read len 00 00 00
    ERROR : Register 3A mistmatch
    LOG : read len 00 00 00
    ERROR : Register 3B mistmatch
    LOG : read len 00 00 00
    ERROR : Register 3C mistmatch
    LOG : read len 00 00 00
    ERROR : Register 3D mistmatch
    LOG : read len 00 00 00
    ERROR : Register 3E mistmatch
    LOG : read len 00 00 00
    ERROR : Register 3F mistmatch
  • Charles,
    Can you send us waveform of I2C_CLK and I2C_DAT for following I2C operations.

    ******Do hardware reset*****

    AFE4404_Reg_Write(29, 39999);
    AFE4404_Reg_Write(0, 1);
    a = AFE4404_Reg_Read(29);

    Regards,
    Prabin
  • Hi Prabin,

    Here a digital capture :

    Is it sufficient ? Or a real analog measure is required ? An analog measure will be difficult as we are using a pmic to power up the board and there is traffic with it on I2C.

    As we can see, the AFE answers incorrectly.

    Please note that on the same I2C bus, we have integrated pmic and other competitor sensors and everything works perfectly.

    Regards

    Charles.

  • Hi Charles,

    Could you try the second test mentioned and also attach a capture?

    2) If step 1 gives expected result, try enabling some Offset Cancellation DAC in each phase.
    Disconnect the SFH7060 sensor for this test. Now you should get output as (I_OFFSET_x)*2*RF.

    Best regards,

    Simon

  • Hi Simon,

    Saimon said:

    2) If step 1 gives expected result

    Step 1 does not give the expected result, It fails to read back register values.

    As written in my previous comment, we cannot disconnect SFH7060 as it's a production board.

    I2C bus is working fine with other competitor sensors, PMIC, BLE ...

    Any other suggestion ?

    Best regards.

    Charles.

  • Hi Charles,

    I've two proposals.
    First, for the test you provided to write all registers in a batch doesn't show me both values of the registers, the one you tried to write and the value read. That could be useful to debug the issue. Please provide an output of those values ("Value written: %X", "Value read: %X") for that sequence.

    Second, could you maybe try setting up the I2C to a much slower rate. And go from there forward, that is, try and set it up at different speeds to see if this could be an issue. If it is, you can catch at which speed it starts to fail because the slew rate can catch up to the I2C clock speed.
    A capture at different speeds can be useful to disregard this as being a root cause for the issue.

    Best regards,
    Simon
  • Hi Simon,

    1°) I have done what Prabin asked me :

    write 0xAAAAAA (and 0x555555 in a second run) in all registers => this what I have done.

    Please have a look to previous posts all informations are inside. There is the C code (so the Written values) and the output logs (read back values)

    2°) The I2C is at 100 kHz, it's slow, isn't it ? I will try different speeds. What speeds do you suggest ? 100kHz, 400kHz, 1MHz ?

    Thank you.

    Charles.
  • Hi Charles,

    What I wanted to see is the value of 'a' in each of those cases.
    It could help us to understand the problem if we see the actual value that the variable 'a' stores.

    That speed is indeed not fast, as you say. But still, do the tests to see if you get worse results as you increase the speed or if it's consistent.

    By the way, are you using an MPS430 to control the AFE? In the meantime, I'll look into the firmware code .

    Thank you,
    Simon
  • Hi Simon,

    I'll do the test even If I think the issue is not on I2C. And result is what I expect exact same behaviour whatever the speed.

    I have done @10kHz, @50kHz, @100kHz and 400 kHz. Exact same logs. (see at end of post)

    We are not using MSP430 to control AFE, but a STM32F4.

    ---------------------

    (First line is register 0x01, second line register 0x02 ...)

    @10000 Hz
    LOG : Writing 0xAAAAAA : Reading 000020
    LOG : Writing 0xAAAAAA : Reading 00008A
    LOG : Writing 0xAAAAAA : Reading 000222
    LOG : Writing 0xAAAAAA : Reading 0000A0
    LOG : Writing 0xAAAAAA : Reading 0000A0
    LOG : Writing 0xAAAAAA : Reading 000220
    LOG : Writing 0xAAAAAA : Reading 000282
    LOG : Writing 0xAAAAAA : Reading 0000A0
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000002
    LOG : Writing 0xAAAAAA : Reading 000202
    LOG : Writing 0xAAAAAA : Reading 000088
    LOG : Writing 0xAAAAAA : Reading 0000A8
    LOG : Writing 0xAAAAAA : Reading 000082
    LOG : Writing 0xAAAAAA : Reading 0008A8
    LOG : Writing 0xAAAAAA : Reading 0008A2
    LOG : Writing 0xAAAAAA : Reading 000A02
    LOG : Writing 0xAAAAAA : Reading 000A20
    LOG : Writing 0xAAAAAA : Reading 000203
    LOG : Writing 0xAAAAAA : Reading 000181
    LOG : Writing 0xAAAAAA : Reading 000105
    LOG : Writing 0xAAAAAA : Reading 00052C
    LOG : Writing 0xAAAAAA : Reading 000504
    LOG : Writing 0xAAAAAA : Reading 000083
    LOG : Writing 0xAAAAAA : Reading 0001F1
    LOG : Writing 0xAAAAAA : Reading 000400
    LOG : Writing 0xAAAAAA : Reading 000008
    LOG : Writing 0xAAAAAA : Reading 00882A
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 008003
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 001043
    LOG : Writing 0xAAAAAA : Reading 009100
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0xAAAAAA : Reading 000000
    LOG : Writing 0x555555 : Reading 000044
    LOG : Writing 0x555555 : Reading 000105
    LOG : Writing 0x555555 : Reading 000100
    LOG : Writing 0x555555 : Reading 000411
    LOG : Writing 0x555555 : Reading 000155
    LOG : Writing 0x555555 : Reading 000100
    LOG : Writing 0x555555 : Reading 000104
    LOG : Writing 0x555555 : Reading 000411
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000100
    LOG : Writing 0x555555 : Reading 000015
    LOG : Writing 0x555555 : Reading 000440
    LOG : Writing 0x555555 : Reading 000111
    LOG : Writing 0x555555 : Reading 000514
    LOG : Writing 0x555555 : Reading 000544
    LOG : Writing 0x555555 : Reading 000141
    LOG : Writing 0x555555 : Reading 000151
    LOG : Writing 0x555555 : Reading 000414
    LOG : Writing 0x555555 : Reading 000400
    LOG : Writing 0x555555 : Reading 001003
    LOG : Writing 0x555555 : Reading 000181
    LOG : Writing 0x555555 : Reading 000105
    LOG : Writing 0x555555 : Reading 00052C
    LOG : Writing 0x555555 : Reading 000504
    LOG : Writing 0x555555 : Reading 000083
    LOG : Writing 0x555555 : Reading 0001F1
    LOG : Writing 0x555555 : Reading 000400
    LOG : Writing 0x555555 : Reading 000010
    LOG : Writing 0x555555 : Reading 001015
    LOG : Writing 0x555555 : Reading 000100
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 008003
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 001043
    LOG : Writing 0x555555 : Reading 009100
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000
    LOG : Writing 0x555555 : Reading 000000

  • Hi Charles,


    It looks like you've been missing a statement, to set the REG_READ bit.
    With that updated, your code for test#1 should be as follows.

    for (uint32_t reg = 0x01; reg < 0x40 ;reg++)
    {  
       long a; 
       AFE4404_Reg_Write(reg,0xAAAAAA); 
       AFE4404_Reg_Write(0,1);  
       a = AFE4404_Reg_Read(reg); 
       AFE4404_Reg_Write(0,0);  
       if (a != 0xAAAAAA)
       {  
          log_error("Register %X mistmatch",reg);
       }
    }

    Yes, it looks that the speed is not affecting the issue, but you should try again with the fix.
    Could you try and do the tests again without any other devices if possible on the I2C bus.
    Only with those that are necessary for this test to work.
    I hope this can help.

    Best regards,

    Simon

  • Hi Simon,

    I cannot remove any I2C device as it's a product board.

    I add the "enable read" and get a bit different result. Let me know if the code is correct or not.

    Here the code :

    long a;
    for (uint32_t reg = 0x01; reg < 0x40 ;reg++)
    {
    AFE4404_Reg_Write(reg,0xAAAAAA);
    AFE4404_Reg_Write(0,1);
    a = AFE4404_Reg_Read(reg);
    AFE4404_Reg_Write(0,0);
    log_log("reg %.2X : Writing 0xAAAAAA : Reading %.6X",reg,a);
    }

    for (uint32_t reg = 0x01; reg < 0x40 ;reg++)
    {
    long a;
    AFE4404_Reg_Write(reg,0x555555);
    AFE4404_Reg_Write(0,1);
    a = AFE4404_Reg_Read(reg);
    AFE4404_Reg_Write(0,0);
    log_log("reg %.2X : Writing 0x555555 : Reading %.6X",reg,a);
    }


    The output :

    LOG : reg 01 : Writing 0xAAAAAA : Reading 000020
    LOG : reg 02 : Writing 0xAAAAAA : Reading 00AAAA
    LOG : reg 03 : Writing 0xAAAAAA : Reading 00AAAA
    LOG : reg 04 : Writing 0xAAAAAA : Reading 00AAAA
    LOG : reg 05 : Writing 0xAAAAAA : Reading 00AAAA
    LOG : reg 06 : Writing 0xAAAAAA : Reading 00AAAA
    LOG : reg 07 : Writing 0xAAAAAA : Reading 00AAAA
    LOG : reg 08 : Writing 0xAAAAAA : Reading 00AAAA
    LOG : reg 09 : Writing 0xAAAAAA : Reading 00AAAA
    LOG : reg 0A : Writing 0xAAAAAA : Reading 00AA00
    LOG : reg 0B : Writing 0xAAAAAA : Reading 0000AA
    LOG : reg 0C : Writing 0xAAAAAA : Reading 00AAAA
    LOG : reg 0D : Writing 0xAAAAAA : Reading 00AAAA
    LOG : reg 0E : Writing 0xAAAAAA : Reading 00AAAA
    LOG : reg 0F : Writing 0xAAAAAA : Reading 00AAAA
    LOG : reg 10 : Writing 0xAAAAAA : Reading 00AAAA
    LOG : reg 11 : Writing 0xAAAAAA : Reading 00AAAA
    LOG : reg 12 : Writing 0xAAAAAA : Reading 00AAAA
    LOG : reg 13 : Writing 0xAAAAAA : Reading 00AAAA
    LOG : reg 14 : Writing 0xAAAAAA : Reading 00AA2A
    LOG : reg 15 : Writing 0xAAAAAA : Reading 002A88
    LOG : reg 16 : Writing 0xAAAAAA : Reading 008808
    LOG : reg 17 : Writing 0xAAAAAA : Reading 000828
    LOG : reg 18 : Writing 0xAAAAAA : Reading 002822
    LOG : reg 19 : Writing 0xAAAAAA : Reading 002282
    LOG : reg 1A : Writing 0xAAAAAA : Reading 0082A0
    LOG : reg 1B : Writing 0xAAAAAA : Reading 00A0A0
    LOG : reg 1C : Writing 0xAAAAAA : Reading 00A0A8
    LOG : reg 1D : Writing 0xAAAAAA : Reading 00A8AA
    LOG : reg 1E : Writing 0xAAAAAA : Reading 00AAAA
    LOG : reg 1F : Writing 0xAAAAAA : Reading AAAAA2
    LOG : reg 20 : Writing 0xAAAAAA : Reading AAA2AA
    LOG : reg 21 : Writing 0xAAAAAA : Reading A2AA00
    LOG : reg 22 : Writing 0xAAAAAA : Reading AA0000
    LOG : reg 23 : Writing 0xAAAAAA : Reading 000000
    LOG : reg 24 : Writing 0xAAAAAA : Reading 000000
    LOG : reg 25 : Writing 0xAAAAAA : Reading 000000
    LOG : reg 26 : Writing 0xAAAAAA : Reading 000000
    LOG : reg 27 : Writing 0xAAAAAA : Reading 000000
    LOG : reg 28 : Writing 0xAAAAAA : Reading 000000
    LOG : reg 29 : Writing 0xAAAAAA : Reading 000000
    LOG : reg 2A : Writing 0xAAAAAA : Reading 000000
    LOG : reg 2B : Writing 0xAAAAAA : Reading 000000
    LOG : reg 2C : Writing 0xAAAAAA : Reading 000000
    LOG : reg 2D : Writing 0xAAAAAA : Reading 000000
    LOG : reg 2E : Writing 0xAAAAAA : Reading 000000
    LOG : reg 2F : Writing 0xAAAAAA : Reading 0000C9
    LOG : reg 30 : Writing 0xAAAAAA : Reading 00C9C1
    LOG : reg 31 : Writing 0xAAAAAA : Reading C9C15A
    LOG : reg 32 : Writing 0xAAAAAA : Reading C15AD7
    LOG : reg 33 : Writing 0xAAAAAA : Reading 5AD700
    LOG : reg 34 : Writing 0xAAAAAA : Reading D70000
    LOG : reg 35 : Writing 0xAAAAAA : Reading 000000
    LOG : reg 36 : Writing 0xAAAAAA : Reading 000000
    LOG : reg 37 : Writing 0xAAAAAA : Reading 000000
    LOG : reg 38 : Writing 0xAAAAAA : Reading 000000
    LOG : reg 39 : Writing 0xAAAAAA : Reading 000001
    LOG : reg 3A : Writing 0xAAAAAA : Reading 000111
    LOG : reg 3B : Writing 0xAAAAAA : Reading 011100
    LOG : reg 3C : Writing 0xAAAAAA : Reading 110000
    LOG : reg 3D : Writing 0xAAAAAA : Reading 000000
    LOG : reg 3E : Writing 0xAAAAAA : Reading 000000
    LOG : reg 3F : Writing 0xAAAAAA : Reading 000000
    LOG : reg 01 : Writing 0x555555 : Reading 000155
    LOG : reg 02 : Writing 0x555555 : Reading 015555
    LOG : reg 03 : Writing 0x555555 : Reading 555555
    LOG : reg 04 : Writing 0x555555 : Reading 555555
    LOG : reg 05 : Writing 0x555555 : Reading 555555
    LOG : reg 06 : Writing 0x555555 : Reading 555555
    LOG : reg 07 : Writing 0x555555 : Reading 555555
    LOG : reg 08 : Writing 0x555555 : Reading 555555
    LOG : reg 09 : Writing 0x555555 : Reading 005555
    LOG : reg 0A : Writing 0x555555 : Reading 005500
    LOG : reg 0B : Writing 0x555555 : Reading 000055
    LOG : reg 0C : Writing 0x555555 : Reading 005555
    LOG : reg 0D : Writing 0x555555 : Reading 005555
    LOG : reg 0E : Writing 0x555555 : Reading 005555
    LOG : reg 0F : Writing 0x555555 : Reading 005555
    LOG : reg 10 : Writing 0x555555 : Reading 005555
    LOG : reg 11 : Writing 0x555555 : Reading 005555
    LOG : reg 12 : Writing 0x555555 : Reading 005555
    LOG : reg 13 : Writing 0x555555 : Reading 005555
    LOG : reg 14 : Writing 0x555555 : Reading 005515
    LOG : reg 15 : Writing 0x555555 : Reading 001501
    LOG : reg 16 : Writing 0x555555 : Reading 000105
    LOG : reg 17 : Writing 0x555555 : Reading 000545
    LOG : reg 18 : Writing 0x555555 : Reading 004514
    LOG : reg 19 : Writing 0x555555 : Reading 001411
    LOG : reg 1A : Writing 0x555555 : Reading 001155
    LOG : reg 1B : Writing 0x555555 : Reading 005500
    LOG : reg 1C : Writing 0x555555 : Reading 000051
    LOG : reg 1D : Writing 0x555555 : Reading 005155
    LOG : reg 1E : Writing 0x555555 : Reading 005555
    LOG : reg 1F : Writing 0x555555 : Reading 555515
    LOG : reg 20 : Writing 0x555555 : Reading 551515
    LOG : reg 21 : Writing 0x555555 : Reading 151500
    LOG : reg 22 : Writing 0x555555 : Reading 150000
    LOG : reg 23 : Writing 0x555555 : Reading 000000
    LOG : reg 24 : Writing 0x555555 : Reading 000000
    LOG : reg 25 : Writing 0x555555 : Reading 000000
    LOG : reg 26 : Writing 0x555555 : Reading 000000
    LOG : reg 27 : Writing 0x555555 : Reading 000000
    LOG : reg 28 : Writing 0x555555 : Reading 000000
    LOG : reg 29 : Writing 0x555555 : Reading 000000
    LOG : reg 2A : Writing 0x555555 : Reading 000000
    LOG : reg 2B : Writing 0x555555 : Reading 000000
    LOG : reg 2C : Writing 0x555555 : Reading 000000
    LOG : reg 2D : Writing 0x555555 : Reading 000000
    LOG : reg 2E : Writing 0x555555 : Reading 000000
    LOG : reg 2F : Writing 0x555555 : Reading 000000
    LOG : reg 30 : Writing 0x555555 : Reading 000000
    LOG : reg 31 : Writing 0x555555 : Reading 004150
    LOG : reg 32 : Writing 0x555555 : Reading 005055
    LOG : reg 33 : Writing 0x555555 : Reading 005500
    LOG : reg 34 : Writing 0x555555 : Reading 000000
    LOG : reg 35 : Writing 0x555555 : Reading 000000
    LOG : reg 36 : Writing 0x555555 : Reading 000000
    LOG : reg 37 : Writing 0x555555 : Reading 000000
    LOG : reg 38 : Writing 0x555555 : Reading 000000
    LOG : reg 39 : Writing 0x555555 : Reading 000001
    LOG : reg 3A : Writing 0x555555 : Reading 000111
    LOG : reg 3B : Writing 0x555555 : Reading 011100
    LOG : reg 3C : Writing 0x555555 : Reading 110000
    LOG : reg 3D : Writing 0x555555 : Reading 000000
    LOG : reg 3E : Writing 0x555555 : Reading 000000
    LOG : reg 3F : Writing 0x555555 : Reading 000000

  • Hi Charles,

    The code is correct.

    The output already looks much better, still, there seems to be an issue in some of the registers values read (or during the write).

    1. This is just a wild guess, but can you check if the i2c format is correct during the read command (you are sending all of the start/stop conditions,...)

    2. One other test you can do (to discard if the issue is during read or write or both) is a read, then a write and again a read.
        Even better if you put some delays in between. Something like this:

    uint32_t reg, val, read1, read2;
    val =  0xAA5533;
    for (reg = 0x01; reg < 0x40 ;reg++)  
    {  
    
    	AFE4404_Reg_Write(AFE_CONTROL0,0x000001); // read mode
    	read1 = AFE4404_Reg_Read(reg);
    	
    	/* minor delay */
    	
    	AFE4404_Reg_Write(AFE_CONTROL0,0x000000); // write mode
    	AFE4404_Reg_Write(reg, val);
    	
    	/* minor delay */
    	
    	AFE4404_Reg_Write(AFE_CONTROL0,0x000001); // read mode
    	read2 = AFE4404_Reg_Read(reg);
    	
    	/* minor delay */
    	
    	log_log("reg %.2X: 1st READ '%.6X' / WROTE '%.6X' / 2nd READ '%.6X'", reg, read1, val, read2);
    }
    

    Slowing things down like this can help us identify the cause of the problem.

    Let me know if it helps.

    best regards,

    Simon

  • Hi Simon,

    1°) Here the screenshots of some Write/read :

    Write:

    Read :

    Write :

    Read :

    2°) Here the logs with the code you post (delay = 10 ms) :

    LOG : reg 01: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000133'
    LOG : reg 02: 1st READ '000100' / WROTE 'AA5533' / 2nd READ '005533'
    LOG : reg 03: 1st READ '000300' / WROTE 'AA5533' / 2nd READ '005533'
    LOG : reg 04: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '005533'
    LOG : reg 05: 1st READ '000100' / WROTE 'AA5533' / 2nd READ '005533'
    LOG : reg 06: 1st READ '000300' / WROTE 'AA5533' / 2nd READ '005533'
    LOG : reg 07: 1st READ '000300' / WROTE 'AA5533' / 2nd READ '005533'
    LOG : reg 08: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '005533'
    LOG : reg 09: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '005533'
    LOG : reg 0A: 1st READ '000100' / WROTE 'AA5533' / 2nd READ '005500'
    LOG : reg 0B: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000033'
    LOG : reg 0C: 1st READ '000200' / WROTE 'AA5533' / 2nd READ '005533'
    LOG : reg 0D: 1st READ '000100' / WROTE 'AA5533' / 2nd READ '005533'
    LOG : reg 0E: 1st READ '000100' / WROTE 'AA5533' / 2nd READ '005533'
    LOG : reg 0F: 1st READ '000100' / WROTE 'AA5533' / 2nd READ '005533'
    LOG : reg 10: 1st READ '000100' / WROTE 'AA5533' / 2nd READ '005533'
    LOG : reg 11: 1st READ '000100' / WROTE 'AA5533' / 2nd READ '005533'
    LOG : reg 12: 1st READ '000200' / WROTE 'AA5533' / 2nd READ '005533'
    LOG : reg 13: 1st READ '000200' / WROTE 'AA5533' / 2nd READ '005533'
    LOG : reg 14: 1st READ '001203' / WROTE 'AA5533' / 2nd READ '005533'
    LOG : reg 15: 1st READ '000181' / WROTE 'AA5533' / 2nd READ '001501'
    LOG : reg 16: 1st READ '000105' / WROTE 'AA5533' / 2nd READ '000101'
    LOG : reg 17: 1st READ '00052C' / WROTE 'AA5533' / 2nd READ '000521'
    LOG : reg 18: 1st READ '000504' / WROTE 'AA5533' / 2nd READ '004532'
    LOG : reg 19: 1st READ '000083' / WROTE 'AA5533' / 2nd READ '001413'
    LOG : reg 1A: 1st READ '0001F1' / WROTE 'AA5533' / 2nd READ '001131'
    LOG : reg 1B: 1st READ '000400' / WROTE 'AA5533' / 2nd READ '005520'
    LOG : reg 1C: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000031'
    LOG : reg 1D: 1st READ '001001' / WROTE 'AA5533' / 2nd READ '005133'
    LOG : reg 1E: 1st READ '000100' / WROTE 'AA5533' / 2nd READ '005533'
    LOG : reg 1F: 1st READ '000000' / WROTE 'AA5533' / 2nd READ 'AA5513'
    LOG : reg 20: 1st READ '008003' / WROTE 'AA5533' / 2nd READ 'AA5533'
    LOG : reg 21: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '8A5500'
    LOG : reg 22: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '2A0000'
    LOG : reg 23: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000000'
    LOG : reg 24: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000000'
    LOG : reg 25: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000000'
    LOG : reg 26: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000000'
    LOG : reg 27: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000000'
    LOG : reg 28: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000000'
    LOG : reg 29: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000000'
    LOG : reg 2A: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000000'
    LOG : reg 2B: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000000'
    LOG : reg 2C: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000000'
    LOG : reg 2D: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000000'
    LOG : reg 2E: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000000'
    LOG : reg 2F: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000000'
    LOG : reg 30: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000000'
    LOG : reg 31: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '004112'
    LOG : reg 32: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '005013'
    LOG : reg 33: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '005500'
    LOG : reg 34: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000000'
    LOG : reg 35: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000000'
    LOG : reg 36: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000000'
    LOG : reg 37: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000000'
    LOG : reg 38: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000000'
    LOG : reg 39: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000001'
    LOG : reg 3A: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000111'
    LOG : reg 3B: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '001100'
    LOG : reg 3C: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000000'
    LOG : reg 3D: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000000'
    LOG : reg 3E: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000000'
    LOG : reg 3F: 1st READ '000000' / WROTE 'AA5533' / 2nd READ '000000'

    Thank you again for your support.

    Charles.

  • Hi Charles,

    I don't know why I didn't notice this before..
    The values you are trying to write on the registers (0x1h-0x3Fh) are not always possible because not all bit fields in all of the registers can be written. If some bit field is read-only or zeroed ("must write zero"), you won't be able to write any value.
    I didn't check all the registers, but it seems that I2C is working fine (ACKs for all frames and values seem to be correct).

    Going back to the initial problem..
    From what I understood, you didn't notice any difference on the ambient light measurement for one of the LEDs even if you changed the finger position, is that correct?
    How about for the other LED? Is that working properly?
    Can you elaborate a little bit more on how you tested on each of the LED values and if it's working for other LEDVALs?

    Thanks,
    Simon
  • Hi Simon,

    As explained in my initial post :

    • I can drive the LED's
    • Configure clock
    • Get AFE interrupt

    But when I read values I get garbage :

    LED2VAL       : 00 00 00
    LED3VAL       : 00 00 00
    LED1VAL       : 00 00 00
    ALED1VAL      : 00 00 00
    LED2_ALED2VAL : 00 00 00 
    LED1_ALED1VAL : 00 00 XX

    Where XX are random values.
    For testing purpose, we put a white light source on the sensors XX becomes 00.

    The configuration used is detailed in the first post.

    Charles.

  • Charles,

    I'm going to recreate the issue you are having.
    I'll use the same registers settings that you used, to see if the problem lies in our device or not.

    Could you send us a waveform when capturing the LED values?
    Also, could you provide us with a schematic of your setup?

    Thanks.

    Simon
  • Hi Simon,

    Do you have any result with your tests ?

    I cannot share schematics on public forum. Do you have any idea of the possible issue we have in our design ?

    It is difficult to measure waveform as it's quite small design.

    Thank you.


    Charles.

  • Hi,

    We seem to be having exactly the same issue, was this issue resolved? If so, how?
  • Hi Arthur,

    We won't solve it. Yet we use another brand sensors. We keep this sensors in case TI find a solution as it has gree/IR/Red LED/Sensors.
    But if we are not able to make it work, we will not use it.

    I'll keep you informed on this topics if we find a solution.
  • Charles,

    I'm sorry you are still dealing with this situation.
    Could you provide an analog capture from the oscilloscope showing the I2C traffic?
    We want to help you solve the issue as soon as possible.

    Arthur,
    if you open a new thread in E2E and provide more information like a capture of I2C traffic when doing a read or a write, I'm sure we can help you further to solver the issue you are seeing.

    Thanks
    Simon