Please share an example code for ADPD144RI read data from ESP32 or Arduino
ADPD144RI
Not Recommended for New Designs
The ADPD144RI is a highly integrated, photometric front end optimized for photoplethysmography (PPG) detection of blood oxygenation (SpO2) by synchronous...
Datasheet
ADPD144RI on Analog.com
Please share an example code for ADPD144RI read data from ESP32 or Arduino
Hi there,
Please check the thread at the link below:
https://ez.analog.com/optical_sensing/f/q-a/165141/adpd144ri-software-code-example
Regards,
Glen B.
Dear Glen,
I am writing on behalf of Suresh. The github link contains drivers for ADPD10X. It does not contain specifically for ADPD144. Please let us know if there is any other location where specific files for ADPD10X is placed.
In the meantime, We have tried to test our PCB with ADPD144.
We have programmed the register Setting values as suggested in the datasheet and also in engineering Zone forum link: (https://ez.analog.com/optical_sensing/f/q-a/165141/adpd144ri-software-code-example) have been used to program.
Initially, We tried to read the reset values of each register. The values read matched with the expected values provided in Table-13 (Register Listing) of datasheet.
We are using Poling method to read the data. Although, We have used the same register values as suggested in datasheet or Forum, The data observed in the data registers 0x64 to 0x7F are 0x0000.
We also placed the finger on the ADPD1443I, the LED did not turn on also, the data registers still sshowed 0x00000
We have followed the startup sequence suggested in the datasheet. Initially, register 0x10 is written 0x0001 during writing all the registers and later after all the registers are written, register 0x10 is written 0x0002 to enter into normal operation mode.
The register values that we programmed and the values we readout are shown below.
Reg name |
Register Address |
Programmed Values |
Read out Values |
Mode |
0x10 |
0x00000001 |
|
Mode read |
0x10 |
|
0x00000001 |
STATUS |
0x00 |
0x00008000 |
|
int mask |
0x1 |
0x000000ff |
|
int io ctl |
0x2 |
0x00000005 |
|
fifo thresh |
0x6 |
0x00000000 |
|
STATUS |
0x00 |
0x0000ff60 |
|
ID |
0x08 |
|
0x00000416 |
slot |
0x11 |
0x000030a9 |
|
fsample |
0x12 |
0x0000000a |
|
led select |
0x14 |
0x00000116 |
|
num avg |
0x15 |
0x00000330 |
|
ach1 0ff |
0x18 |
0x00003fff |
|
ach2 0ff |
0x19 |
0x00003fff |
|
ach3 0ff |
0x1a |
0x00001ff0 |
|
ach4 0ff |
0x1b |
0x00001ff0 |
|
bch1 0ff |
0x1e |
0x00003fff |
|
bch1 0ff |
0x1f |
0x00003fff |
|
bch1 0ff |
0x20 |
0x00001ff0 |
|
bch1 0ff |
0x21 |
0x00001ff0 |
|
|
0x22 |
0x00003000 |
|
1coarse |
0x23 |
0x00003005 |
|
2coarse |
0x24 |
0x00003007 |
|
ledfine |
0x25 |
0x00000207 |
|
a_m0de |
0x30 |
0x00000319 |
|
a_pulse |
0x31 |
0x00000813 |
|
leddis |
0x34 |
0x00000000 |
|
b_m0de |
0x35 |
0x00000319 |
|
b_pulse |
0x36 |
0x00000813 |
|
ext sync startup |
0x38 |
0x00000000 |
|
a_afe |
0x39 |
0x000021f3 |
|
b_afe |
0x3b |
0x000021f3 |
|
|
0x3c |
0x00003006 |
|
a_gain |
0x42 |
0x00001c36 |
|
a_afe_con |
0x43 |
0x0000ada5 |
|
a_gain |
0x44 |
0x00001c36 |
|
b_afe_con |
0x45 |
0x0000ada5 |
|
clk written |
0x4b |
0x00000080 |
|
clk read |
0x4b |
|
0x00000080 |
alk adjust |
0x4d |
0x0000425e |
|
adc_tim |
0x4e |
0x00000040 |
|
ext sync sel |
0x4f |
0x00002090 |
|
cal enb |
0x50 |
0x00000000 |
|
|
0x52 |
0x00000040 |
|
|
0x54 |
0x00000020 |
|
tia gain |
0x55 |
0x00000000 |
|
|
0x5a |
0x00000010 |
|
dataacc_ctl |
0x5f |
0x00000000 |
|
dataacc_ctl |
0x5f |
0x00000006 |
|
mode written |
0x10 |
0x00000002 |
|
mode read |
0x10 |
|
0x00000002 |
SL0TA_PD1_16BIT read |
0x64 |
|
0x00000000 |
SL0TA_PD2_16BIT read |
0x65 |
|
0x00000000 |
SL0TA_PD3_16BIT read |
0x66 |
|
0x00000000 |
SL0TA_PD4_16BIT read |
0x67 |
|
0x00000000 |
SL0TB_PD1_16BIT read |
0x68 |
|
0x00000000 |
SL0TB_PD2_16BIT read |
0x69 |
|
0x00000000 |
SL0TB_PD3_16BIT read |
0x6a |
|
0x00000000 |
SL0TB_PD4_16BIT read |
0x6b |
|
0x00000000 |
We also have tried to verify with respect to hardware.
The schematic we have used is shown below.
Please let us know if you see any issues. We are unable to get any data (The data registers are reading 0x0000) and LED is also not turning ON when we keep the finger.
Thanks
Hi there,
The ADPD144RI has ADPD103 and LEDs and PDs inside. So the driver for ADPD10x is the right one for ADPD144RI. You can always refer to the ADPD103 datasheet for details of the register map. The formula for CVLED calculation is correct. The 1u + 0.1u caps are OK for VLED. The 1u cap for VREF is also fine.
With regard to register settings, the register 0x5F was set to 0x0006, which prevents the data update. Have you tried to read data from the FIFO? There are a few other registers with nontypical settings in your config. The configure below worked very well. Please try if it works for you.
# ADPD144RI_Config_File
# Register Value
02 0005
06 0000
11 30A9
12 000A
14 0116
15 0330
18 3FFF
19 3FFF
1A 1FF0
1B 1FF0
1E 3FFF
1F 3FFF
20 1FF0
21 1FF0
22 3000
23 3005
24 3007
25 0207
34 0000
30 0319
31 0813
35 0319
36 0813
39 21F3
3B 21F3
3C 3006
42 1C36
43 ADA5
44 1C36
45 ADA5
4E 0040
54 0020
5A 0000
Regards,
Glen B.
Dear Glen,
Thanks for reply, We tried to use the suggested register values and followed steps as per the start up sequence. We are able to observe the data in Registers 0x64 to 0x6b.
However, We are unable to see the LED glow. I believe this is because of the LED pulse width set to 3uSec and pulse period to 19uSec. Please correct me if this is not the correct behavior.
What is the expected voltage across Vref capacitor. When I measured It was 0V. Is this correct.
Since, We are using Internal LEDs, Datasheet mentions, We can measure the voltage LEDX1 and LED X2. The measured value on LEDX1 is 1.68V and LEDX2 is 2V. Are these values correct.
Thanks.
******************* *** Butterfly *** ******************* *** Ox10 mode WR 0x00000001 *** Ox2 0x00000005 *** Ox6 0x00000000 *** Ox11 SLOT 0x000030a9 *** Ox12 fsample 0x0000000a *** Ox14 led select 0x00000116 *** Ox15 num avg 0x00000330 *** Ox18 ach1 off 0x00003fff *** Ox19 ach2 off 0x00003fff *** Ox1a ach3 off 0x00001ff0 *** Ox1b ach4 off 0x00001ff0 *** Ox1e bch1 off 0x00003fff *** Ox1f bch1 off 0x00003fff *** Ox20 bch1 off 0x00001ff0 *** Ox21 bch1 off 0x00001ff0 *** Ox22 0x00003000 *** Ox23 1coarse 0x00003005 *** Ox24 2coarse 0x00003007 *** Ox25 ledfine 0x00000207 *** Ox34 leddis 0x00000000 *** Ox30 a_mode 0x00000319 *** Ox31 a_pulse 0x00000813 *** Ox35 b_mode 0x00000319 *** Ox36 b_pulse 0x00000813 *** Ox39 a_afe 0x000021f3 *** Ox3b b_afe 0x000021f3 *** Ox3c 0x00003006 *** Ox42 a_gain 0x00001c36 *** Ox43 a_afe_con 0x0000ada5 *** Ox44 a_gain 0x00001c36 *** Ox45 0x0000ada5 *** Ox4b 0x0002695 *** Ox4d 0x00004272 *** Ox4e adc_tim 0x00000040 *** Ox54 0x00000020 *** Ox5a 0x00000000 *** Ox10 mode written 0x00000002 0x1 WR clear INT 0x00000006 0x1 INTR status RD to check RESET 0x00000006 0x0000 is written to 0x0001 to set the Slot interrupts 0x0007 written to 0002 DATA read from 0x0000 is 0x0006 Data read in the INTR Context *** Time Slot INTR *** Time Slot INTR *** Ox10 mode written 0x00000002 *** Ox10 mode read 0x00000002 Reg address is 64 and data read is 494bcc18 Reg address is 65 and data read is 11d69f9a Reg address is 66 and data read is a55fbc02 Reg address is 67 and data read is ae2f8a00 Reg address is 68 and data read is e99aa264 Reg address is 69 and data read is 216e2d3 Reg address is 6a and data read is de19f14b Reg address is 6b and data read is 35389cd4 Reg address is 64 and data read is b5494468 Reg address is 65 and data read is 376b96fe Reg address is 66 and data read is b1b846e5 Reg address is 67 and data read is 247e0000 Reg address is 68 and data read is b348b3bc Reg address is 69 and data read is bfc0c147 Reg address is 6a and data read is bea15bef Reg address is 6b and data read is 31258028 Reg address is 64 and data read is 387aafb8 Reg address is 65 and data read is 7f780db2 Reg address is 66 and data read is 512ba900 Reg address is 67 and data read is f2000000 Reg address is 68 and data read is 74cc9814 Reg address is 69 and data read is 81917a3b Reg address is 6a and data read is 518ef713 Reg address is 6b and data read is b038f9fc Reg address is 64 and data read is d65f9160 Reg address is 65 and data read is 590b1a4d Reg address is 66 and data read is 64ed0000 Reg address is 67 and data read is 0 Reg address is 68 and data read is 92adaf6c Reg address is 69 and data read is 4539ddaf Reg address is 6a and data read is c66852b7 Reg address is 6b and data read is a0df5a50
******************* *** Butterfly *** ******************* *** Ox10 mode WR 0x00000001 *** Ox2 0x00000005 *** Ox6 0x00000000 *** Ox11 SLOT 0x000030a9 *** Ox12 fsample 0x0000000a *** Ox14 led select 0x00000116 *** Ox15 num avg 0x00000330 *** Ox18 ach1 off 0x00003fff *** Ox19 ach2 off 0x00003fff *** Ox1a ach3 off 0x00001ff0 *** Ox1b ach4 off 0x00001ff0 *** Ox1e bch1 off 0x00003fff *** Ox1f bch1 off 0x00003fff *** Ox20 bch1 off 0x00001ff0 *** Ox21 bch1 off 0x00001ff0 *** Ox22 0x00003000 *** Ox23 1coarse 0x00003005 *** Ox24 2coarse 0x00003007 *** Ox25 ledfine 0x00000207 *** Ox34 leddis 0x00000000 *** Ox30 a_mode 0x00000319 *** Ox31 a_pulse 0x00000813 *** Ox35 b_mode 0x00000319 *** Ox36 b_pulse 0x00000813 *** Ox39 a_afe 0x000021f3 *** Ox3b b_afe 0x000021f3 *** Ox3c 0x00003006 *** Ox42 a_gain 0x00001c36 *** Ox43 a_afe_con 0x0000ada5 *** Ox44 a_gain 0x00001c36 *** Ox45 0x0000ada5 *** Ox4b 0x0002695 *** Ox4d 0x00004272 *** Ox4e adc_tim 0x00000040 *** Ox54 0x00000020 *** Ox5a 0x00000000 *** Ox10 mode written 0x00000002 0x1 WR clear INT 0x00000006 0x1 INTR status RD to check RESET 0x00000006 0x0000 is written to 0x0001 to set the Slot interrupts 0x0007 written to 0002 DATA read from 0x0000 is 0x0006 Data read in the INTR Context *** Time Slot INTR *** Time Slot INTR *** Ox10 mode written 0x00000002 *** Ox10 mode read 0x00000002 Reg address is 64 and data read is 494bcc18 Reg address is 65 and data read is 11d69f9a Reg address is 66 and data read is a55fbc02 Reg address is 67 and data read is ae2f8a00 Reg address is 68 and data read is e99aa264 Reg address is 69 and data read is 216e2d3 Reg address is 6a and data read is de19f14b Reg address is 6b and data read is 35389cd4 Reg address is 64 and data read is b5494468 Reg address is 65 and data read is 376b96fe Reg address is 66 and data read is b1b846e5 Reg address is 67 and data read is 247e0000 Reg address is 68 and data read is b348b3bc Reg address is 69 and data read is bfc0c147 Reg address is 6a and data read is bea15bef Reg address is 6b and data read is 31258028 Reg address is 64 and data read is 387aafb8 Reg address is 65 and data read is 7f780db2 Reg address is 66 and data read is 512ba900 Reg address is 67 and data read is f2000000 Reg address is 68 and data read is 74cc9814 Reg address is 69 and data read is 81917a3b Reg address is 6a and data read is 518ef713 Reg address is 6b and data read is b038f9fc Reg address is 64 and data read is d65f9160 Reg address is 65 and data read is 590b1a4d Reg address is 66 and data read is 64ed0000 Reg address is 67 and data read is 0 Reg address is 68 and data read is 92adaf6c Reg address is 69 and data read is 4539ddaf Reg address is 6a and data read is c66852b7 Reg address is 6b and data read is a0df5a50
Dear Glen,
We are facing issue with resetting the FIFO contents. When we try to capture data multiple times, We found that, the data in FIFO was not getting updated. Please find the attached Text files 1_Data.txt and 2_DATA.txt. You can see that, data in the data FIFO is the same in both iterations.
Hence, We tried to reset the FIFO based on the steps mentioned in the Startup sequence section.
We have written a application code, to perform read operation for 4 times in a loop. After each read operation, The FIFO is reset and when read operation is performed again in loop the FIFO is resetting properly and new data is getting updated in the FIFO.
However, If We reset the board and then perform the read operation, We are observing the Previously captured data (that was observed before resetting board) is read in the data registers.
Request you to let us know if you see any mistake we are doing.
Please find the snippet below containing data that is read and register settings we are using to clear the FIFO after each read. We have followed the steps provided in startup sequence to clear the FIFO.
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.
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
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.
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 Glen,
Yes, We have set the register 0x10 to 0x0002 after the configuration is loaded. Although, We have done this, the LEDs are not glowing. I have measured the 3V, 1.8V supplies, They are fine.
Can you share the sample data that is expected when We load the suggested configuration both in open condition and when finger is placed over the device.
What is the maximum value of pulse width that we can set..?