LPC1114 changing crystal frequencies

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC1114 changing crystal frequencies

389 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by JSalisbury on Fri Mar 25 07:07:41 MST 2011
Hi,
I am wanting to use a 16.384MHz crystal with the LPC1114 expresso boards. As a first step I was wantinging to change blinky to use at 16.384MHz  When I change the the crystal on the board I also set __XTAL in system_LPC11xx.c to 16384000UL The clock set up in system_LPC11xx.h is as shown. When I start the debugging session I keep ending up in the hardfault fault function! What am I doing wrong? I have checked with a scope and the crystal is running at 16.384MHz

#define CLOCK_SETUP           1
#define SYSCLK_SETUP          1
#define SYSOSC_SETUP          1
#define SYSOSCCTRL_Val        0x00000000
#define WDTOSC_SETUP          0
#define WDTOSCCTRL_Val        0x000000A0
#define SYSPLLCLKSEL_Val      0x00000001
#define SYSPLL_SETUP          1
#define SYSPLLCTRL_Val        0x00000022
#define MAINCLKSEL_Val        0x00000003
#define SYSAHBCLKDIV_Val      0x00000001
#define AHBCLKCTRL_Val        0x0001005F
#define SSP0CLKDIV_Val        0x00000001
#define UARTCLKDIV_Val        0x00000001
#define SSP1CLKDIV_Val        0x00000001



blinky16 Debug [C/C++ MCU Application]   
    MCU GDB Debugger (25/03/2011 13:53) (Suspended)   
        Thread [1] (Suspended: Signal 'SIGSTOP' received. Description: Stopped (signal).)   
            3 HardFault_Handler() c:\d656\nxp workspace\blinky16\startup\cr_startup_lpc11.c:284 0x0000036c   
            2 <signal handler called>()  0xfffffff9   
            1 main() c:\d656\nxp workspace\blinky16\src\blinky_main.c:81 0x00000396   
    arm-none-eabi-gdb (25/03/2011 13:53)   
    C:\d656\nxp workspace\blinky16\Debug\blinky.axf (25/03/2011 13:53)
0 Kudos
5 Replies

329 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by muhammadatif on Mon Apr 09 00:07:42 MST 2012
I believe your controller is working. I have tested an LPC1114 with a 20MHz crystal and it ran for hours. The problem may be with the default timing used by the SWD programmer on board the LPCXPresso. Another thing is that if you use a crystal other than 12MHz you will have to change the baud rate settings since the USART controller expects a 12MHz crystal. For example if you use an 16 MHz crystal, you will have to set the Baud rate to 115200x12/16 = 86400.[I]

[/I]
0 Kudos

329 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Fri Mar 25 11:19:13 MST 2011
Come on, thats elementary school math:

[COLOR=red]1. Calculate M / MSEL:[/COLOR]
[INDENT]49.152MHz / 16.384MHz = 3

UM10398 3.11.4 Frequency selection:

Quote:

FCLKOUT = M × FCLKIN = (FCCO) / (2 × P)



So M=3

UM 3.5.3 System PLL control register: [COLOR=blue]MSEL = M-1 = 2[/COLOR]
[/INDENT][COLOR=red]2. Calculate P / PSEL:[/COLOR]
[INDENT]FCLKOUT * 2 * P = FCCO

FCCO frequency range is 156 MHz to 320 MHz, so we choose:

P = 2

FCCO = 49MHz * 2 * 2 = 196 MHz

UM 3.5.3 System PLL control register: [COLOR=blue]P=2[/COLOR] [COLOR=blue]PSEL = 1[/COLOR]
[/INDENT]Result:

SYSPLLCTRL_Val   =  ((PSEL<<5) | MSEL)
SYSPLLCTRL_Val   =  ((1<<5) | 2)
0 Kudos

329 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Fri Mar 25 09:52:18 MST 2011
No.

UM10398:

Quote:

[FONT=Arial][SIZE=2][FONT=Arial][SIZE=2]The LPC111x/LPC11Cxx operate at CPU frequencies of up to 50 MHz.[/SIZE][/FONT]
[/SIZE][/FONT]



So choose another insane frequency.
0 Kudos

329 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by JSalisbury on Fri Mar 25 09:21:53 MST 2011
Hi,
Yes I did know I was useing the PLL, I was wanting to use a 16.384MHz crystal and run the device internaly at 49.152MHz. Can this be done?
Thanks
0 Kudos

329 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Fri Mar 25 09:11:37 MST 2011
Are you aware that you are still using PLL?

You are feeding PLL with 16 MHz :):)

If you want to run your main clock with 16 MHz, use

 #define MAINCLKSEL_Val        0x00000001


also use
LPC_IOCON->PIO0_1 = (1<<0); //set CLKOUT
LPC_SYSCON->CLKOUTCLKSEL =3; //select main clock
LPC_SYSCON->CLKOUTDIV =10; //set divider =10
LPC_SYSCON->CLKOUTUEN =0;
LPC_SYSCON->CLKOUTUEN =1; //enable clkout


to scope 1/10 main clock at PIO0_1
0 Kudos