8 years, 9 months ago.

MBED LPC824 change cpu clock

I think MBED sets maximum cpu clock by default. Can I change this ? I'd like low power but not using sleep or power down. Datasheet shows supply current 1.04 mA when 12 MHz and low current mode. Other way would be power profiles use (What supply currente ?). Some example code please.

Search clock setup of LPCXpresso Board LPC824 may be at 10 MHz. My question: May I change this clock value without block board ?

posted by Renato Ferreira 07 Mar 2016

2 Answers

8 years, 8 months ago.

Erik I changed the following line for lpc824 to half the speed. However my uarts are throwing garbage?

<code>

  1. define IRC_OSC_CLK (12000000UL)

</code>

<code>

  1. define IRC_OSC_CLK (06000000UL)

</code>

Can you point out what i am doing wrong?

You cannot change the clock frequency like that. The IRC_OSC has a fixed frequency of 12MHz, if you want to reduce the speed you need to change the PLL ratio (I assume you are using the PLL).

posted by Erik - 15 Apr 2016

Erik Apologies for the novice questoin.

i am not sure i am using pll. How do i change the pll ratio?

posted by siva surendar 15 Apr 2016

PLL is external osc? I am NOT USING EXTERNAL osc.

posted by siva surendar 15 Apr 2016

Erik, Changing SYSAHBCLKDIV_Val to 5 seems to have done the trick? I am doing it right?

posted by siva surendar 18 Apr 2016
8 years, 9 months ago.

You can delete your mbed lib, import mbed-dev. Go to /targets/cmsis/nxp/lpc82x/system.c (or something close to that), where the clock setups are defined. If you do it like this things like wait statements should still work correctly.

Erik I changed the following line for lpc824 to half the speed. However my uarts are throwing garbage?

<code>

define IRC_OSC_CLK (12000000UL) </code>

<code>

define IRC_OSC_CLK (06000000UL) </code>

Can you point out what i am doing wrong?

posted by siva surendar 15 Apr 2016

Erik Sorry one more small point. When I print pc.printf("SystemCoreClock = %d Hz\n", SystemCoreClock);

I get

SystemCoreClock = 30000000 Hz

posted by siva surendar 15 Apr 2016