Hello,
I am using the AFE4404 for a home/medical device that needs to measure SpO2 and Heatrate. I am not using a development board for this specific AFE, I am using my own board. (I did some tests with the development board corresponding to one of the similar devices that communicates over SPI, no problem with that)
I am having an issue in relation to the offset cancelation DAC in the AFE4404. I am doing this::
1. I configure the timing registers. I configure them as they are configured by default in the firmware corresponding to the development board of the AFE4404.
Note: I changed the TIA gain in this configuration from 50K to 250K
2. I detach the photo diode by configuring the corresponding register
3. I enable a specific current only for one of the 4 phases at a time, and print the values I get from the ADC for LED1, LED2, LED3 and AMBIENT1
The problem is that, when I inject a current to LED1, LED1 or LED3, i only see a "nonzero" value for that corresponding led, all OK so far. BUT if I inject a current to the AMB1 phase, I see an interference in the other phases. Its like the TIA is adding an offset to all the phases. This interference value gets smaller if I increase the TIA bandwith (reduce Cf).
=> I attach the init code of the AFE registers.
#define PWRCNTRL 0x23
#define INT_OSC_ENABLE (1<<9)
#define I_50MA (0<<17) // LEd current range is 0 - 50 mA
#define I_100MA (1<<17) // LEd current range is 0 - 100 mA
#define PDCNTRL 0x31
#define PD_DISCONNECT (1<<10) // Disconnect PD
#define PD_CONNECT (0<<10) // Connect PD
#define DACOFFSET 0x3A
#define DAC_OFF (0)
#define LED3_INVERT_I (1<<4) // Invert led 3 current
#define LED3_I_OFFSET (0) // Led 3 current value offset
#define LED2_INVERT_I (1<<19) // Invert led 2 current
#define LED2_I_OFFSET (15) // Led 2 current value offset
#define LED1_INVERT_I (1<<9) // Invert led 1 current
#define LED1_I_OFFSET (5) // Led 1 current value offset
#define AMB1_INVERT_I (1<<14) // Invert amb1 current
#define AMB1_I_OFFSET (10) // Amb1 current value
// --------------------------------------------------------
AFE_readEnable( false );
// -------------------------------------------------------
AFE_writeRegister(1, 100); //AFE_LED2STC
AFE_writeRegister(2, 399); //AFE_LED2ENDC
AFE_writeRegister(3, 802); //AFE_LED1LEDSTC
AFE_writeRegister(4, 1201); //AFE_LED1LEDENDC
AFE_writeRegister(5, 501); //AFE_ALED2STC
AFE_writeRegister(6, 800); //AFE_ALED2ENDC
AFE_writeRegister(7, 902); //AFE_LED1STC
AFE_writeRegister(8, 1201); //AFE_LED1ENDC
AFE_writeRegister(9, 0); //AFE_LED2LEDSTC
AFE_writeRegister(10, 399); //AFE_LED2LEDENDC
AFE_writeRegister(11, 1303); //AFE_ALED1STC
AFE_writeRegister(12, 1602); //AFE_ALED1ENDC
AFE_writeRegister(13, 409); //AFE_LED2CONVST
AFE_writeRegister(14, 1468); //AFE_LED2CONVEND
AFE_writeRegister(15, 1478); //AFE_ALED2CONVST
AFE_writeRegister(16, 2537); //AFE_ALED2CONVEND
AFE_writeRegister(17, 2547); //AFE_LED1CONVST
AFE_writeRegister(18, 3606); //AFE_LED1CONVEND
AFE_writeRegister(19, 3616); //AFE_ALED1CONVST
AFE_writeRegister(20, 4675); //AFE_ALED1CONVEND
AFE_writeRegister(21, 401); //AFE_ADCRSTSTCT0
AFE_writeRegister(22, 407); //AFE_ADCRSTENDCT0
AFE_writeRegister(23, 1470); //AFE_ADCRSTSTCT1
AFE_writeRegister(24, 1476); //AFE_ADCRSTENDCT1
AFE_writeRegister(25, 2539); //AFE_ADCRSTSTCT2
AFE_writeRegister(26, 2545); //AFE_ADCRSTENDCT2
AFE_writeRegister(27, 3608); //AFE_ADCRSTSTCT3
AFE_writeRegister(28, 3614); //AFE_ADCRSTENDCT3
AFE_writeRegister(54, 401); //AFE_LED3LEDSTC
AFE_writeRegister(55, 800); //AFE_LED3LEDENDC
AFE_writeRegister(29, 39999); //AFE_PRPCOUNT
AFE_writeRegister(30, 0x000103); //AFE_CONTROL1 TimerEN = 1; NUMAV = 3
//AFE_writeRegister(32, 0x008003); //AFE_TIA_SEP_GAIN (LED2) ENSEPGAIN = 1; LED2/LED3 gain = 50K // 0x20
//AFE_writeRegister(33, 0x000003); //AFE_TIA_GAIN (LED1) LED1/LED1AMB gain = 50K
AFE_writeRegister(32, 0x008001); //AFE_TIA_SEP_GAIN (LED2) ENSEPGAIN = 1; LED2/LED3 gain = 250K // 0x20
AFE_writeRegister(33, 0x000001); //AFE_TIA_GAIN (LED1) LED1/LED1AMB gain = 250K
AFE_writeRegister(58, 0x000000); //AFE_DAC_SETTING_REG
AFE_writeRegister(34, 0x0030CF); //LED3 - 3.125mA; LED2 - 3.125mA; LED1 - 12.5mA
AFE_writeRegister(35, 0x124018); //DYN1, LEDCurr, DYN2, Ext CLK, DYN3, DYN4 //0x000200); - 0x200 Osc mode //AFE_CONTROL2
AFE_writeRegister(49, 0x000020); //ENABLE_INPUT_SHORT
AFE_writeRegister(57, 0); //CLKDIV_PRF
AFE_writeRegister(50, 5475); //AFE_DPD1STC
AFE_writeRegister(51, 39199); //AFE_DPD1ENDC
// -----------------------------------------------------
AFE_writeRegister( PWRCNTRL, INT_OSC_ENABLE | I_50MA ); // Enable internal 4Mhz oscilator
AFE_writeRegister( PDCNTRL, PD_DISCONNECT ); // Disconnect photo
//AFE_writeRegister( DACOFFSET, (2<<LED1_I_OFFSET) );
//AFE_writeRegister( DACOFFSET, (2<<LED2_I_OFFSET) );
//AFE_writeRegister( DACOFFSET, (2<<LED3_I_OFFSET) );
AFE_writeRegister( DACOFFSET, (2<<AMB1_I_OFFSET) );
// ----------------------------------------------------
AFE_readEnable( true );
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
The values read out for the different cases are:
Case 1: Current for led 1 set to 0.93uA (value 2 for that filed in the corresponding register), 0 current for all other phases
Led1;Led2:Led3;Ambient1: 755119;-298;-316;-324
Case 2: Current for led 2 set to 0.93uA (value 2 for that filed in the corresponding register), 0 current for all other phases
Led1;Led2:Led3;Ambient1: -315;755644;-339;-379
Case 3: Current for led 3 set to 0.93uA (value 2 for that filed inthe corresponding register), 0 current for all other phases
Led1;Led2:Led3;Ambient1: -356;-244;755158;-331
Case 4: Current for ambient 1 set to 0.93uA (value 2 for that filed inthe corresponding register), 0 for all other phases
Led1;Led2:Led3;Ambient1: 6529;6379;6542;756896
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
On the other hand I am having another issue that is probably related. In normal operation mode, If I attach the photo diode, I get interference in the ambient phases from the LED phases.
That is, in AMB1 phase I get a signal related to the intensity of LED1, same for AMB2 phase and LED2. The interferences gets smaller as I separate in time the 4 phases. I this some math and the rise time of the TIA looks fine...
Hope you can help me, thanks in advance,
Alejandro