4 years, 8 months ago.

LPC824Max board to chip LPC824

I want to develop and test on LPC824max MBed board. After will load hex file to chip LPC824.

LPC824max runs with external xtal configured to 30 MHz. In my chip I want to run with IRC in 12 MHz.

Is this way correct ?

<<CODE>>
main () {
   MAINCLKSEL = 0 ;         / IRC oscilator
  MAINCLKEN   =  1 ;        / Update clock source
   SystemCoreClockUpdate();      /update all

   .... }
<</CODE>>

1 Answer

4 years, 8 months ago.

If your custom board does not have xtal on board, it will not work because clock source selector is initialized in the beginning of startup code. I suggest to use mbed-dev (source code) library rather than mbed (pre-build) library and edit the SystemInit() function in the system_LPC8xx.c file.


https://os.mbed.com/users/mbed_official/code/mbed-dev/file/f392fc9709a3/targets/TARGET_NXP/TARGET_LPC82X/TARGET_LPC824/device/system_LPC8xx.c/

In fact I see now in LPC824max board that xtal Y1 is disconected by default. Running see that system is initialized with IRC ( SYSPLLCKLSEL = 0 / MAINCLKSEL = 3). So, I will do transfer to LPC824 chip without problem. In my Main() will setup the required system clock:

<<CODE>>
SYSAHBCLKDIV = 60;   //    set clock to  60/60 = 1 MHz by example
SystemCoreClockUpdate();
<</CODE>>
posted by Renato Ferreira 28 Jun 2019