2017-10-03 04:32 AM
Hi community,
I need help again. I have a problem with my stm32f030RCT6 program. Yesterday I programmed this MCU and today morning a saw problem. Problem is with reconfiguring rcc settings. MCU was programmed with PLL = 6x and HSE = on:
/** System Clock Configuration
*/void SystemClock_Config(void){RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_ClkInitTypeDef RCC_ClkInitStruct; RCC_PeriphCLKInitTypeDef PeriphClkInit;/**Initializes the CPU, AHB and APB busses clocks
*/ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSI14 |RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.HSIState = RCC_HSI_ON; RCC_OscInitStruct.LSIState = RCC_LSI_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL6; RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV1; if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { _Error_Handler(__FILE__, __LINE__); }/**Initializes the CPU, AHB and APB busses clocks
*/ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
{ _Error_Handler(__FILE__, __LINE__); }PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1;
PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK1; if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) { _Error_Handler(__FILE__, __LINE__); }/**Enables the Clock Security System
*/ HAL_RCC_EnableCSS();/**Configure the Systick interrupt time
*/ HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);/**Configure the Systick
*/ HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 3, 0);}today morning, when problem occured i debug MCU by STMstudio and I readed values from registers 0x40021000 = 0x86AFB and 0x40021004 = 0x110000
From these registers I know about reconfiguration rcc.
0x40021000 = 0x86AFB -> It means HSEON(bit 16) is reset, HSERDY(bit 17) is reset, PLLON(bit 24) is reset and PLLRDY(bit 25) is reset too0x40021004 = 0x110000 -> It means SW(bits 1 - 2) are reset and SWS(bits 3 - 4) are reset tooAfter reset MCU everything is correct: 0x40021000 = 0x30B6AFB and 0x40021004 = 0x11000A
Why MCU was reconfigured by himself?
Please Help,
Dawid
2017-10-03 05:51 AM
>>Why MCU was reconfigured by himself?
I'd be surprised if it were by mag1c
HSE failed? Entered SLEEP?
2017-10-03 11:25 AM
HSE is ok. Reset device solved problem. Since 8 hours is everything ok. I am waiting for the same situation...
I am not using SLEEP...
Magic will be the best answer this issue... Because I have no idea, how it is possible..
P.S.
Maybe if this occurs, I shoud check something else ?
2017-10-03 04:13 PM
Boot pin(s)?
JW
2017-10-03 11:45 PM
This MCU has only one boot pin (pin 60) - BOOT0 which is connected to ground via 100k resistor
2017-10-04 07:18 AM
Try pull down harder - 1k, or if you don't ever use it, short.
JW
2017-10-04 07:32 AM
Thank You waclawek.jan for advice. I will try this if this occur...