Reply
<a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Ninja</font></font> </a> kag
Posts: 98
Registered: ‎11-29-2015
Accepted Solution

ADC window / compare threshold interrupts greater than conversion rate

[ Edited ]

I am using the Blue Gecko's, EFR32BG1, ADC Window Compare function to determine the joy stick direction and how long it has been asserted in that direction.  The adc's conversion rate is set to 500 conversions per second.  I have verified this conversion rate by having the ADC increment a counter after every conversion via an interrupt call due to ADC0_IF_SINGLE. 

 

If I push the joy stick in a direction for a short period of time, such as a pulse, the ADC interrupt routine is entered an additional 15,000 to 17,000 times compared to the conversion rate of 500.   I have verified via an oscilloscope that the pulse is approximately 150mS which should result in the interrupt handler being called 500 * 150ms/1000 = 75 times.

 

If I add code to prevent the interrupt handler from exiting and enabling global interrupts until the SINGLECMP is cleared, the interrupt routine is not left until the joy stick is no longer being asserted.  My assumption is that once the data has been read, the valid comparison would be de-asserted until the next conversion has been completed and compared which appears not to be occurring.  Instead, the window compare is asserted until a valid comparison has been completed and not within the window.  With the comparison still valid, it appears to re-enter the interrupt handler and thus the counter is being incremented an additional 15,000 to 17,000 times.

 

How can I read the number of continuous conversion within the Window Threshold?

 

Thank you,

kag

 

 

Posts: 2,944
Registered: ‎08-25-2015

Re: ADC window / compare threshold interrupts greater than conversion rate

Hi,

 

I moved your post into the 32-bit MCU board where you can find better support for the EFR32 peripherals. Questions posted in the Bluetooth board are typically related to the Bluetooth stack.

 

Regards,

Tiago

Posts: 3,144
Registered: ‎02-07-2002

Re: ADC window / compare threshold interrupts greater than conversion rate

My guess is that since last conversion result is still above the threshold the interrupt is continuously generated. A solution could be to disable the window interrupt or to reconfigure the threshold.

<a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Ninja</font></font> </a> kag
Posts: 98
Registered: ‎11-29-2015

Re: ADC window / compare threshold interrupts greater than conversion rate

I do believe that the input is still within the window threshold for a period of time, but I do not believe it is issue.  I have confirmed that the number of times entering the ADC interrupt handler is greater than the ADC sample rate.

 

It appears that the SINGLECMP is not being cleared by writing to the IFC or possibly not quick enough.  The ADC is in ASYNC mode.

 

kag

Posts: 3,144
Registered: ‎02-07-2002

Re: ADC window / compare threshold interrupts greater than conversion rate

When there is no new sample taken, then of course the "input is still within the window threshold". And my point is that this might retrigger the interrupt as long as this state continues. So you can reset the interrupt flag but that probably won't help for much more than one clock cycle. The interrupt may be a level instead of an edge triggered interrupt. Try to redefine the window to see if my guess is right.

<a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Ninja</font></font> </a> kag
Posts: 98
Registered: ‎11-29-2015

Re: ADC window / compare threshold interrupts greater than conversion rate

I was hoping that the interrupt flag would only be set after each conversion, not continually until a conversion occurs that is outside the ADC specified window.  Per the IFC register, it appears the interrupt would be cleared by writing a 1 to the SINGLECMP bit.  

 

"Write 1 to clear the SINGLECMP interrupt flag. Reading returns the value of the IF and clears the corresponding interrupt flags (This feature must be enabled globally in MSC.)."

 

Writing a 1 to the IFC register must clear the IF register, but does not clear the source of the interrupt, the ADC window compare. Once the IFC register clears the IF register, the IF register bit SINGLECMP is set again even though there has not been another conversion until the a conversion occurs that is outside the ADC windows setting. 

 

kag