Why can't a blank CubeMX project not enter while(1) loop.
- April 17, 2019
- 4 replies
- 1657 views
Hi
I used a NucleoF072RB and Cube MX. I use Atollic TrueStudio.
I wanted to know how to setup and AND before integrating it in another project. So I created a new blank project.
I set tup the porject as per the picture ADC_setup. No pin were activated on the MCU (except the default settings).
I generate my code. It compiles.
I test one line of code:
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
temp3++;
/* USER CODE BEGIN 3 */
I previously wrote this right afterMX_ADC_Init():
/* Initialize all configured peripherals */
MX_ADC_Init();
/* USER CODE BEGIN 2 */
/*Calibrating the ADC*/
ADC1->CR &= !ADC_CR_ADEN;
ADC1->CR |= ADC_CR_ADCAL;
while ((ADC1->CR & ADC_CR_ADCAL) != 0){
temp++;
}
/* Enable ADC*/
ADC1->CR |=ADC_CR_ADEN;
while((ADC1->ISR & ADC_ISR_ADRDY) == 0){
temp2++;
}
/* USER CODE END 2 */
temp4++;
When I pause the debugger,
temp =16
temp2 = 3
temp3 =0
temp4=1
I commented out all of my code now the debugger alway pauses at the last line on MX_ADC_Init();
What's wrong with the my CubeMX config ?
Does MX_ADC_Init(); performs the initial calibration ?
Do I need to connect AGND and AVDD to external power sources ? (I left them floting :grinning_face_with_sweat: )
Thank you for you help
