cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX Flash Latency Greyed Out (RCC Configuration)

ekawahyu2
Associate II
Posted on July 21, 2016 at 16:03

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 #rcc
3 REPLIES 3
Nesrine M_O
Lead II
Posted on July 21, 2016 at 16:57

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-

Posted on July 21, 2016 at 17:34

To try and narrow the scope here a little, please try to define the version of CubeMX  and the STM32 part you are using.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ekawahyu2
Associate II
Posted on July 21, 2016 at 18:54

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.