Post Go back to editing

ADuCM355 - Trigger Sequencer (or alternatively Measurement itself) with Push-Button

Category: Software
Product Number: AVAS104341
Software Version: Arm 9.30.1

Hi,

I'm running the "M355_ECSns_SingleWE" and "-_DualWE" -Examples for the ADUCM355 on the EVAL-ADUCM355QSPZ-Board.

The basic structure of these two (and all other) Application-Examples from the ADUCM355 Git is like:

After starting the program/application, and all configuration-routines finished, the sequencer runs the according measurement endlessly via the sleep- and wakeup-timer-interrupts.

This process can only be interrupted by stopping the whole program/application.

I would like to use the "M355_GPIO" -Example from the DigitalDie examples and combine it with the examples mentioned above to apply the following changes:

- At start of the program, only the configuration routines get executed but the sequencer is not started automatically.

- Instead the program should enter an "idle-state" where it does nothing.

- Pressing the push button S2 on the EVAL-Board starts the sequencer (and so the measurement).

- After this, the sequencer is running (as in the standard version of the examples) and controls the measurement and all stuff (sendig data to UART etc.)

- Pressing the push button S3 on the EVAL-Board stops the sequencer after finishing the current measurement cycle.

- After this, the program goes back in the "idle-state" and pressing S2 can start the sequencer again and so on.

Would this changes be possible with a moderate amount of effort or would it be possible to build a complete new application ?

Many Greetings

Parents
  • I will try to precise my question, in the "Amperometric.c" file there ist this function:

    AD5940Err AppAMPCtrl(int32_t AmpCtrl, void *pPara)
    {
      switch (AmpCtrl)
      {
        case AMPCTRL_START:
        {
          WUPTCfg_Type wupt_cfg;
    
          AD5940_ReadReg(REG_AFE_ADCDAT); /* Any SPI Operation can wakeup AFE */
          if(AppAmpCfg.AMPInited == bFALSE)
            return AD5940ERR_APPERROR;
          /* Start it */
          wupt_cfg.WuptEn = bTRUE;
          wupt_cfg.WuptEndSeq = WUPTENDSEQ_A;
          wupt_cfg.WuptOrder[0] = SEQID_0;
          wupt_cfg.SeqxSleepTime[SEQID_0] = 4-1;
          wupt_cfg.SeqxWakeupTime[SEQID_0] = (uint32_t)(AppAmpCfg.WuptClkFreq*AppAmpCfg.AmpODR)-4-1; 
          AD5940_WUPTCfg(&wupt_cfg);
          
          AppAmpCfg.FifoDataCount = 0;  /* restart */
          break;
        }
        case AMPCTRL_STOPNOW:
        {
          AD5940_ReadReg(REG_AFE_ADCDAT); /* Any SPI Operation can wakeup AFE */
          /* Start Wupt right now */
          AD5940_WUPTCtrl(bFALSE);
          AD5940_WUPTCtrl(bFALSE);  /* @todo is it sure this will stop Wupt? */
          break;
        }
        case AMPCTRL_STOPSYNC:
        {
          AppAmpCfg.StopRequired = bTRUE;
          break;
        }
        case AMPCTRL_SHUTDOWN:
        {
          AppAMPCtrl(AMPCTRL_STOPNOW, 0);  /* Stop the measurment if it's running. */
          /* Turn off LPloop related blocks which are not controlled automatically by sleep operation */
          AFERefCfg_Type aferef_cfg;
          LPLoopCfg_Type lp_loop;
          memset(&aferef_cfg, 0, sizeof(aferef_cfg));
          AD5940_REFCfgS(&aferef_cfg);
          memset(&lp_loop, 0, sizeof(lp_loop));
          AD5940_LPLoopCfgS(&lp_loop);
          AD5940_EnterSleepS();  /* Enter Hibernate */
        }
        break;
        default:
        break;
      }
      return AD5940ERR_OK;
    }

    In the standard application it gets called one times after initialization and before the while(1) loop with "AMPCTRL_START" Argument, to start the application.

    If i got things right to stop the application (the measurement) by a button press while staying able to restart it again at runtime (so start a new measurement without reset the program) I had to call this function again with the "AMPCTRL_STOPNOW" Argument right ?

    Could you eventually clarify what exactly is the difference between calling the function with the "AMPCTRL_STOPNOW", "AMPCTRL_STOPSYNC" and the "AMPCTRL_SHUTDOWN" argument ?

    Greetings

Reply
  • I will try to precise my question, in the "Amperometric.c" file there ist this function:

    AD5940Err AppAMPCtrl(int32_t AmpCtrl, void *pPara)
    {
      switch (AmpCtrl)
      {
        case AMPCTRL_START:
        {
          WUPTCfg_Type wupt_cfg;
    
          AD5940_ReadReg(REG_AFE_ADCDAT); /* Any SPI Operation can wakeup AFE */
          if(AppAmpCfg.AMPInited == bFALSE)
            return AD5940ERR_APPERROR;
          /* Start it */
          wupt_cfg.WuptEn = bTRUE;
          wupt_cfg.WuptEndSeq = WUPTENDSEQ_A;
          wupt_cfg.WuptOrder[0] = SEQID_0;
          wupt_cfg.SeqxSleepTime[SEQID_0] = 4-1;
          wupt_cfg.SeqxWakeupTime[SEQID_0] = (uint32_t)(AppAmpCfg.WuptClkFreq*AppAmpCfg.AmpODR)-4-1; 
          AD5940_WUPTCfg(&wupt_cfg);
          
          AppAmpCfg.FifoDataCount = 0;  /* restart */
          break;
        }
        case AMPCTRL_STOPNOW:
        {
          AD5940_ReadReg(REG_AFE_ADCDAT); /* Any SPI Operation can wakeup AFE */
          /* Start Wupt right now */
          AD5940_WUPTCtrl(bFALSE);
          AD5940_WUPTCtrl(bFALSE);  /* @todo is it sure this will stop Wupt? */
          break;
        }
        case AMPCTRL_STOPSYNC:
        {
          AppAmpCfg.StopRequired = bTRUE;
          break;
        }
        case AMPCTRL_SHUTDOWN:
        {
          AppAMPCtrl(AMPCTRL_STOPNOW, 0);  /* Stop the measurment if it's running. */
          /* Turn off LPloop related blocks which are not controlled automatically by sleep operation */
          AFERefCfg_Type aferef_cfg;
          LPLoopCfg_Type lp_loop;
          memset(&aferef_cfg, 0, sizeof(aferef_cfg));
          AD5940_REFCfgS(&aferef_cfg);
          memset(&lp_loop, 0, sizeof(lp_loop));
          AD5940_LPLoopCfgS(&lp_loop);
          AD5940_EnterSleepS();  /* Enter Hibernate */
        }
        break;
        default:
        break;
      }
      return AD5940ERR_OK;
    }

    In the standard application it gets called one times after initialization and before the while(1) loop with "AMPCTRL_START" Argument, to start the application.

    If i got things right to stop the application (the measurement) by a button press while staying able to restart it again at runtime (so start a new measurement without reset the program) I had to call this function again with the "AMPCTRL_STOPNOW" Argument right ?

    Could you eventually clarify what exactly is the difference between calling the function with the "AMPCTRL_STOPNOW", "AMPCTRL_STOPSYNC" and the "AMPCTRL_SHUTDOWN" argument ?

    Greetings

Children