-
Notifications
You must be signed in to change notification settings - Fork 14
Miscellaneous issues encountered
I cannot seem to get the ADC to behave properly in auto-triggered mode off the Timer1 COMP B interrupt. No matter what I try, I end up with spurious "conversion done" interrupts. I have double- and triple-checked that I'm not putting the ADC into free-running mode, and as far as the hardware tells me, it's not in free-running mode. I've resorted to a work-around of only enabling the ADC interrupt right after Timer1 COMP B fires, and then promptly disabling it again in the ADC interrupt routine. This does give me a nice stable sampling period, but I would much rather not run the ADC more than it should.
I can't find any errata suggesting anyone else is having this problem, so it could very well be something I'm doing wrong. If I find the time (and inclination) I'll go bare-metal and see if it still happens in the minimal case.
Update I've finally worked out what's going on. The key was a small note in a completely different part of the reference manual - whenever the MCU goes to sleep into Idle or AdcNoiseReduction mode, it kicks off an ADC conversion. As such, it would seem the workaround I implemented is in fact a proper (or at least reasonable) solution.