AnsweredAssumed Answered

MC9S12C -  AD, restarting scan in continuous conversion mode

Question asked by Robert Swan on Feb 14, 2012
Latest reply on Feb 19, 2012 by Robert Swan

[Edit -- formatting lost when first posted]

 

I'm on the trail of a gremlin in an application. The problem is that an implausibly low value is read from ATDDR0 very occasionally (once in ~15e6 samples). The other channels look fine. There have been bandaids applied to hide the low values, but I'm not happy with that. I suspect the values might due to something wrong in how we're talking to the ADC.

 

The unit is configured in continuous conversion mode (ATDCTL5 = 0xb0), but in the RTI ISR (running every 128us) ADTCTL5 often gets 0xb0 rewritten to it, aborting the current conversion and immediately latching a new sample from channel 0.

 

I wonder if there might be an occasional problem with aborting/restarting the conversion cycle when it's already in scan mode. I'm thinking that if the ISR writes to ATDCTL5 at (say) just the moment that it has started a new cycle anyway, grabbing the analog value for channel 0, might lead to some sort of partial latching of the voltage which is then correctly converted to a low digital value.

 

One piece of evidence that it might be something like this is that I've temporarily disabled the section in the RTI ISR where ATDCTL5 is written to and the spurious values no longer occur. OTOH, I've read and reread the ATD section of the manual and can't see anything to suggest that there's anything wrong with what we were doing. And I've written small test programs trying to trigger misbehaviour -- they didn't.

 

I'd be very grateful if someone can tell me that there is a known problem, or that what we're doing is simply wrong, or that I must be from some other planet 'cause this works fine.

 

Have fun,

 

Rob.

Outcomes