STM32_FLASHBITS Error

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
alexblack
Posts: 277
Joined: Mon Sep 24, 2012 3:52 pm
Been thanked: 33 times

STM32_FLASHBITS Error

Post by alexblack »

Hi, sometimes I like to overclock the MCUs and found the errornous settings of STM32_FLASHBITS:

Code: Select all

os/hal/platforms/STM32F4xx/hal_lld.h
...
1617 /**
1618  * @brief   Flash settings.
1619  */
1620 #if (STM32_HCLK <= STM32_0WS_THRESHOLD) || defined(__DOXYGEN__)
1621 #define STM32_FLASHBITS             0x00000000
1622 #elif STM32_HCLK <= STM32_1WS_THRESHOLD
1623 #define STM32_FLASHBITS             0x00000001
1624 #elif STM32_HCLK <= STM32_2WS_THRESHOLD
1625 #define STM32_FLASHBITS             0x00000002
1626 #elif STM32_HCLK <= STM32_3WS_THRESHOLD
1627 #define STM32_FLASHBITS             0x00000003
1628 #elif STM32_HCLK <= STM32_4WS_THRESHOLD
1629 #define STM32_FLASHBITS             0x00000004
1630 #elif STM32_HCLK <= STM32_5WS_THRESHOLD
1631 #define STM32_FLASHBITS             0x00000005
1632 #elif STM32_HCLK <= STM32_6WS_THRESHOLD
1633 #define STM32_FLASHBITS             0x00000006
1634 #elif STM32_HCLK <= STM32_7WS_THRESHOLD
1635 #define STM32_FLASHBITS             0x00000007
1636 #else
1637 #define STM32_FLASHBITS             0x00000008
1638 #endif
...

In line 1637 the value 0x00000008 of STM32_FLASHBITS is out of valid range from 0 to 7. Although in normal situation this value not used but in my case this was the rison the MCU locks!
By the way, STM processors excellent overclocked and has a lot of hidden abilities!
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32_FLASHBITS Error

Post by Giovanni »

Hi,

8-15 wait states are possible on STM32F401/42x/43x devices. That condition should never happen on 40x devices.

Giovanni
alexblack
Posts: 277
Joined: Mon Sep 24, 2012 3:52 pm
Been thanked: 33 times

Re: STM32_FLASHBITS Error

Post by alexblack »

I used STM32F207 and if I used HCLK greater then 120MHz it was happen! Eventually this branch is present for some reason.
Post Reply