AnsweredAssumed Answered

AD5421 Watchdog triggering early

Question asked by JDN on Mar 7, 2016
Latest reply on Mar 7, 2016 by JDN

Hi all,

 

I'm testing an AD5421 4-20mA DAC chip (an AD5421BCPZ to be precise) and I've noticed that the watchdog timeout for SPI communications is sometimes triggering closer to one quarter of the duration set in the control register.

 

I've setup my MCU to update the dac value every 250ms, and I have the watchdog set to trigger at 500ms. This should never cause a watchdog timeout. I guarantee that the dac value was successfully updated by reading the dac register back after every update and comparing the read back value to the value i sent, so I know that no SPI communications are getting 'lost'. I've guaranteed that the MCU is running the updates on time by toggling a GPIO pin every time I do an update and watching the GPIO pin on an oscilloscope. I also watch the fault pin on the oscilloscope and I can see it triggering 125ms after the previous dac update.

 

After the fault occurs I read the fault register and the register value is 0x8000; which is the SPI timeout flag.

 

Now the interesting thing is that this only happens when the value I'm loading into the dac is > 32,000 (about 50% of fullscale). All values below that cause a correct watchdog timeout, while ALL values above there cause the watchdog to timeout prematurely.

 

Below is the code that I run every 250ms.

 

void AD5421_LoadDAC(uint16_t value)
{
    GPIO_PinOutToggle(DEBUG_WIG_WAG);

    AD5421_SetRegisterValue(Register::Dac, value);

    if(AD5421_CheckFaultPin())
    {
        uint16_t fault = AD5421_GetRegisterValue(Register::Fault  );
        uint16_t ctrl  = AD5421_GetRegisterValue(Register::Control);
        printf("Fault: %.4X / %.4X @ %i\n", fault, ctrl, ticks);
    }
    else
    {
        uint16_t dac = AD5421_GetRegisterValue(Register::Dac);

        if (dac != value)
        {
            __breakpoint(0);
        }
    }

}

 

The software breakpoint has never been hit so I know the communications are occurring correctly. When a fault does happen I read back both the fault register and the control register to make sure that the control register hasn't changed. Which it hasn't, its always 0x4800. And the fault register is always 0x8000.

 

If i watch the DEBUG_WIG_WAG pin (blue) and the AD5421's FAULT pin (yellow) on an oscilloscope, I get the following plots:

 

at 7mA (~15000 dac counts), I get this:

MAP002.BMP

The blue trace toggles every 250ms correctly, and the yellow fault trace always stays at zero volts.

 

 

and at 13mA (~40000 dac counts), I get this:

MAP001.BMP

Notice that the fault line clears every time i read the fault register / update the dac, this is correct; this is when both traces transition at the same time. But the fault line is set only 125ms afterwards, even though the watchdog timeout is 500ms.

 

Has anyone seen this behavior before?

 

Thanks,

Jonathan.

Outcomes