Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong FIFO config handling in ChronoAmperometry example #28

Open
YutingXu opened this issue Jun 8, 2023 · 0 comments
Open

Wrong FIFO config handling in ChronoAmperometry example #28

YutingXu opened this issue Jun 8, 2023 · 0 comments

Comments

@YutingXu
Copy link

YutingXu commented Jun 8, 2023

in function AppCHRONOAMPRegModify():

/* Reset dtat FIFO threshold for normal amp */
if(AppCHRONOAMPCfg.EndSeq)
{
    AD5940_FIFOCtrlS(FIFOSRC_SINC3, bFALSE);                                    /* Disable FIFO firstly */
    fifo_cfg.FIFOEn = bTRUE;
    fifo_cfg.FIFOMode = FIFOMODE_FIFO;
    fifo_cfg.FIFOSize = FIFOSIZE_2KB;                       /* 4kB for FIFO, The reset 2kB for sequencer */ 
    fifo_cfg.FIFOSrc = FIFOSRC_SINC2NOTCH;
    fifo_cfg.FIFOThresh = AppCHRONOAMPCfg.FifoThresh;              /* DFT result. One pair for RCAL, another for Rz. One DFT result have real part and imaginary part */
    AD5940_FIFOCfg(&fifo_cfg);

    seq_cfg.SeqEnable = bTRUE;
    AD5940_SEQCfg(&seq_cfg);  /* Enable sequencer, and wait for trigger */
    AD5940_ClrMCUIntFlag();   /* Clear interrupt flag generated before */
}

FIFO is set to be 2KB while the comments says 4KB should be set. However right after ISR function AppCHRONOAMPISR() calls AppCHRONOAMPRegModify(), AppCHRONOAMPCtrl(CHRONOAMPCTRL_START, 0); is called, which sets sequencer memory size to 2KB.

case CHRONOAMPCTRL_START:
{
...

    /* Configure FIFO and Sequencer for normal Amperometric Measurement */
    AD5940_FIFOThrshSet(AppCHRONOAMPCfg.FifoThresh);
    seq_cfg.SeqMemSize = SEQMEMSIZE_2KB;  /* 2kB SRAM is used for sequencer, others for data FIFO */ // This line!
    seq_cfg.SeqBreakEn = bFALSE;
    seq_cfg.SeqIgnoreEn = bFALSE;
    seq_cfg.SeqCntCRCClr = bTRUE;
    seq_cfg.SeqEnable = bTRUE;
    seq_cfg.SeqWrTimer = 0;
    AD5940_SEQCfg(&seq_cfg);

    /* Configure Wakeup Timer*/
...
}

This breaks the FIFO and no FIFO threshold interrupts are generated. Removing AppCHRONOAMPRegModify() in AppCHRONOAMPISR() resolves this issue.

Also, the FIFO size is already 4kb as set by the PULSETEST case in AppCHRONOAMPCtrl(), I don't see the point in manually setting it to 4kb again after measuring the transient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant