2016-07-21 07:03 AM
I have a question on how to modify the Flash Latency under RCC Configuration. No matter what clock configuration I choose, this field is always greyed out. In some application, I had to modify myself the Flash Latency from 0 to 1 just to see it running and not getting into Hard Fault handler. Anyone?
#flash #stm32cubemx #rcc2016-07-21 07:57 AM
Hi susilo.ekawahyu,
• Using CUBEMX interface flash wait state is setting automatically according to the user configured frequency.• Does MX generate a wrong flash wait states number?• You can modify and program the number of wait states to the LATENCY bits in the FLASH_ACR register using __HAL_FLASH_SET_LATENCY(__LATENCY__) function • Please refer to the Number of wait states according to CPU clock (HCLK) frequency table in you related reference manual -Syrine-2016-07-21 08:34 AM
To try and narrow the scope here a little, please try to define the version of CubeMX and the STM32 part you are using.
2016-07-21 09:54 AM
STM32CubeMX ver 4.15.1, F0 Firmware Library v1.6.0, Device STM32F072C8T6, no HSE/LSE. It runs CDC ACM stack and GPIOs (for LEDs).
When I configured the clock as HSI48, AHB Pre-scaler to 1, APB1 Pre-scaler to 1-4, everything runs as expected.When I configured the clock as HSI48, AHB Pre-scaler to 4, APB1 Pre-scaler to 1, it falls into Hard Fault all the time. My solution is to set the FLASH_LATENCY_1 in HAL_RCC_ClockConfig() manually. I would like to see if somehow this can be done from STM32CubeMX because I will be generating the code very often. Please let me know if you need the .ioc file uploaded somewhere.