ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Четверг
21 ноября
1464448 Топик полностью
POV (19.09.2024 16:35, просмотров: 132) ответил my504 на Внезапно вопрос по AT32F407. Потребовалось его тактировать не кварцем на встроенном осцилляторе, а прямо меандром от внешнего генератора. И тут обнаружилось, что предписанная рефмануалом настройка
Вот так не работает? 
/**

* @brief system clock config program

* @note the system clock is configured as follow:

* system clock (sclk) = hick / 12 * pll_mult

* system clock source = HICK_VALUE

* - hext = HEXT_VALUE

* - sclk = 240000000

* - ahbdiv = 1

* - ahbclk = 240000000

* - apb1div = 2

* - apb1clk = 120000000

* - apb2div = 2

* - apb2clk = 120000000

* - pll_mult = 60

* - pll_range = GT72MHZ (greater than 72 mhz)

* @param none

* @retval none

*/

void wk_system_clock_config(void)

{

/* reset crm */

crm_reset();

/* enable lick */

crm_clock_source_enable(CRM_CLOCK_SOURCE_LICK, TRUE);

/* wait till lick is ready */

while(crm_flag_get(CRM_LICK_STABLE_FLAG) != SET)

{

}

/* enable hext bypass */

crm_hext_bypass(TRUE);

/* enable hext */

crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);

/* wait till hext is ready */

while(crm_hext_stable_wait() == ERROR)

{

}

/* enable hick */

crm_clock_source_enable(CRM_CLOCK_SOURCE_HICK, TRUE);

/* wait till hick is ready */

while(crm_flag_get(CRM_HICK_STABLE_FLAG) != SET)

{

}

/* config pll clock resource */

crm_pll_config(CRM_PLL_SOURCE_HICK, CRM_PLL_MULT_60, CRM_PLL_OUTPUT_RANGE_GT72MHZ);

/* enable pll */

crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);

/* wait till pll is ready */

while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)

{

}

/* config ahbclk */

crm_ahb_div_set(CRM_AHB_DIV_1);

/* config apb2clk, the maximum frequency of APB2 clock is 120 MHz */

crm_apb2_div_set(CRM_APB2_DIV_2);

/* config apb1clk, the maximum frequency of APB1 clock is 120 MHz */

crm_apb1_div_set(CRM_APB1_DIV_2);

/* enable auto step mode */

crm_auto_step_mode_enable(TRUE);

/* select pll as system clock source */

crm_sysclk_switch(CRM_SCLK_PLL);

/* wait till pll is used as system clock source */

while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)

{

}

/* disable auto step mode */

crm_auto_step_mode_enable(FALSE);

/* update system_core_clock global variable */

system_core_clock_update();

}