6 years, 5 months ago.

MAX30003 ECG Recording

Hi,

I'm trying to read raw ECG data from the MAX30003.

After writing to the appropriate configuration registers I write to the SYNCH register, expecting the ECG FIFO to start filling with data. Upon reading the FIFO I am receiving ETAG 110 (FIFO Empty) for every sample. It appears as if the ECG is never triggered but I am not sure why.

Here is my configuration:

ECG configuration settings

ecgAFE.writeRegister( MAX30003::SW_RST , 0);
    
    
    // General config register setting
    MAX30003::GeneralConfiguration_u CNFG_GEN_r;
    CNFG_GEN_r.bits.fmstr = 0b00;     // Set FMSTR to 32768 Hz
    CNFG_GEN_r.bits.en_ecg = 0b1;     // Enable ECG channel
    CNFG_GEN_r.bits.rbiasn = 0b0;     // Enable resistive bias on negative input
    CNFG_GEN_r.bits.rbiasp = 0b0;     // Enable resistive bias on positive input
    CNFG_GEN_r.bits.en_rbias = 0b00;   // Enable resistive bias
    CNFG_GEN_r.bits.imag = 0b000;       // Current magnitude = 10nA
    CNFG_GEN_r.bits.en_dcloff = 0b00;  // Enable DC lead-off detection   
    ecgAFE.writeRegister( MAX30003::CNFG_GEN , CNFG_GEN_r.all);
        
    
    // ECG Config register setting
    MAX30003::ECGConfiguration_u CNFG_ECG_r;
    CNFG_ECG_r.bits.dlpf = 0b00;       // Digital LPF cutoff = 40Hz
    CNFG_ECG_r.bits.dhpf = 0b0;       // Digital HPF cutoff = 0.5Hz
    CNFG_ECG_r.bits.gain = 0b00;       // ECG gain = 160V/V
    CNFG_ECG_r.bits.rate = 0b10;       // Sample rate = 128 sps
    ecgAFE.writeRegister( MAX30003::CNFG_ECG , CNFG_ECG_r.all);
      
    
    //R-to-R configuration
    MAX30003::RtoR1Configuration_u CNFG_RTOR_r;
    CNFG_RTOR_r.bits.en_rtor = 0b0;           // Enable R-to-R detection
    ecgAFE.writeRegister( MAX30003::CNFG_RTOR1 , CNFG_RTOR_r.all);
       
        
    //Manage interrupts register setting
    MAX30003::ManageInterrupts_u MNG_INT_r;
    MNG_INT_r.bits.efit = 0b00011;          // Assert EINT w/ 4 unread samples
    MNG_INT_r.bits.clr_rrint = 0b01;        // Clear R-to-R on RTOR reg. read back
    ecgAFE.writeRegister( MAX30003::MNGR_INT , MNG_INT_r.all);
    
    
    //Enable interrupts register setting
    MAX30003::EnableInterrupts_u EN_INT_r;
    EN_INT_r.all = 0b0;
    EN_INT_r.bits.en_eint = 0b1;              // Enable EINT interrupt
    EN_INT_r.bits.en_rrint = 0b0;             // Disable R-to-R interrupt
    EN_INT_r.bits.intb_type = 0b11;            // Open-drain NMOS with internal pullup
    ecgAFE.writeRegister( MAX30003::EN_INT , EN_INT_r.all);
       
       
    //Dynamic modes config
    MAX30003::ManageDynamicModes_u MNG_DYN_r;
    MNG_DYN_r.bits.fast = 0b0;                // Fast recovery mode disabled
    ecgAFE.writeRegister( MAX30003::MNGR_DYN , MNG_DYN_r.all);
    
    // MUX Config
    MAX30003::MuxConfiguration_u CNFG_MUX_r;
    CNFG_MUX_r.bits.openn = 0b0;          // Connect ECGN to AFE channel
    CNFG_MUX_r.bits.openp = 0b0;          // Connect ECGP to AFE channel
    ecgAFE.writeRegister( MAX30003::CNFG_EMUX , CNFG_MUX_r.all);

As soon as this is complete, as previously mentioned, I write to the SYNCH register and then begin reading samples every 7.8125ms. Also, it should be noted, that the unread records interrupt never triggers, also leading me to believe that ECG has not started recording.

Any help would be appreciated, thanks. Adam

Question relating to:

MAXREFDES100# Health Sensor Platform

1 Answer

6 years, 5 months ago.

Hello Adam,

Some of your comments don't seem to match your configurations. Have you taken a look at these programs?

https://os.mbed.com/teams/Maxim-Integrated/code/MAX30003WING_Demo_Debug/

https://os.mbed.com/teams/Maxim-Integrated/code/MAX30003WING_Demo_QRS/

Their main.cpp files have a configuration function that have comments throughout that you can check to see if your own configuration is what you intended. Hope this helps!

-Karen, team Mbed

PS: To make your program easily visible, you can sandwich the block of code between <<code>> and <</code>> . Otherwise it might get messed up due to formatting!

If this solved your question, please make sure to click the "Thanks" link below!

Hi Karen,

Thanks for taking the time to answer. I've excluded some code, such as the writing to SYNCH. Which lines do you think specifically do not match up?

Regardless of this, I actually managed to get the data to stream using an external FCLK which is suitable for my purposes at this point in time.

Thanks! Adam

posted by Adam Mitchell 26 Jun 2018

Hi Adam,

I'm glad it's working out alright! Looking at a snippet of code from the MAX30003WING_Demo_Debug:

    // General config register setting
    MAX30003::GeneralConfiguration_u CNFG_GEN_r;
    CNFG_GEN_r.bits.en_ecg = 1;     // Enable ECG channel
    CNFG_GEN_r.bits.rbiasn = 1;     // Enable resistive bias on negative input
    CNFG_GEN_r.bits.rbiasp = 1;     // Enable resistive bias on positive input
    CNFG_GEN_r.bits.en_rbias = 1;   // Enable resistive bias
    CNFG_GEN_r.bits.imag = 2;       // Current magnitude = 10nA
    CNFG_GEN_r.bits.en_dcloff = 1;  // Enable DC lead-off detection   
    ecgAFE.writeRegister( MAX30003::CNFG_GEN , CNFG_GEN_r.all);
        
    
    // ECG Config register setting
    MAX30003::ECGConfiguration_u CNFG_ECG_r;
    CNFG_ECG_r.bits.dlpf = 1;       // Digital LPF cutoff = 40Hz
    CNFG_ECG_r.bits.dhpf = 1;       // Digital HPF cutoff = 0.5Hz
    CNFG_ECG_r.bits.gain = 3;       // ECG gain = 160V/V
    CNFG_ECG_r.bits.rate = 2;       // Sample rate = 128 sps
    ecgAFE.writeRegister( MAX30003::CNFG_ECG , CNFG_ECG_r.all);
      
       

The code comments seem to match your comments, but they have differing code. I myself have not used this board before, so I wasn't sure if that is what you intended.

-Karen, team Mbed

posted by Karen Yen 26 Jun 2018