PLL problems

Discussion around product based on ARM Cortex M4 core.

Moderators: nferre, ncollot

timostehmann
Posts: 1
Joined: Thu May 16, 2013 11:23 pm

PLL problems

Fri May 17, 2013 12:45 am

Hi, I am new to this forum. I have been working with AVR and AVR XMegas for many years and decided to upgrade to the SAM4S. I purchased the SAM4S xplained board. It is the first time I have to use the PLL. Below is the main routine using the ASF utilities in Atmel Studio:

Code: Select all

int main (void)
{
    board_init();
    
    gpio_set_pin_low(LED0_GPIO);

    pmc_switch_mainck_to_fastrc(CKGR_MOR_MOSCRCF_4_MHz);
    pmc_switch_mck_to_mainck(PMC_MCKR_PRES_CLK_1);

    pmc_enable_pllbck(24,0x1f,1);

    pmc_switch_mck_to_pllbck(PMC_MCKR_PRES_CLK_1);

    for (;;)
    {
        flash_led(FLASH_TICK_COUNT, 5);
    }
}
The above code should generate a 100 MHz clock. However, the uP stops after the pmc_switch_mck_to_pllbck call. With the JTAG debugger the uP seems to reset. When changing pmc_enable_pllbck(24,0x1f,1) to pmc_enable_pllbck(4,0x1f,1) (i.e. 20 MHz), everything works.

What am I doing wrong?

Return to “SAM4 Cortex-M4 MCU”

Who is online

Users browsing this forum: No registered users and 2 guests