Post Go back to editing

AD5940 (ADICUP3029): Synchronized ECG + ICG (BIA) at 512 Hz Hangs After Initialization

Category: Hardware
Product Number: AD5940

Hello ADI Community,

I am developing a combined, synchronized Electrocardiogram (ECG) and Impedance Cardiography (ICG / BIA) application using the EVAL-ADICUP3029 paired with the AD5940 BioZ shield. I am using Keil µVision and the standard AD5940 firmware library (v0.2.1).

My Goal: To achieve a simultaneous ECG and single-frequency (50 kHz) BIA measurement at a 512 Hz Output Data Rate. Because the AD5940 has a single ADC, my strategy is to interleave the measurements using the sequencers:

  1. The Wake-Up Timer (WUPT) runs at 512 Hz and wakes up Sequencer 0 (ECG).

  2. Sequencer 0 configures the ADC for SINC3, takes the ECG measurement, pushes it to the FIFO, and then uses a register write (SEQ_WR) to instantly trigger Sequencer 1 (BIA).

  3. Sequencer 1 configures the switches/DFT, takes the ICG measurement, pushes it to the FIFO, and goes to sleep.

The Issue: The code compiles flawlessly and the SPI communication is verified (the board prints the correct silicon version and library info). However, immediately after starting the applications, the stream stops. No data is ever printed, and polling the FIFO count (AD5940_FIFOGetCnt()) always returns 0.

Here is my terminal output before it hangs:

Plaintext
==================================
ADICUP3029 BOOT SUCCESSFUL!
Mode: Synchronized ECG + ICG
==================================
This AD594x!
Note: Current Silicon is S2
AD5940LIB Version:v0.2.1
Configuring ECG Sequencer...
Configuring BIA Sequencer...
Starting Synchronized Measurements!

Key Setup Details:

1. FIFO Configuration (Routing both sources):

C
  fifo_cfg.FIFOEn = bFALSE;
  fifo_cfg.FIFOMode = FIFOMODE_FIFO;
  fifo_cfg.FIFOSize = FIFOSIZE_4KB;                       
  fifo_cfg.FIFOSrc = FIFOSRC_DFT | FIFOSRC_SINC3; /* Both sources */
  fifo_cfg.FIFOThresh = 8; 
  AD5940_FIFOCfg(&fifo_cfg);                             
  fifo_cfg.FIFOEn = bTRUE;  
  AD5940_FIFOCfg(&fifo_cfg);

2. WUPT Master Timer (Triggering ECG only):

C
  wupt_cfg.WuptEn = bTRUE;
  wupt_cfg.WuptEndSeq = WUPTENDSEQ_A;
  wupt_cfg.WuptOrder[0] = SEQID_0; /* Wake up ECG first */
  wupt_cfg.SeqxSleepTime[SEQID_0] = (uint32_t)(32000.0 / 512.0) - 2 - 1;
  wupt_cfg.SeqxWakeupTime[SEQID_0] = 1; 
  AD5940_WUPTCfg(&wupt_cfg);

3. The Baton Pass (End of ECG Sequence 0):

C
  /* Disable ADC block to prepare for BIA */
  AD5940_AFECtrlS(AFECTRL_ADCCNV|AFECTRL_ADCPWR, bFALSE);  
  
  /* Hardware Trigger Sequence 1 (BIA) */
  AD5940_SEQGenInsert(SEQ_WR(0x00002064, 2)); /* Write to REG_AFE_SEQTRG */

  /* Put Sequencer 0 to sleep */
  AD5940_EnterSleepS();

My Questions:

  1. Is writing 2 to REG_AFE_SEQTRG (0x00002064) the correct and reliable way to chain Sequencer 0 to Sequencer 1 within the sequence generator?

  2. When rapidly switching the ADC between SINC3 (for ECG) and DFT (for BIA) at 512 Hz, are there specific ADC/Filter reset or settling commands I must include in the sequences to prevent the ADC from locking up?

  3. Can the FIFO safely handle FIFOSRC_DFT | FIFOSRC_SINC3 multiplexing without halting, or does this mixed-data configuration require a specific word-alignment strategy?

Any insight into why the sequencers are failing to cycle or push data into the FIFO would be massively appreciated! Thank you.

  • Hi  ,

    I will contact the product owner and get back to you.

    Thanks,

    Francis

  • Hi,

    1) 0x00002064 address points to SEQCNT register, not trigger register. 
    If you have defined BIA measurement sequence (AppBIASeqMeasureGen) as SEQID_0 and AppECGSeqMeasureGen as SEQID_1,

      you may refer to squarewave voltammetry example to see how to switch between multiple sequences (wakeup timer config pasted below):

    /* Start it */
    wupt_cfg.WuptEn = bTRUE;
    wupt_cfg.WuptEndSeq = WUPTENDSEQ_D;
    wupt_cfg.WuptOrder[0] = SEQID_0;
    wupt_cfg.WuptOrder[1] = SEQID_2;
    wupt_cfg.WuptOrder[2] = SEQID_1;
    wupt_cfg.WuptOrder[3] = SEQID_2;
    wupt_cfg.SeqxSleepTime[SEQID_2] = 1;
    wupt_cfg.SeqxWakeupTime[SEQID_2] = (uint32_t)(AppSWVCfg.LFOSCClkFreq*AppSWVCfg.SampleDelay/1000.0f) - 1;
    wupt_cfg.SeqxSleepTime[SEQID_0] = 1;
    wupt_cfg.SeqxWakeupTime[SEQID_0] = (uint32_t)(AppSWVCfg.LFOSCClkFreq*((1/AppSWVCfg.Frequency*500) - AppSWVCfg.SampleDelay)/1000.0f) - 4;
    wupt_cfg.SeqxSleepTime[SEQID_1] = wupt_cfg.SeqxSleepTime[SEQID_0];
    wupt_cfg.SeqxWakeupTime[SEQID_1] = wupt_cfg.SeqxWakeupTime[SEQID_0];

    AD5940_WUPTCfg(&wupt_cfg);

    2) Since after each measurement,

    - ADC is turned off, device is put to sleep,

    - then after sequence is triggered, ADC is turned ON and conversion starts,

    ADC does not get locked up.

    3) FIFO can be configured with only one source at a time. FIFO reconfiguration is usually done in initialization sequence, which need to be called each time the fifo source is changed:

    AD5940_FIFOCtrlS(FIFOSRC_SINC3, bFALSE); /* Disable FIFO firstly */
    AD5940_FIFOThrshSet(AppECGCfg.FifoThresh);
    AD5940_FIFOCtrlS(FIFOSRC_DFT, bTRUE);