title: STM32 NVIC ADC interrupt not triggering
body: <p>I have an STM32F411VET and I want to have interrupt triggered after ADC conversion is finished. Documentation says following:</p>
  
  <blockquote>
    <p>In Single conversion mode the ADC does one conversion. This mode is started with the
    CONT bit at 0 by either:</p>
    
    <ul>
    <li>setting the SWSTART bit in the ADC_CR2 register (for a regular channel only)
    Once the conversion of the selected channel is complete:</li>
    </ul>
    
    <p>If a regular channel was converted:</p>
    
    <ul>
    <li>The converted data are stored into the 16-bit ADC_DR register</li>
    <li>The EOC (end of conversion) flag is set</li>
    <li>An interrupt is generated if the EOCIE bit is set</li>
    </ul>
    
    <p>Then the ADC stops.</p>
  </blockquote>
  
  <p>Thus, I have following code:</p>
  
  <p><strong>Enabling interrupts</strong></p>
  
  <pre><code>SET_BIT(ADC1-&gt;CR1, ADC_CR1_EOCIE);      // enable interrupt generation
  NVIC_EnableIRQ(ADC_IRQn);       // allow interrupt in NVIC
  __enable_irq();     // change cpu flags to enable interrupts
  </code></pre>
  
  <p><strong>Configuring ADC</strong></p>
  
  <pre><code>void ConfigureADC()
  {
      // PA1 - ADC_IN1
      SET_BIT(GPIOA-&gt;MODER, GPIO_MODER_MODE1_0 | GPIO_MODER_MODE1_1); 
      SET_BIT(RCC-&gt;APB2ENR, RCC_APB2ENR_ADC1EN);      // enable ADC1 clock
      SET_BIT(ADC1-&gt;CR2, ADC_CR2_ADON);       // enable ADC1
      SET_BIT(ADC1-&gt;CR1, ADC_CR1_RES_1);      // 8-bit conversion
      SET_BIT(ADC-&gt;CCR, ADC_CCR_ADCPRE_0);    // prescaler - /4
      SET_BIT(ADC1-&gt;SQR3, 1);     // channel 1 (PA1)
      SET_BIT(ADC1-&gt;CR2, ADC_CR2_CONT);       // Continious mode
  }
  </code></pre>
  
  <p><strong>Interrupt handler</strong></p>
  
  <pre><code>void ADC_IRQHandler()
  {
      vConverted = true;
      CLEAR_BIT(ADC1-&gt;SR, ADC_SR_EOC);        // Software clears EOC flag
  }
  </code></pre>
  
  <p>While in debug mode or reading directly from <code>ADC1-&gt;DR</code> register I get a fine result.</p>
  
  <p>Thing that make me worry is that I cannot debug interrupt handler in uVision5 (IDE I'm using).</p>
  
  <p>The problem is that interrupt handler is not being executed and I don't know how to debug it properly.</p>
  
  <hr>
  
  <p>Thank everyone for help.</p>