Post Go back to editing

AD5941 Sequencer

Category: Software

Hello, there is a question confusing me.

So can I configure fifo and sequencer settings in a sequence, as the datasheet mentions that the register address must be between 0x00000000 and 0x000021fc?

When I configured fifo to change its source, the entire program was stuck.

  • Hi,

    FIFO and sequencer settings cannot be configured inside a sequencer.

  • I was able to set the FIFO source within a sequence.  I modified the AD5940 Amperometric example to measure mean with one sequence and variance with another. 

    /* Start sequence generator here for mean */
      AD5940_SEQGenCtrl(bTRUE); 
      AD5940_FIFOCtrlS(FIFOSRC_MEAN, bTRUE);  /* set source as mean */
      AD5940_SEQGpioCtrlS(AGPIO_Pin2);   /* sets this pin high ahead of conversion, others pulled low */
      AD5940_AFECtrlS(AFECTRL_ADCPWR|AFECTRL_SINC2NOTCH, bTRUE);
      AD5940_SEQGenInsert(SEQ_WAIT(16*250));    /* wait 250us */
      AD5940_AFECtrlS(AFECTRL_ADCCNV, bTRUE);   /* Start ADC convert*/
      AD5940_SEQGenInsert(SEQ_WAIT(WaitClks));  /* wait for first data ready */
      AD5940_AFECtrlS(AFECTRL_ADCPWR|AFECTRL_ADCCNV|AFECTRL_SINC2NOTCH, bFALSE);  /* Stop ADC */
      AD5940_SEQGpioCtrlS(0);    /* resets AGPIO_Pin2 following conversion */
      AD5940_EnterSleepS();/* Goto hibernate */
      /* Sequence end. */
      error = AD5940_SEQGenFetchSeq(&pSeqCmd, &SeqLen);
      AD5940_SEQGenCtrl(bFALSE); /* Stop sequencer generator */

  • Yes, I have tried and found it's able to change the fifo source. How about disable fifo first and enable it later to clear fifo.

  • Hi,

    Data and command FIFO need to be configured outside sequence to avoid racing condition.

    FIFOCfg_Type fifo_cfg;

    fifo_cfg.FIFOEn = bFALSE;
    fifo_cfg.FIFOMode = FIFOMODE_FIFO;
    fifo_cfg.FIFOSize = FIFOSIZE_4KB; /* 4kB for FIFO, The reset 2kB for sequencer */
    fifo_cfg.FIFOSrc = FIFOSRC_DFT;
    fifo_cfg.FIFOThresh = 4;
    AD5940_FIFOCfg(&fifo_cfg); /* Disable to reset FIFO. */
    fifo_cfg.FIFOEn = bTRUE;
    AD5940_FIFOCfg(&fifo_cfg);