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.

CCS/AFE4400: AFE4400 registers and ambient cancellation

Part Number: AFE4400
Other Parts Discussed in Thread: AFE4404, , AFE4490, AFE4403

Tool/software: Code Composer Studio

Hello Praveen,

I am using the AFE4400 for HRM application. In my application I need a value of 100 for PRF and a current pulse duration for the LED of 100 us. I have checked your AFE4400 / AFE4490 / AFE4403 / AFE4404 FAQs document and it's really well explained. But I have some questions.

1) I have checked the registers of afe4400 in the datasheet and I was really confused about all the registers in table 2 (p31). I mean there is too much registers to configure for the two features that I need which are PRF=100 and pulse width of 100 us. I tried to understand how it works with fig 42 and 43 but I still don't understand and know how to configure the registers of table 2 to get 100 Hz PRF and 100 us pulse width. I mean there is start and end of sample, start and end of pulse ... and I am lost with all these registers. 

2) Also there is a register for LED1 data, another for ambient data and another for LED1-ambient. Then what is the utility to use for example both LED1 data and LED1-ambient. I mean LED1 data are the pleth signal without the ambient data (right?), so it's these are the same data as the LED1-ambient, no ? I mean I can't see the difference between them and which one should be read for HRM application.

And is it necessary to use the current cancellation since we already have a register that contains LED data without the ambient ? I am sorry there is a lot of information that's why i am really confused.

3) Finally how to choose the gain of the amplifier and if we have to use current  cancellation, how to determine the current since we don't know the voltage of the pleth dc component and so the voltage we have to cancel ? 

Thank you very much,

Regards, 

Mike

  • Could someone help please ?

    Thank you.

  • Hi Mike,

    I suggest you to use the AFE4400EVM's GUI to get the register settings for the given configuration. Using the GUI you can configure the timing registers just by entering required PRF and the LED ON time. Similarly you can use the high level controls of the GUI to configure AFE parameters such as TIA gain and LED current. Once you configure the AFE, you can save the register setting so than you can port it to your own MCU.

    The AFE output corresponding to LED phase contains the signal due to LED as well as ambient signal, whereas ambient phase contains information only due to ambient light. So to cancel the ambient signal from the LED phase, we recommend to use LED-AMB phase as it digitally subtracts the ambient signal from the LED phase. This also helps to suppress the modulation of PPG signal due to ambient signal.

    In-case you happens to have a huge ambient signal, you can cancel the significant amount of ambient light using the internal offset cancellation DAC so that you can fully utilize the full dynamic range of the ADC.

    Hope this helps.

    Regards,

    Prabin. 

  • Hi Prabin,

    Thank you for your answer. 

    I have question about the TIA_AMB_GAIN register. How to know the gain to set for stage 2 since we don't know in advance the voltage at the output of the TIA. 

    1) Also, in the datasheet we have Rf * Cf < Rx Sample time /10 . Does the Rx sample time corresponds to the current pulse width ? If we want pulse width = 100 us, this then means that Rf*Cf should be smaller than 100us/10 = 10us = 1e-5 ? 

    "I suggest you to use the AFE4400EVM's GUI to get the register settings for the given configuration. Using the GUI you can configure the timing registers just by entering required PRF and the LED ON time. Similarly you can use the high level controls of the GUI to configure AFE parameters such as TIA gain and LED current. Once you configure the AFE, you can save the register setting so than you can port it to your own MCU". 

    2) I have checked this code and in the afe4400.h file there is a configuration for PRF = 100 but I didn't really understand how these values were set. For example there is  :

    #define LED2STC_VAL     ((((PRP+1)*3)/4)+80)       // for 100HZ - 30080

    #define LED2ENDC_VAL    (LED2STC_VAL-80+DELTA-2)        // for 100HZ - 37998

    I mean I didn't understand the formulas used and where it comes from and why it talks about a value of 30080 and 37998. I would appreciate some help. 

    Thank you very much,

    Regards,

    Mike

  • Hi Mike,

        You don't really need to know the output of AFE4400 in advance. You can monitor the output and increase or decrease the gain accordingly.

    1) Also, in the datasheet we have Rf * Cf < Rx Sample time /10 . Does the Rx sample time corresponds to the current pulse width ? If we want pulse width = 100 us, this then means that Rf*Cf should be smaller than 100us/10 = 10us = 1e-5 ?  Yes

    2) In AFE4400 the whole PRP is divided into 4 phases and each of them is associated with a LED. Now, as shown above, LED2 is configured to be ON on 4th phase, that is why the LED2STC_VAL starts at 3/4th of the PRPCNT (+ some margin, 80 counts).  For example if your PEF is 100Hz then your PRPCNT is (4e6/100)-1= 39999, so the LED2STC_VAL = ((((PRP+1)*3)/4)+80) = ((((39999+1)*3)/4)+80) = 30080.

    Similarly you can find the other parameters count value. You can refer Figure 42 and Table 2 in the datasheet.

    Regards,

    Midhun Raveendran

  • Hi Midhun,

    Thank you for your answer.

    1) "In AFE4400 the whole PRP is divided into 4 phases and each of them is associated with a LED. Now, as shown above, LED2 is configured to be ON on 4th phase, that is why the LED2STC_VAL starts at 3/4th of the PRPCNT (+ some margin, 80 counts).  For example if your PEF is 100Hz then your PRPCNT is (4e6/100)-1= 39999, so the LED2STC_VAL = ((((PRP+1)*3)/4)+80) = ((((39999+1)*3)/4)+80) = 30080."

    It's clearer now. But you said that there are 4 phases and each of them is associated with a led. Then how to deal with the fact that we are using just one led since we want heart rate application ? I mean should we still divide by 4 and configure all the registers or just the registers for one LED ? 

    2) Also I don't really understand how DELTA           (((PRP+1)*DUTYCYCLE)/100) is calculated and what it corresponds to. Moreover, the current pulse width depends on DELTA value ? I mean in which register should we indicate that we need 100 us pulse width ? 

    Thank you,

    Regards,

    Mike

  •  and Hi Mike,

    Here are few answers.

    1) In AFE4400, the pulse repetition period (i.e. PRP) needs to be divided into 4 phases ( typically 2 LEDs and 2 Ambient). LED Phase can also be used to AMB phase by settings its LED current to be 0. In your application (i.e. heart rate monitoring), you can set the LED current of one LED to 0, so that you will have one phase as LED phase and remaining 3 phases as AMB phases. In any case you need to define timings for 4 phase and since each phase have its own output registers, you can choose to read only the required phase.

    2) There is no hard and fast rule on choosing DELTA, its just a margin added and can be changed. To achieve, LED On time of 100uS, you need to program the start and end counts for a given LED. 100uS translates to 100uS/0.25uS = 400 clocks, for AFE clock of 4MHz . So you can program the LED timings as.

    • LED Start count = 0 and LED End Count = 399    or,
    • LED Start count = 10 and LED End Count = 409   or,
    • LED Start count = 50 and LED End Count = 499   etc

    Please refer to  Figure 42 and Table 2 of datasheet for further reference.

    Regards,

    Prabin.

  • Hi Prabin,

    I will read carefully your answers and check again the datasheet and will come back for further questions if necessary.

    Thank you,

    Regards,

    Mike