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
  • 01. Yes, you need line#1. The sleep timer isn't disabled, rather it's the function that puts the device to sleep when the sleep timer elapses that is disabled. After much searching I believe the disable is hard coded in this register/data pair {0x0a00, 0x8009} in the AD5940_Initialize routine. Set this way, the device will go to sleep at the end of the sequence execution.

    03. I think you're right about the -1 and zero count, A value of 3 will give 4 clock cycles, 3,2,1,0

    Note that there's an error in the second line of code. The clock frequency should be divided by the data rate. For example, if you want to measure 2 times per second the value loaded into the timer needs to be half as large. 

    wupt_cfg.SeqxWakeupTime[SEQID_0= (uint32_t)(AppAMPCfg.WuptClkFreq/AppAMPCfg.AmpODR)-4-1;

    And not to hijack the thread, but I landed here after spending the better part of the day yesterday trying to prevent the device from going to sleep so that the waveform generator stays on continuously. I'd appreciate it if the AD rep could comment on this, too. 

Reply
  • 01. Yes, you need line#1. The sleep timer isn't disabled, rather it's the function that puts the device to sleep when the sleep timer elapses that is disabled. After much searching I believe the disable is hard coded in this register/data pair {0x0a00, 0x8009} in the AD5940_Initialize routine. Set this way, the device will go to sleep at the end of the sequence execution.

    03. I think you're right about the -1 and zero count, A value of 3 will give 4 clock cycles, 3,2,1,0

    Note that there's an error in the second line of code. The clock frequency should be divided by the data rate. For example, if you want to measure 2 times per second the value loaded into the timer needs to be half as large. 

    wupt_cfg.SeqxWakeupTime[SEQID_0= (uint32_t)(AppAMPCfg.WuptClkFreq/AppAMPCfg.AmpODR)-4-1;

    And not to hijack the thread, but I landed here after spending the better part of the day yesterday trying to prevent the device from going to sleep so that the waveform generator stays on continuously. I'd appreciate it if the AD rep could comment on this, too. 

Children
No Data