2018-04-05 01:56 AM
We are trying to increase the clock speed of our STM32 on our custom board but we encountered some difficulties.
At the moment, we set a clock of 56 MHz, using HSI and an PLL of 112 (with CubeMx). It works fine.
But when we set a clock of 96 MHz by setting the PLL to 192, we get Hard Fault, Usage Fault or Bus Fault when debugging.
We tried increasing the flash latency, but it does not work better. The power supply seems good (around 3,2 V).
We were missing the Vcap on the board, but we fix that. Not better.
What can we look at to debug this problem ?
#cpu-clock-frequencySolved! Go to Solution.
2018-08-06 02:25 AM
We did a second version of our design with a more stable power supply and it seems to fix the problem.
Thank you all for your help.
2018-04-05 03:56 AM
Check settings of VOS bits. Review state of internal clocks via MCO pin PA8.
2018-04-12 02:42 AM
We tried changing the VOS bits with no luck.
The problem seems to arise when the systick interrupt is started.
P.S: we do not have access to MCO for now.
2018-05-04 12:54 AM
We tested the MCO pins. Clock frequencies seem normals.
We noticed that sometimes the PLL clock stopped. But we do not know if it is the micro which crashes and stop the PLL or the PLL which stops and crash the micro.
MCO pins:
2018-05-04 01:05 AM
Hello Nicola,
please check the configuration of APB1 prescaler. The frequency of 96 MHz exceeds the limit of 50 MHz for APB1.
Verify the configuration once again in STM32CubeMX Clock Configuration wizard. It highlights wrong clock settings.
Let us know about the results.
Best regards,
Jaroslav
2018-05-04 03:15 AM
Hello,
The APB1 prescaler is set to 2. We use CubeMx to configure the clock and there are no highlights.
The generated code:
void SystemClock_Config(void){ RCC_OscInitTypeDef RCC_OscInitStruct; RCC_ClkInitTypeDef RCC_ClkInitStruct; /**Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; RCC_OscInitStruct.HSIState = RCC_HSI_ON; RCC_OscInitStruct.HSICalibrationValue = 16; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; RCC_OscInitStruct.PLL.PLLM = 16; RCC_OscInitStruct.PLL.PLLN = 192; RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; RCC_OscInitStruct.PLL.PLLQ = 2; RCC_OscInitStruct.PLL.PLLR = 2; 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_CLOCKTYPE_PCLK2; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3) != HAL_OK) { _Error_Handler(__FILE__, __LINE__); } HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSI, RCC_MCODIV_2); HAL_RCC_MCOConfig(RCC_MCO2, RCC_MCO2SOURCE_PLLCLK, RCC_MCODIV_1); /**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, 0, 0);}I think the configuration is good, because it works well on a Nucleo.
But on our custom board it does not work and we are searching ways of investigate this problem.
2018-05-04 04:44 AM
Hi Nicola,
can you attach your circuit diagram (the microcontroller part especially), so that I can check it?
You can also refer to the application note (AN4488: Getting Started with STM32F4xxxx MCU hardware development) that describes each pin and contains also reference circuit diagram.
If you get fault exceptions, you can make use of the registers in System Control Block in the ARM Cortex-M4 core that control fault exceptions and provide information of their cause.
There is an application note from arm (AN209: Using Cortex-M3/M4/M7 Fault Exceptions) that thoroughly describes the exceptions and possible causes.
You may also find useful our application note (AN4989: STM32 microcontroller debug toolbox) that contains hints and tips for debugging.
If the same code is running well on a development boards, it indicates possible hardware issue.
I hope it helps. Good luck!
Best regards,
Jaroslav
2018-05-04 07:02 AM
I do not know if I can disclose the circuit diagram for now but we will check those application notes and try to identify the cause of the fault.
Thanks for the advices.
2018-05-06 05:38 AM
We noticed that sometimes the PLL clock stopped.
That sounds alarming. I'd double-check the analog ground and power pins, also taking into consideration bad solder joints on the pins.
JW
2018-05-17 09:23 AM
Hi, d
id you solve the problem?
Ihave an identical problem but with STM32F401RBT6, on nucleo all works, on my PCB fault as above. Errors are sometimes different(INVSTATE, PGSERR, PRECISERR, BFARVALID, BFAR, MMFAR, PGSERR) and occur in a random program location, at about >50-60Mhz, regardless of the periphery.
EDIT: The problem solved ... the Vcap 4.7uF capacitor must be really low ESR, or better 2x2.2uF.Below my configuration. I added extra 100nF for NRST.