ADPD144RI - SPO2 data read EXAMPLE

Please share an example code for ADPD144RI read data from ESP32 or Arduino

  • 0
    •  Analog Employees 
    on Aug 5, 2021 7:40 PM in reply to subbu

    Hi there,

    The Vref should be at 1.265V. The voltages at LEDX1 and LEDX2 looked fine , meaning there is  voltage drops across the integrated red and IR LEDs. 

    Were you able to see the red LED glowing with the config I posted?

    With regard to the FIFO read, I will ask our firmware colleague to comment.

    Regards,

    Glen

  • Dear Glen, 

    The Red led did not glow after we loaded the configuration.

    What is the reason for voltage drop across LEDS. 

  • 0
    •  Analog Employees 
    on Aug 6, 2021 12:38 PM in reply to subbu

    Hi Subbu,

    Regarding FIFO read data can you share your code snippet to go through it.

    Are you using AdpdDrvReadFifoData() API to readout data from FIFO?

    Regards,

    Sathishkumar

  • 0
    •  Analog Employees 
    on Aug 6, 2021 12:58 PM in reply to subbu

    Hi there,

    Did you set register 0x10 to 0x0002 after you loaded the config to start the data acquisition? The LEDs glow only when the ADPD144RI is in sample mode. 

    When LEDX1/LEDX2 are on, there is  forward voltage across the LED(s), depending on the current. Please note that the LEDX1 and LEDX2 are current sink and only turned on during the LED pulses. The voltage at the LEDX1 and LEDX2 pins should be close to VLED when the LEDX1/LEDX2 are off.  

    Regards,

    Glen B.

  • Dear Sathish, 

    Please find the attached source code. 

    Briefly, We are trying to do the following:

    1. Initially, We are programming the registers as per the above configuration file by putting the chip in program mode.

    2. After the configuration file is loaded, We are putting device into Normal operation mode (By writing 02 to Register 0x10).

    3. We are reading the data stored in registers 0x64 to 0x6b. 

    4. After reading, We are clearing the FIFO  and trying to read the data again.

    We also need clarification on the following.

    In this code snippet.

    https://github.com/analogdevicesinc/adpd-drivers/blob/master/ADPD10xx/examples/example188.c

    /* Clear the FIFO */

       AdpdDrvRegWrite(0x10, 0);

       AdpdDrvRegWrite(0x5F, 1);

       AdpdDrvRegWrite(0x00, 0x80FF);

       AdpdDrvRegWrite(0x5F, 0);

    According to the above code snippet, 0 is written to 0x10, which puts the chip in to standby mode and later the register programming is done to clear FIFO.

    But, As per the startup sequence mentioned in datasheet, From Normal Operation mode, To clear the FIFO, We need to put the chip in to program mode and then enter necessary register values to clear FIFO and later we need to program 0x10 with 0x2 to put the device into read mode.

    We would like to understand, the difference between the procedure followed in example188.c and approach suggested in datasheet to clear FIFO.

    Thanks

    .

    4617.main.txt
    #define ADPDDrv_SUCCESS (0)
    #define ADPDDrv_ERROR (-1)
    #define ADPD_I2C_ADDRESS (0x64)
    #include <uart_debug.h>
    
    void main(void)
    {
    uint32_t LoopCnt = 0;
    uint8_t value[16] = {0};
    uint16_t nAdpdFifoLevelSize = 64, nAdpdDataSetSize;
    uint16_t nLoopLim = 16;
    uint16_t nAdpdDataSetSize = 8;
    uint16_t nRetValue = 0;
    
    while (1) 
    {
    	nRetValue = AdpdDrvReadFifoData(&value[0], nAdpdDataSetSize);
    	if (nRetValue == ADPDDrv_SUCCESS)
    	{
    		for (LoopCnt = 0; LoopCnt < nLoopLim; LoopCnt += 2)
    		{
    			UART_Print("%u ", (value[LoopCnt] << 8) | value[LoopCnt + 1]);
    			nAdpdFifoLevelSize = nAdpdFifoLevelSize - nAdpdDataSetSize;
    		}
    	}
    }
    
    int16_t AdpdDrvReadFifoData(uint8_t *pnData, uint16_t nDataSetSize)
    {
    	uint8_t nGetFifoData, nAddr;
    	nAddr = 0x60;
    	if (ADPD_I2C_TxRx((uint8_t *) &nAddr, pnData, nDataSetSize) != HAL_OK)
    		return ADPDDrv_ERROR;
    	return ADPDDrv_SUCCESS;
    }
    bool ADPD_I2C_TxRx(unsigned char* pTxData, unsigned char* pRxData, unsigned int Size) 
    { 
    	HAL_I2C_Master_Transmit(&hi2c2, (uint16_t)(ADPD_I2C_ADDRESS << 1), (uint8_t *)pTxData, Size, 100);
    	return (HAL_STATUS_t)HAL_I2C_Master_Receive(&hi2c2, (uint16_t)(ADPD_I2C_ADDRESS << 1), pRxData, Size, 100);
    }