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 in one LED Mode

Other Parts Discussed in Thread: AFE4404

Hello,

I use the AFE4404 to read the heartrate at wrist. I included the AFE4404 library in my project and I acquire a clean PPG signal, the library is able to calculate the HR correctly, of course when I'm static (without motion artefact).

As the timing engine of the AFE4404 is for 3 LED + 1 ambient I would like to optimize this to program it for 1 LED + 1 ambient. First I program the 2 unused LED with 0mA current (and it works)  but I would like to do better deactivating unused timing engine part of the AFE4404 of these 2 LED especially the activation, the sampling and the ADC conversion of the LED (I keep the ADCRSTx as it's mentioned p24 in order to keep the ADC_RDY pulse). The aim is to increase the PDN length of the cycle. But with this manner the ADC_RDY pulse is no more generated.


So can you check my timing engine to see if there's an error ? or maybe my manner to do is not possible...

Action : Register start (hexa) / Value (dec) ; Register end (hexa) / value(dec)

- Activate LED 2 : 0x09 / 0 ; 0x0A / 0

- Sampling LED 2 : 0x01 / 0 ; 0x02 / 0

- ADC Reset 0 : 0x15 / 0 ; 0x16 / 6

- ADC Conversion LED 2 : 0x0D / 0 ; 0x0E / 0

- Activate LED3 : 0x36 / 0 ; 0x37 / 0

- Sampling LED 3 : 0x05 / 0 ; 0x06 / 0

- ADC Reset 1 : 0x17 / 7 ; 0x18 / 13

- ADC Conversion LED 3 : 0x0F / 0 ; 0x10 / 0

- Activate LED1 : 0x03 / 14 ; 0x04 / 413

- Sampling LED 1 : 0x07 / 94 ; 0x08 / 413

- ADC Reset 2 : 0x19 / 415 ; 0x1A / 421

- ADC Conversion LED 1 : 0x11 / 422 ; 0x12 / 881

- Sampling LED amb : 0x0B / 493 ; 0x0C / 812

- ADC Reset 3 : 0x1B / 883 ; 0x1C / 889

- ADC Conversion LED amb : 0x13 / 890 ; 0x14 / 1349

- PDN Cycle : 0x32 / 2149 ; 0x33 / 39199

Best Regards,

Sam

  • Hi Sam,

    A ideal way to turn off conversions and still ensure the internal digital state machine works fine is to provide at least 1 clock cycle for the conversions.

    I have highlighted the timing changes in red below.

    Action : Register start (hexa) / Value (dec) ; Register end (hexa) / value(dec)

    - Activate LED 2 : 0x09 / 0 ; 0x0A / 0

    - Sampling LED 2 : 0x01 / 0 ; 0x02 / 0

    - ADC Reset 0 : 0x15 / 0 ; 0x16 / 6

    - ADC Conversion LED 2 : 0x0D / 7 ; 0x0E / 7

    - Activate LED3 : 0x36 / 0 ; 0x37 / 0

    - Sampling LED 3 : 0x05 / 0 ; 0x06 / 0

    - ADC Reset 1 : 0x17 / 8 ; 0x18 / 14

    - ADC Conversion LED 3 : 0x0F / 15 ; 0x10 / 15

    - Activate LED1 : 0x03 / 14 ; 0x04 / 413

    - Sampling LED 1 : 0x07 / 94 ; 0x08 / 413

    - ADC Reset 2 : 0x19 / 415 ; 0x1A / 421

    - ADC Conversion LED 1 : 0x11 / 422 ; 0x12 / 881

    - Sampling LED amb : 0x0B / 493 ; 0x0C / 812

    - ADC Reset 3 : 0x1B / 883 ; 0x1C / 889

    - ADC Conversion LED amb : 0x13 / 890 ; 0x14 / 1349

    - PDN Cycle : 0x32 / 2149 ; 0x33 / 39199

    I tested this timing and I did not see any issues.

    Please let me know if you still encounter the issue of ADC_RDY pulses not getting generated.

  • Hi,

    It works fine , thank you very much!

    Regards,

    Sam

  • Sam,

    Thanks for letting me know.
    Glad to help.
  • Hi,

    I´m also trying to use the AFE4404 in 1-LED Mode. I copied the code above which works fine but I also want to change the LED. I tried to redo the code so I can use LED 2 or LED 3 but I do not get any satisfying data. The choosen LED turns on, but it seems like I messed up the detector or ADC time. Could you have a look and help me? 

      AFE_Disable_Read();             //Beschreiben der Register ermöglichen
    
      if (befehl == 6)                //only green (LED 1)
      {
        AFE_Reg_Write(9, 0);        
        AFE_Reg_Write(1, 0);
        AFE_Reg_Write(10, 0);
        AFE_Reg_Write(2, 0);
        AFE_Reg_Write(21, 0);
        AFE_Reg_Write(22, 6);
        AFE_Reg_Write(13, 7);
        AFE_Reg_Write(14, 7);
        AFE_Reg_Write(54, 0);
        AFE_Reg_Write(55, 0);
        AFE_Reg_Write(5, 0);
        AFE_Reg_Write(6, 0);
        AFE_Reg_Write(23, 8);
        AFE_Reg_Write(24, 14);
        AFE_Reg_Write(15, 15);
        AFE_Reg_Write(16, 15);
        AFE_Reg_Write(3, 16);
        AFE_Reg_Write(4, 415);
        AFE_Reg_Write(7, 96);
        AFE_Reg_Write(8, 415);
        AFE_Reg_Write(25, 417);
        AFE_Reg_Write(26, 423);
        AFE_Reg_Write(17, 425);
        AFE_Reg_Write(18, 884);
        AFE_Reg_Write(11, 496);
        AFE_Reg_Write(12, 815);
        AFE_Reg_Write(27, 885);
        AFE_Reg_Write(28, 892);
        AFE_Reg_Write(19, 893);
        AFE_Reg_Write(20, 1352);
    
        farbe = 1;
      }else if (befehl == 7)                //only red (LED 3)
      {
        AFE_Reg_Write(9, 0);        
        AFE_Reg_Write(1, 0);
        AFE_Reg_Write(10, 0);
        AFE_Reg_Write(2, 0);
        AFE_Reg_Write(21, 0);
        AFE_Reg_Write(22, 6);
        AFE_Reg_Write(13, 7);
        AFE_Reg_Write(14, 7);
        AFE_Reg_Write(54, 8);
        AFE_Reg_Write(55, 407);
        AFE_Reg_Write(5, 87);
        AFE_Reg_Write(6, 407);
        AFE_Reg_Write(23, 408);
        AFE_Reg_Write(24, 424);
        AFE_Reg_Write(15, 426);
        AFE_Reg_Write(16, 885);
        AFE_Reg_Write(3, 0);
        AFE_Reg_Write(4, 0);
        AFE_Reg_Write(7, 0);
        AFE_Reg_Write(8, 0);
        AFE_Reg_Write(25, 886);
        AFE_Reg_Write(26, 892);
        AFE_Reg_Write(17, 893);
        AFE_Reg_Write(18, 893);
        AFE_Reg_Write(11, 0);
        AFE_Reg_Write(12, 0);
        AFE_Reg_Write(27, 894);
        AFE_Reg_Write(28, 900);
        AFE_Reg_Write(19, 0);
        AFE_Reg_Write(20, 0);
    
        farbe = 3;
      }else if (befehl == 8)                // only IR (LED 2)
      {
        AFE_Reg_Write(9, 0);        
        AFE_Reg_Write(1, 80);
        AFE_Reg_Write(10, 399);
        AFE_Reg_Write(2, 399);
        AFE_Reg_Write(21, 400);
        AFE_Reg_Write(22, 406);
        AFE_Reg_Write(13, 407);
        AFE_Reg_Write(14, 866);
        AFE_Reg_Write(54, 0);
        AFE_Reg_Write(55, 0);
        AFE_Reg_Write(5, 0);
        AFE_Reg_Write(6, 0);
        AFE_Reg_Write(23, 867);
        AFE_Reg_Write(24, 873);
        AFE_Reg_Write(15, 0);
        AFE_Reg_Write(16, 0);
        AFE_Reg_Write(3, 0);
        AFE_Reg_Write(4, 0);
        AFE_Reg_Write(7, 0);
        AFE_Reg_Write(8, 0);
        AFE_Reg_Write(25, 874);
        AFE_Reg_Write(26, 880);
        AFE_Reg_Write(17, 0);
        AFE_Reg_Write(18, 0);
        AFE_Reg_Write(11, 0);
        AFE_Reg_Write(12, 0);
        AFE_Reg_Write(27, 881);
        AFE_Reg_Write(28, 887);
        AFE_Reg_Write(19, 0);
        AFE_Reg_Write(20, 0);
    
        farbe = 2;
      }else if (befehl == 9)                //all LEDs 
      {  
        AFE_Reg_Write(1, 100);    //AFE_LED2STC
        AFE_Reg_Write(2, 399);    //AFE_LED2ENDC
        AFE_Reg_Write(3, 802);    //AFE_LED1LEDSTC
        AFE_Reg_Write(4, 1201);   //AFE_LED1LEDENDC
        AFE_Reg_Write(5, 501);    //AFE_ALED2STC
        AFE_Reg_Write(6, 800);    //AFE_ALED2ENDC
        AFE_Reg_Write(7, 902);    //AFE_LED1STC
        AFE_Reg_Write(8, 1201);   //AFE_LED1ENDC
        AFE_Reg_Write(9, 0);      //AFE_LED2LEDSTC
        AFE_Reg_Write(10, 399);   //AFE_LED2LEDENDC
        AFE_Reg_Write(11, 1303);  //AFE_ALED1STC
        AFE_Reg_Write(12, 1602);  //AFE_ALED1ENDC
        AFE_Reg_Write(13, 409);   //AFE_LED2CONVST
        AFE_Reg_Write(14, 1468);  //AFE_LED2CONVEND
        AFE_Reg_Write(15, 1478);  //AFE_ALED2CONVST
        AFE_Reg_Write(16, 2537);  //AFE_ALED2CONVEND
        AFE_Reg_Write(17, 2547);  //AFE_LED1CONVST
        AFE_Reg_Write(18, 3606);  //AFE_LED1CONVEND
        AFE_Reg_Write(19, 3616);  //AFE_ALED1CONVST
        AFE_Reg_Write(20, 4675);  //AFE_ALED1CONVEND
        AFE_Reg_Write(21, 401);   //AFE_ADCRSTSTCT0
        AFE_Reg_Write(22, 407);   //AFE_ADCRSTENDCT0
        AFE_Reg_Write(23, 1470);  //AFE_ADCRSTSTCT1
        AFE_Reg_Write(24, 1476);  //AFE_ADCRSTENDCT1
        AFE_Reg_Write(25, 2539);  //AFE_ADCRSTSTCT2
        AFE_Reg_Write(26, 2545);  //AFE_ADCRSTENDCT2
        AFE_Reg_Write(27, 3608);  //AFE_ADCRSTSTCT3
        AFE_Reg_Write(28, 3614);  //AFE_ADCRSTENDCT3
        AFE_Reg_Write(54, 401);   //AFE_LED3LEDSTC
        AFE_Reg_Write(55, 800);   //AFE_LED3LEDENDC
    
        farbe = 4;
      }
        
      // general settings
    AFE_Reg_Write(29, 39999); //AFE_PRPCOUNT AFE_Reg_Write(30, 0x000103); //Timer Engine aktivieren und NUMAV auf 4 Werte setzen AFE_Reg_Write(32, 0x008003); //TIA Einstellungen: Seperate Gain = ON, LED2/LED3 Gain = 50K AFE_Reg_Write(33, 0x000003); //TIA Einstellungen: LED1 Gain = 50K AFE_Reg_Write(58, 0x000000); //Offset Einstellungen AFE_Reg_Write(34, 0x0063C5); //Einstellen der LED Durchlassströme: Rot = 4,8 mA, Grün = 4 mA, IR = 5 mA AFE_Reg_Write(35, 0x124218); //Internen Taktgeber und Dynamic Power Down aktivieren AFE_Reg_Write(41, 0x2); //Verhindern, dass der interne Taktgeber nach außen übergeben wird AFE_Reg_Write(49, 0x000020); //PD Einstellungen AFE_Reg_Write(57, 0); //CLKDIV_PRF AFE_Reg_Write(50, 5475); //AFE Dynamic Power Down AFE_Reg_Write(51, 39199); //AFE Dynamic Power On

  • Hi Simon,

    As mentioned in the previous comments the ideal way to turn off the conversion phase is to give at-least 1 clock period. This ensures that the internal state machine works as expected. So can you please try the following setting for "befehl == 8".
    AFE_Reg_Write(9, 0);
    AFE_Reg_Write(1, 80);
    AFE_Reg_Write(10, 399);
    AFE_Reg_Write(2, 399);
    AFE_Reg_Write(21, 400);
    AFE_Reg_Write(22, 406);
    AFE_Reg_Write(13, 407);
    AFE_Reg_Write(14, 866);
    AFE_Reg_Write(54, 1);
    AFE_Reg_Write(55, 0);
    AFE_Reg_Write(5, 1);
    AFE_Reg_Write(6, 0);
    AFE_Reg_Write(23, 867);
    AFE_Reg_Write(24, 873);
    AFE_Reg_Write(15, 874);
    AFE_Reg_Write(16, 874);
    AFE_Reg_Write(3, 1);
    AFE_Reg_Write(4, 0);
    AFE_Reg_Write(7, 1);
    AFE_Reg_Write(8, 0);
    AFE_Reg_Write(25, 875);
    AFE_Reg_Write(26, 881);
    AFE_Reg_Write(17, 882);
    AFE_Reg_Write(18, 882);
    AFE_Reg_Write(11, 1);
    AFE_Reg_Write(12, 0);
    AFE_Reg_Write(27, 882);
    AFE_Reg_Write(28, 888);
    AFE_Reg_Write(19, 889);
    AFE_Reg_Write(20, 889);

    Regards,
    Prabin
  • Hi Prabin,

    Thanks for your reply. I tested your suggestions butI still only get a constant value which is different every time I start the measurement. 

    Regards,

    Simon

  • Hi Simon,

    What NUMAV are you setting? Can you try lowering it?
    Also can you change my suggestion as,

    AFE_Reg_Write(27, 883);
    AFE_Reg_Write(28, 889);
    AFE_Reg_Write(19, 890);
    AFE_Reg_Write(20, 890);

    Regards,
    Prabin