Debug connection crashes when setting SYSOSCCTRL

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

Debug connection crashes when setting SYSOSCCTRL

429 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ben1976de on Thu Jul 01 03:58:21 MST 2010
Hello,

when I am setting up the clock configuration for LPC1343 the debug connection crashes.
The manual says that setting SYSOSCCTRL to 0x1 means using external crystal from XTAL to fed PLL.

Here are my settings:
//set src to xtal
[SIZE=2]    LPC_SYSCON->SYSPLLCLKSEL = 0x1;               
    LPC_SYSCON->SYSPLLCLKUEN  = 0x01;              
    LPC_SYSCON->SYSPLLCLKUEN  = 0x00;
    LPC_SYSCON->SYSPLLCLKUEN  = 0x01;
    while (!(LPC_SYSCON->SYSPLLCLKUEN & 0x01));[/SIZE]

[SIZE=2]//set 48MHz
LPC_SYSCON->SYSPLLCTRL = 0x03;

//apply clock to main bus
    LPC_SYSCON->MAINCLKSEL = 0x03;                  
    LPC_SYSCON->MAINCLKUEN = 0x01;                
    LPC_SYSCON->MAINCLKUEN = 0x00;
    LPC_SYSCON->MAINCLKUEN = 0x01;
    while (!(LPC_SYSCON->MAINCLKUEN & 0x01));

//bypass IRC
    LPC_SYSCON->SYSOSCCTRL    = 0x01; //this is the place where it crashes

I want to use external crystal on the LPC board and simultanously SWD. Is that not possible?

Thanks

[/SIZE]

Original Attachment has been moved to: 1100506_LPCXpresso.zip

0 Kudos
4 Replies

369 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ben1976de on Thu Jul 01 08:29:21 MST 2010
Thanks, your hint led me on the right lane.
In fact, my problem was that you have to change the main clock to a constant source (like IRC) while changing PLL registers.
0 Kudos

369 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Jul 01 07:05:49 MST 2010
When you change the clock speed and/or oscillator source, you are also changing the speed of the debug connection. As you are stepping the code when this happens, the debugger is no longer able to connect, as you have changed the connection 'under it's feet'.

The way around this is to set a breakpoint after you change the speed and RUN to the breakpoint. The debugger will then resync the debug connection, when the breakpoint is hit. This is not possible when single stepping.
0 Kudos

369 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ben1976de on Thu Jul 01 06:19:54 MST 2010
All happens while I'm in debug mode (single step with breakpoints).
I use standard configuration with SWD debugging on the LPC1343.
The first time it occurred (out of the box) the connection to the device broke down after SYSOSCCTRL was set to bypass. After that I had to do a mass erase (due to nxp forum)because the gdb server was not able to reconnect to the target.
Now it turns out that after changing SYSOSCCTRL to bypass mode the registers cannot be read anymore followed by many error messages:
###############################
Error reading device
Reason:
Em(11) cannot complete transaction, even after slowing speed
###############################

followed by:
#################################################
Target reports errors
reason:
10: could not start execution from stop
#################################################

followed by:
#########################################
execution is stopped because of error
#########################################

followed by:
#########################################
target reports errors
Reason:
15:target error from register access
#########################################

Is it correct that I have to set SYSOSCCTRL = bypass to
get the clock from XTAL or is enough to set LPC_SYSCON->SYSPLLCLKSEL = 0x1?
0 Kudos

369 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Jul 01 05:38:36 MST 2010
What do yu mean by 'crashes'. What, exactly, are you doing (single step, breakpoint, etc), what errors do you get?
0 Kudos