Запуск STM32 без кварца

Вот такая задачка попалась. Контролер тактируется от внешнего источника тактов (FT232RL). А работать никак не хочет, даже начальную инициализацию не проходит. День бился…

Оказалось, что сразу после резета контроллер пытается запуститься от внешнего кристалла, а его же нет!

Потом нашел в файле system_stm32f10x.c такие строчки:

   IMPORTANT NOTE:
==============
1. After each device reset the HSI is used as System clock source.

2. Please make sure that the selected System clock doesn’t exceed your device’s
maximum frequency.

3. If none of the define below is enabled, the HSI is used as System clock
source.

4. The System clock configuration functions provided within this file assume that:
— For Low, Medium and High density Value line devices an external 8MHz
crystal is used to drive the System clock.
— For Low, Medium and High density devices an external 8MHz crystal is
used to drive the System clock.
— For Connectivity line devices an external 25MHz crystal is used to drive
the System clock.
If you are using different crystal you have to adapt those functions accordingly.
*/

#if defined (STM32F10X_LD_VL) || (defined STM32F10X_MD_VL) || (defined STM32F10X_HD_VL)
/* #define SYSCLK_FREQ_HSE    HSE_VALUE */
#define SYSCLK_FREQ_24MHz  24000000
#else
/* #define SYSCLK_FREQ_HSE    HSE_VALUE */
/* #define SYSCLK_FREQ_24MHz  24000000 */
/* #define SYSCLK_FREQ_36MHz  36000000 */
/* #define SYSCLK_FREQ_48MHz  48000000 */
/* #define SYSCLK_FREQ_56MHz  56000000 */
#define SYSCLK_FREQ_72MHz  72000000
#endif

Стоило только закомментировать

#define SYSCLK_FREQ_24MHz  24000000

И все заработало. МК успешно доходит до майна, а там уже настраиваем его как нам угодно.

Оставить комментарий


Примечание - Вы можете использовать эти HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

* Copy This Password *

* Type Or Paste Password Here *

46 893 Spam Comments Blocked so far by Spam Free Wordpress