lpcware

CMSIS Dynamic selection of IRC vs XTAL?

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by MX21 on Wed Dec 10 15:00:39 MST 2014
I'm using LPCXpresso Code Red with CMSIS for my project.  I have an existing board with LPC1227 that uses the IRC for clock.  I have another new board that uses an external crystal (12MHz). 

From what I can find, the clock source is setup in system_LPC122x.c at compile time with a bunch of macros.  This is the common CMSIS library referenced from multiple projects.  If I edit system_LPC122x.c it will change the clock for all of my projects.

I'd like to have my code support both of my boards, by reading a GPIO pin at startup to determine which board it is, then configure the clock to use the external crystal if it is the newer board.

Is there a way to do this through CMSIS?  Or do I just need to program registers directly (thus somewhat defeating the hardware abstraction purpose of CMSIS)?

Thanks

Outcomes