cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407 crashes after RCC configuration

ERena.1
Associate

Hello !

I am currently working with a STM32F407VGT7 and I have troubles uploading some code in it. I did the simplest possible code with STM32CubeIDE : RCC configuration and some dummy operations in main while loop.

My problem is that after uploading code (with debug feature), starting it and pausing it a little while after (like 3 seconds or so), I got this error :

"Break at address "0x1fff36aa" with no debug information available, or outside of program code."

I have no idea what is causing this error. But seeing from STM32F407 datasheet that 0x1fff36aa is mapped in "System Memory + OPT" area, I guess this is not good...

I noticed that this bug doesn't occur if interrupts are disabled. Please find my code bellow.

Any idea of what could be causing this issue and how I could solve it ?

Thanks.

int main(void)
{
  /* USER CODE BEGIN 1 */
 
  /* USER CODE END 1 */
 
  /* MCU Configuration--------------------------------------------------------*/
 
  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
   HAL_Init();
 
  /* USER CODE BEGIN Init */
 
  /* USER CODE END Init */
 
  /* Configure the system clock */
  SystemClock_Config();
 
  /* USER CODE BEGIN SysInit */
 
  /* USER CODE END SysInit */
 
  /* Initialize all configured peripherals */
  /* USER CODE BEGIN 2 */
  uint32_t u32_dummy = 0;
  /* USER CODE END 2 */
 
  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
//  __disable_irq();
 
  while (1)
  {
    /* USER CODE END WHILE */
 
	  u32_dummy += 24 * 56;
 
	  u32_dummy -= 12;
 
 
    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}
 
/**
  * @brief System Clock Configuration
  * @retval None
  */
void SystemClock_Config(void)
{
  RCC_OscInitTypeDef RCC_OscInitStruct = {0};
  RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
 
  /** Configure the main internal regulator output voltage
  */
  __HAL_RCC_PWR_CLK_ENABLE();
  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
  /** Initializes the RCC Oscillators according to the specified parameters
  * in the RCC_OscInitTypeDef structure.
  */
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
  RCC_OscInitStruct.HSIState = RCC_HSI_ON;
  RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
  {
    Error_Handler();
  }
  /** Initializes the CPU, AHB and APB buses clocks
  */
  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
                              |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
 
  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK)
  {
    Error_Handler();
  }
}

1 ACCEPTED SOLUTION

Accepted Solutions
ERena.1
Associate

I found the issue : BOOT 0 pin is supposed to be pulled down (while it was pulled up).

View solution in original post

2 REPLIES 2
ERena.1
Associate

I found the issue : BOOT 0 pin is supposed to be pulled down (while it was pulled up).

Hello @ERena.1​ and welcome to the Community :)

Glad to know you overcame this problem, and thank you for your update.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen