LPC11 SystemInit() clock switching query

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by push2eject on Wed Jul 18 03:18:45 MST 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?