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.

Some sensor output unexpected value by afe4400

Other Parts Discussed in Thread: AFE4400

Hi,

My system

MCU: arduino(atmega328)

AFE4400  setting:

AFE4400Write(CONTROL0,0x000000);

AFE4400Write(TIAGAIN,0x000000); 

AFE4400Write(TIA_AMB_GAIN,0x00007D);  // 10k 100pF
AFE4400Write(LEDCNTRL,0x010F0F);
AFE4400Write(CONTROL2,0x000000);
AFE4400Write(CONTROL1,0x010707);

I test the Osram SFH7050 sensor.

The output of red, ir value is strange.

When i put on my finger on the sensor, output value is over 22bit format such as 286330776,286329805.

The output variable type is uint32_t.

The  ir, red value output strange value respectively or simultaneously.

Below picture is the output value.

However, the output vlaue is normal when I take off my finger on the sensor 

I test five or six SpO2 sensors, this phenomenon is shown by some SpO2 sensors.

I tried  changing LED current and TIA gain but not improved.

This is my SPI read source code.

uint32_t AFE4400Read (uint8_t address)
{
uint32_t data=0;
digitalWrite (SPISTE, LOW); // enable device
SPI.transfer (address); // send address to device
//SPI.transfer (data);
data |= (SPI.transfer (0)<<16); // read top 8 bits data
data |= (SPI.transfer (0)<<8); // read middle 8 bits data
data |= SPI.transfer (0); // read bottom 8 bits data
digitalWrite (SPISTE, HIGH); // disable device

return data; // return with 24 bits of read data
}

Why this error occur?

  • Hi Sangkyu,

    Though the AFE4400Read function read only 24 bits from the AFE, the results who have attached have 32 bit data.
    ‭‭Example: 286330776‬ = 0x11110F98‬
    Please check your code if you are appending any data after the read function call.
  • Thanks Praveen,

    There is no appended data after read function call.

    Only some sensors have this problem.

    The PPG sensor included in AFE4400 EVM using same PPG hardware and software, This error is not occur......

    Another disposable sensor(made in china) not ouccur this error too.

    The Nellcor disposable sensor occur this error. 

    I think this error depend on kind of  sensor.

  • I found the why occuring error.
    The data lower than 2^15(0d 32768) is not problem.
    But,the data larger than 2^15(0d 32768) is output the error data like below picture.

    Bht, I don't know the reason.

  • Try casting each byte to uint8_t or masking with 0xFF. You also need to check bit 21 if you are reading subtracted ambient data, in case you have -ve data.

    int32_t data = ((datah&0xFF)<<16)|((datam&0xFF)<<8)|(datal&0xFF);
    if (data&0x200000)
    {
    data = -(~(data-1)&0x3FFFF);
    }