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.


void AD5940_Main(void)
  uint32_t temp;
  uint32_t count;

  count = 0;

  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. */

    /* Check if interrupt flag which will be set when interrupt occurred. */
      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 */
    if (count == 10) {
      goto restart;

Any idea how to debug this?

Parents Reply Children
  • Akila,

    I am not asking about how to do button interrupt. Sorry, if it was not clear. The issue is what's stated in the title of this question. Let me rephrase it here.

    - How do I take multiple measurements, with AD5940 sleeping between each measurement to save battery life?

    The issue is that, as you said, if SHUTDOWN shuts off everything, shouldn't jumping to the beginning of the main function after the SHUTDOWN reset AD5940 and make AMP measurement work with valid interrupts? From my experiment, that does not work (see my code snippet)

    - Why does it not work?

    - How can I get subsequent measurement to work following the first successful measurement, without power cycling the entire system?

  • Akila - I'm having this same problem. Is it possible to answer montecarlo's question?