Post Go back to editing

AD5940: Wakeup and Sleep Timer Setup

Category: Software
Product Number: AD5940
Software Version: v0.2.1

I am trying to understand the purpose of some hardcoded numbers in the example code. I see similar lines of code in Amperometric.c, ChronoAmperometric.c, Electrocardiograph.c, Impedance.c, etc...   Specifically, I am curious about these two lines of code:

      1. wupt_cfg.SeqxSleepTime[SEQID_0] = 4-1;
      2. wupt_cfg.SeqxWakeupTime[SEQID_0] = (uint32_t)(AppAMPCfg.WuptClkFreq*AppAMPCfg.AmpODR)-4-1;
The recommended operation on Page 107 (Rev D datasheet) is to disable to sleep timer and use the sequencer to put the device in sleep mode at the of the sequence.  If we are not using the Sleep timer, the:
Q1:  Is Line#1 even necessary?  
Q2:  If not, do we need the "-4-1" in Line#2?
Q3:  Is the "-1" due to the hardware operation?  In other words, does the timer trigger an action at the end of the 0 count?
I also see a "-2" in places instead of the "-1" (see SqrWaveVoltammetery.c) and code comments in other files that say "The minimum is 1.  Do not set it to zero...."
Q4:  Why a "-2" in places?  Is there a minimum?  Please explain the origin of these numbers, any minimum setting that should be used.
Thank you


Added the product number to the subjetc field
[edited by: JEstayo at 2:08 AM (GMT -5) on 22 Feb 2024]
Parents
  • Hi,

    Q1.

    The lines 1 and 2 are point 5 of the recommended operation on Page 107 (Rev D datasheet).

    If there is a requirement to

    - run the measurement using sequences,

    - trigger measurement sequences by wakeup timer and

    - save power by putting the device to sleep when not measuring, 

    then these lines above are necessary.

    Q2.

    Minimum value allowed for wupt_cfg.SeqxSleepTime[SEQID_0] is "1".

    Since output data rate is set by AmpODR,

    these values are set such that 

    wupt_cfg.SeqxWakeupTime[SEQID_0] + wupt_cfg.SeqxSleepTime[SEQID_0] = (AppIMPCfg.WuptClkFreq/AppIMPCfg.ImpODR)

    Hence, if SeqxSleepTime is set to 4,

    then SeqxWakeupTime is set to  "(AppIMPCfg.WuptClkFreq/AppIMPCfg.ImpODR) - 4 "

    "4-1" etc found in code are values set for specific applications after trial runs.

  • Thank you for answering jjd's question. As a follow-up, is it possible to keep the sequencer from returning to sleep? I'm doing BIA measurements with the AD5940 BIA example code and would like the waveform generator to remain on continuously.  I tried setting SEQSLPEN and TMRSLPEN to 0 in the AD5940_Initialize routine but that didn't seem to work.

Reply
  • Thank you for answering jjd's question. As a follow-up, is it possible to keep the sequencer from returning to sleep? I'm doing BIA measurements with the AD5940 BIA example code and would like the waveform generator to remain on continuously.  I tried setting SEQSLPEN and TMRSLPEN to 0 in the AD5940_Initialize routine but that didn't seem to work.

Children