AnsweredAssumed Answered

ADC single conversion mode

Question asked by marchetti.simone on Feb 18, 2014
Latest reply on Feb 19, 2014 by fm
Hi,
I'm working with stm32F0discovery, and I'm trying to develop ADC single conversione mode. This is my code of init ADC:
uint32_t tmpreg = 0;
 /* ADC1 Periph clock enable */
 RCC->APB2ENR |= RCC_APB2ENR_ADC1EN;
 /* ADCs DeInit */
 RCC->APB2RSTR |= RCC_APB2ENR_ADC1EN;
 RCC->APB2RSTR &= ~RCC_APB2ENR_ADC1EN;
  tmpreg = ADC1->CFGR1;
  /* Clear SCANDIR, RES[1:0], ALIGN, EXTSEL[2:0], EXTEN[1:0] and CONT bits */
  tmpreg &= (uint32_t)0xFFFFD203;
  //resolution 12 bit 0x0000000
  //Continuous mode DISABLE
  // NO EXTEN e NO EXTSEL
  //data align right = 0
  //scan direction upward
  tmpreg  |= (uint32_t)(0x00000000 | ((uint32_t)(DISABLE) << 13) |
              0x00000000 | 0x00000000 | 0x00000000| 0x00000000);  
  ADC1->CFGR1 = tmpreg;
  //channel 3 - 28.5
  ADC1->CHSELR |= (uint32_t)ADC_CHSELR_CHSEL3; // channel 3
  ADC1->SMPR = (uint32_t)0x00000003;
 
 /* Enable ADC1 */
 ADC1->CR |= (uint32_t)ADC_CR_ADEN;     
  
 /* Wait the ADRDY flag */
 while((ADC1->ISR & 00000001) == 0);
  
 /* ADC1 regular Software Start Conv */
 ADC1->CR |= (uint32_t)ADC_CR_ADSTART;

When I set start conversion, the bit AD START of ADC_CR register doesn't set. Why?
Thanks

Outcomes