Hang on ADC conversion?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello,

   

I'm debugging a odd little error on a sensor project I'm working on. My project is running current through external loads with IDACs, and taking sample with ADCs, all happen on timer interupts. Other than to run a IDAC changer, or take a sample and write it to Eeprom, the device remains in AltActive mode with as many things turned off as possible. (Can't go to sleep unfortunately because IDACs don't run in sleep mode). 

   

Every once in a while, not at all frequently,  my sensor seems to hang, get stuck, and never change its outputs/take samples (which I log and read later), until a power refresh.

   

Unfortunately, the project has a number of timer interrupts that don't play nicely with debug mode, so I'm mostly using GPIO (and led) debugging methods. So I haven't pinned down yet what might be causing this, mostly because it's so infrequent.

   

Anyway, my question after all this was that I use the ADC_DelSig_1_IsEndConversion(ADC_DelSig_1_WAIT_FOR_RESULT); api to wait for samples before writing it eeprom. 

   

Can this API, or in general the ADC,  ever hang indefintely?  
Note: I do play with my clock speeds. I turn speeds down, then turn them back up before turning ADCs on, then after sampling is finished turn them down again. 

   

 

   

Really, just asking question to locate or eliminate possible sources of the bug. This is one of the few blocking statements in my code, so was just trying to figure out if it could be a source of trouble. 

0 Likes
3 Replies
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

This would block only when no conversion has started (I think). Are you sure you call this only with a running conversion? (And never twice in a row)

0 Likes
Anonymous
Not applicable

Thank you. Yes, I have a 1 conversion start,  1 isEnd,  then 1 start,  1 isEnd,  ....   5 times.

   

So, pretty sure those are working right.

   

Like I said, not yet certain where this bug came from, it only happens randomly after some arbitrary runtime when I'm not looking for it!

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

That seems more like an issue with all the interrupts. What you can do, for debugging, is to have each ISR toggle an output pin during its runtime. Then you can use a logic analyzer to see whats happening in the moment your problem occurs.

0 Likes