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
  • Hi,

      One simple way to implement the above is as below:

    void AD5940_Main(void)
    {
    uint32_t temp;

    AppAMPCfg_Type *pAmpCfg;

    AppAMPGetCfg(&pAmpCfg);
    AD5940PlatformCfg();
    AD5940AMPStructInit(); /* Configure your parameters in this function */

    /* Initialise 2 EC sensors */
    AppECSnrInit(&pAmpCfg->SensorCh0, M355_CHAN0);

    AppAMPInit(AppBuff, APPBUFF_SIZE); /* Initialize application. Provide a buffer, which is used to store sequencer commands */
    while (AD5940_ReadReg(REG_AGPIO_GP0IN) == 0xA)
    {
    AppAMPCtrl(AMPCTRL_START, 0); /* Control measurment to start. Second parameter has no meaning with this command. */

    while(1)
    {
    /* Wait for data ready interrupt on internal GPIO pin */
    if(AD5940_GetMCUIntFlag())
    {
    AD5940_ClrMCUIntFlag(); /* Clear this flag */
    AppAMPISR(AppBuff, &temp); /* Deal with it and provide a buffer to store data we got */
    AMPShowResult((float*)AppBuff, temp); /* Show the results to UART */
    /*Digital die sleep untill wakeup timer expires*/
    PwrCfg(ENUM_PMG_PWRMOD_HIBERNATE,MONITOR_VBAT_EN,0); //this line is all code for digital die entering hibernate

    if (AD5940_ReadReg(REG_AGPIO_GP0IN) == 0xB)
    break;

    }
    }
    }
    }

  • Hi, thx for the explanation, I already figured out my own way to do it, it looks basically like this:

    void AD5940_Main(void)
    {  
        ...configuration...
      
      while(1)
      {
        
        if((ucButtonPress == 1) && (ctrl_flag == 0))
        {
          AppAMPCtrl(AMPCTRL_START, 0);
          ctrl_flag = 1;
        }
        else if((ucButtonPress == 0) && (ctrl_flag == 1))
        {
          AppAMPCtrl(AMPCTRL_STOPNOW, 0);
          ctrl_flag = 0;
        }
        
        /* Wait for data ready interrupt on internal GPIO pin */
        if(AD5940_GetMCUIntFlag())
        {
          AD5940_ClrMCUIntFlag(); /* Clear this flag */
          AppAMPISR(AppBuff, &temp); /* Deal with it and provide a buffer to store data we got */
          AMPShowResult((float*)AppBuff, temp); /* Show the results to UART */    
          /*Digital die sleep untill wakeup timer expires*/
          PwrCfg(ENUM_PMG_PWRMOD_HIBERNATE, MONITOR_VBAT_EN, 0); //this line is all code for digital die entering hibernate
        }    
      }
    }

    The keyword AMPCTRL_STOPNOW seems to work as intended. A press on the button stops the measurement and a press on the second button continues the measurement.

    But what is confusing me is that the keyword AMPCTRL_STOPSYNC doesn't seem to work as intended. Because instead of finishing the the measurement and then stop, the application simply crashes when im using it.

    I will try to do further research on this topic.

    Thx for your help so far.

    Greetings

Reply
  • Hi, thx for the explanation, I already figured out my own way to do it, it looks basically like this:

    void AD5940_Main(void)
    {  
        ...configuration...
      
      while(1)
      {
        
        if((ucButtonPress == 1) && (ctrl_flag == 0))
        {
          AppAMPCtrl(AMPCTRL_START, 0);
          ctrl_flag = 1;
        }
        else if((ucButtonPress == 0) && (ctrl_flag == 1))
        {
          AppAMPCtrl(AMPCTRL_STOPNOW, 0);
          ctrl_flag = 0;
        }
        
        /* Wait for data ready interrupt on internal GPIO pin */
        if(AD5940_GetMCUIntFlag())
        {
          AD5940_ClrMCUIntFlag(); /* Clear this flag */
          AppAMPISR(AppBuff, &temp); /* Deal with it and provide a buffer to store data we got */
          AMPShowResult((float*)AppBuff, temp); /* Show the results to UART */    
          /*Digital die sleep untill wakeup timer expires*/
          PwrCfg(ENUM_PMG_PWRMOD_HIBERNATE, MONITOR_VBAT_EN, 0); //this line is all code for digital die entering hibernate
        }    
      }
    }

    The keyword AMPCTRL_STOPNOW seems to work as intended. A press on the button stops the measurement and a press on the second button continues the measurement.

    But what is confusing me is that the keyword AMPCTRL_STOPSYNC doesn't seem to work as intended. Because instead of finishing the the measurement and then stop, the application simply crashes when im using it.

    I will try to do further research on this topic.

    Thx for your help so far.

    Greetings

Children
No Data