Discussion group dedicated to the Philips LPC2000 family of ARM MCUs
Is this thread worth a thumbs up?
LPC11 SystemInit() clock switching query - Kevin - Jul 19 5:09:46 2012
Hi all, my first post here :-)
I have a couple of questions, both related to SystemInit() in system_LPC11xx.c,
which appears to have been written by ARM.
1. When switching clock sources, the xUEN bit is written 1 then 0 then 1. My
understanding from the LPC11Cxx User Manual is that it is only necessary to
write 0 then 1. Why the preceeding write to 1 in the start-up code?
2. After writing xUEN to 1,0,1; there is a loop waiting for the xUEN bit to be
set. But this bit was just set as described above. Nowhere in the User Manual or
datasheet can I find anything about having to wait for this bit to become set
(unlike the PLL lock status).
Am I missing something important about changing clock sources?
Or is the ARM startup code a bit crufty?
Thanks,
Kevin.
(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )Re: LPC11 SystemInit() clock switching query - jcdmelo - Jul 19 13:51:09 2012
My 0.5 cent ...
I take this code sequence as sacred, I do not touch it (well, mostly, but not
always) and I believe it works (and indeed it does, as all my programs are based
on it).
It might come from experience from people at NXP or elsewhere, and though not
fully documented, it might fall under those "features" that are worth
practicing, but for some reason didn't make it to the user's manual (or to an
errata sheet).
Under Keil's uVision, the code worked without the two extra writes (0 and 1),
but I haven't tried in the hardware itself for not being here. So, you might
give it a try and see what happens.
To me, sequences like this may also show that programming, even at this advanced
stage, is still part science and part art/handcraft, to my amusement, admiration
and, why not, delight.
Julio de Melo
--- In l..., "Kevin" wrote:
>
> Hi all, my first post here :-)
>
> I have a couple of questions, both related to SystemInit() in
system_LPC11xx.c, which appears to have been written by ARM.
>
> 1. When switching clock sources, the xUEN bit is written 1 then 0 then 1. My
understanding from the LPC11Cxx User Manual is that it is only necessary to
write 0 then 1. Why the preceeding write to 1 in the start-up code?
>
> 2. After writing xUEN to 1,0,1; there is a loop waiting for the xUEN bit to be
set. But this bit was just set as described above. Nowhere in the User Manual or
datasheet can I find anything about having to wait for this bit to become set
(unlike the PLL lock status).
>
> Am I missing something important about changing clock sources?
> Or is the ARM startup code a bit crufty?
>
> Thanks,
> Kevin.
>
(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )