Post Go back to editing

AD5940_Amperometric example hangs when it's shutdown and restarts

On my custom board, I am seeing a system hang (interrupt does not trigger any more) when another AMP measurement is attempted following the first successful amp measurement. I modified the AD5940_Amperometric example code and was able to reproduce the same issue on my EVAL-AD5941ELCZ. I built it with KEIL uVision 5.

/examples/AD5940_Amperometric/AD5940Main.c

void AD5940_Main(void)
{
  uint32_t temp;
  uint32_t count;

restart:
  count = 0;

  AD5940PlatformCfg();
  AD5940AMPStructInit(); /* Configure your parameters in this function */
  AppAMPInit(AppBuff, APPBUFF_SIZE);    /* Initialize AMP application. Provide a buffer, which is used to store sequencer commands */
  AppAMPCtrl(AMPCTRL_START, 0);         /* Control AMP measurement to start. Second parameter has no meaning with this command. */

  while(1)
  {
    /* Check if interrupt flag which will be set when interrupt occurred. */
    if(AD5940_GetMCUIntFlag())
    {
      AD5940_ClrMCUIntFlag(); /* Clear this flag */
      temp = APPBUFF_SIZE;
      AppAMPISR(AppBuff, &temp); /* Deal with it and provide a buffer to store data we got */
      AMPShowResult((float*)AppBuff, temp); /* Show the results to UART */
      count++;
    }
    if (count == 10) {
      AppAMPCtrl(AMPCTRL_SHUTDOWN, 0);
      goto restart;
    }
  }
}

Any idea how to debug this?

Parents Reply Children