cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F030 Halts upon enabling ADC

x4ce
Visitor

Hi,

I am new to STM32 MCUs and working on a small project at the moment. I following the reference manual but facing an issue that as soon as I enable ADC in CR, the MCU stops responding. I have attached the following code if someone could guide on what is wrong or missed in it. 

Further, HSI has been used for clocking the MCU.

Appreciated!

 

 

 

	// Enable Clock to GPIOA
	RCC->AHBENR |= GPIOA_EN;

	// PA5 as analog input
	GPIOA->MODER |= (1U<<10);
	GPIOA->MODER |= (1U<<11);

	// Enable Clock to ADC
	RCC->APB2ENR |= ADC_EN;

	/* HSI14 RC Oscillator Enable Procedure */
	//RCC->CR2 |= RCC_CR2_HSI14ON;

	ADC1->CFGR2 |= (1U<<30);
	ADC1->CFGR2 &= ~(1U<<31);
	/*
	while ((RCC->CR2 & RCC_CR2_HSI14RDY) ==0)
	{

	}
	*/
	/* ADC Enable Procedure */
	if ((ADC1->ISR & ADC_ISR_ADRDY) != 0)
	{
		ADC1->ISR |= ADC_ISR_ADRDY;
	}

	ADC1->CR |= ADC_CR_ADEN; // STM Halts after this
	while ((ADC1->ISR & ADC_ISR_ADRDY) ==0) {}

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
x4ce
Visitor

Ok, I found that there is an issue with my VDDA.

Thanks

View solution in original post

1 REPLY 1
x4ce
Visitor

Ok, I found that there is an issue with my VDDA.

Thanks