SystemCoreClock

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

SystemCoreClock

1,950 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lmoreira on Mon Aug 16 03:34:12 MST 2010
Hi Guys,
I have just started to look at the LPC13XX and the LPC11XX and to me the documentation and examples are absolutely diabolic!!! The manuals are just really badly ordered.
I have both the boards for the LPC1343 and for the LPC1114 and I am looking into setting up of the SystemCoreClock. The board as a 12MHz Xtal oscillator and the micro also as it's internal oscillator. When the micro starts up what CLK are we running on? With the debug connected can I change the clk source?
Another issue is in which of the files is the SystemCoreClock defined and setup?
Best Regards
                     Luis

Original Attachment has been moved to: 1100603_dfuApp575890879627806053.txt.zip

0 Kudos
Reply
9 Replies

1,775 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Luis Digital on Thu Sep 23 20:34:24 MST 2010

Quote: foxtail
Yep you were bored!!

You also have to change the USB PLL source or disable it.



That part does not have USB (LPC1111).

I have now a lot of LPC1342 and "professional PCB". I will upload some pictures in a few minutes... ;)
0 Kudos
Reply

1,775 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by foxtail on Thu Sep 23 20:28:25 MST 2010
Yep you were bored!!

You also have to change the USB PLL source or disable it.
0 Kudos
Reply

1,775 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Luis Digital on Thu Sep 23 20:23:22 MST 2010
Hello,

[COLOR=#000000]The discussion here is how to use the microcontroller with the internal oscillator?

[/COLOR]Here is the answer.
0 Kudos
Reply

1,775 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by foxtail on Thu Sep 23 19:29:20 MST 2010
Got it.  In the system_LPC13xx file, it uses WHILE loop to wait for the main and USB PLLs to lock.  I had the main PLL set to use IRC, but not the USB PLL.  I set them both to IRC and it boots and runs with no crystal. *NOTE* Doing a Build All often did not update the download to my changes.  If you do a Clean All, it will Build All and definately include the changes
0 Kudos
Reply

1,775 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by foxtail on Thu Sep 23 18:56:46 MST 2010
I changed the system_LPC13xx file to use IRC instead of XTAL during init[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]
void[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [B]SystemInit[/B] ([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) routine.  Now, I switch the device on - nothing.  I breifly touch the crystal onto the PCB pads and it boots and runs.  I can then remove the crystal.  So either the device does not default to IRC as the datasheet says, or something else is causing this![/SIZE]
[SIZE=2][/SIZE]
[SIZE=2]-Sam[/SIZE]
[SIZE=2]
[/SIZE]
0 Kudos
Reply

1,775 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by foxtail on Thu Sep 23 18:15:09 MST 2010
I agree with lmoreira, the user manual is the worst I have ever seen, and I have programmed 6502, 6510, Z80, PIC, 68k, AVR, 8051, Hitachi and probably some other I have forgotton.

I ask the same question.  I just built a project using LPCXpresso, with CMSIS.  What is the clock source and how do I change it - point being, that the dev kit uses a crystal and I dont want to, I want to use internal oscillator, as the product I am designing this into (as a replacement for AVR) is very cost sensative with qty of >50,000 per annum (consumer product).

Took me long enough to work out how to download the software onto the board as this is not obvious in LPCXpresso

-Sam
0 Kudos
Reply

1,775 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lmoreira on Wed Aug 18 00:36:38 MST 2010
Hi,
Just adding the link to the GPIO issue thread.

http://knowledgebase.nxp.com/showthread.php?t=467

Best Regards
                     Luis
0 Kudos
Reply

1,775 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lmoreira on Wed Aug 18 00:31:36 MST 2010
Hi Jesse,
  I have been on some workshops for your ARM Micros here in the UK, and I found that you do have a very good product and that you found some very cleaver ways to speed up execution, but what you are lacking, in my opinion is the ability to convey this advantages to us as users.
  This is the first time I am using an ARM Micro and although I have a decent knowledge of C and do work with other Micros like the PIC and some of the Freescale 8 and 16 bit Micros, I am finding it hard going.
  Let’s take the System CLK, Only after reading some statement on page 4 of the manual, did I found out that apart from the normal RC oscillator you also packed another oscillator, which you give only max speed but no other characteristics.
  On figure 3 page 12, the sys_osc_clk, can actually be this internal oscillator or the external oscillator, but yet I can not find any clear statement of diagram about this anywhere. Actually I found some mention of it by chance in table 12 (SYSOSCCTRL), which again is as vague and confusing as the rest. I presume instead of the external Xtal I can also feed a CLK signal into XTALin only.
  To me the configuration section is very important and more detail on the chip startup and even a preferred or suggested sequence for its proper startup should have been included.
  
  I also had problems with your GPIO documentation which you can actually see in this thread.
  But apart from that, in my opinion your manual, actually does not convey the major feature, that you actually have a register for each combination of GPIO Pins for each PORT and that by writing into any of them you effectively eliminated the need for the usual masking, hence saving execution time. That is not obvious by reading your manual at all. It should be.
  Another issue is the two lower bits that are not used when writing into the Port’s registers. When you look at the addresses for the registers it ends at 0x3FF8 and then the other register is sitting at address 0x3FFC, where did the registers in between gone? After I had to dig around for a bit, it became obvious that because you do not use the two lower bits for the “address”, although you can write to the registers nothing will change.
  
  I also found that the 32bit Timer section gives me a lot of info on the registers but not really that much info on setup and usage. In my opinion, a massively flexible and future rich peripheral, that you again failed to explain properly. 
  
  
  What I am trying to say is that your manuals seem to assume that I am supposed to know a lot about how your Micros work.
  I had some help from a friend trying to decipher your manuals and even him, who has many more years of experience than me, took a while to get anywhere. At is suggestion I actually looked at the ST ARM M3 documentation and I can tell you that maybe you should to. I actually understood the GPIO registers on your ARM after I read their documentation.
  
  [FONT=&quot]This is obviously my opinion and probably everyone else just reads your manuals and finds them completely clear, so I am not looking for posts for it or against it, I am just giving you the feedback based on my experience.
Thanks for taking the time to look at my post.
Best Regards
                    Luis
[/FONT]
0 Kudos
Reply

1,775 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Jesse.Rosenberg on Mon Aug 16 13:23:49 MST 2010
Luis,

Chapter 3.4 of the user manual covers the clocking of the parts. You can switch clock sources at run time (debugging shouldn't be an issue), but you'll need to take care that both clock sources are active before you switch the clock muxes via the MAINCLKSEL register. After your destination clock source is selected you can power down unused clocks.

The documentation of MAINCLKSEL indicates that at startup the internal clock source (IRC) is selected, however a call is made to SystemInit() in the startup code which is responsible for setting up the clock, and will typically switch to the external crystal. You may want to read ARM's documentation about CMSIS and their standardized routines. If you are not designing a program with CMSIS compliance, you can always implement your own system clock control routines as well.

Do you have any specific comments as to why the examples are not usable?
0 Kudos
Reply