how to configure LPC802 internal oscillator at 15MHz?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to configure LPC802 internal oscillator at 15MHz?

1,082 Views
leonardobarbosa
Contributor I

Hi everyone!

I'm using LPC802 in a project, using KEIL. I would like to know how to configure the internal oscillator to 15MHz (max)?. I read the user manual, which says that to configure the internal oscillator to oscillate at the maximum frequency of 15Mhz must use the api directly from the ROM, but I did not succeed, could anyone help me in this configuration?

pastedImage_1.png

Labels (3)
0 Kudos
4 Replies

779 Views
jeremyzhou
NXP Employee
NXP Employee
Thank you for your interest in NXP Semiconductor products and 
the opportunity to serve you.
To provide the fastest possible support, I'd highly recommend you to refer to the demos in code bundle, in the demos, it illustrates the way of configuring a system clock frequency of 15 MHz.

Have a great day,
TIC

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

779 Views
athmesh_n
Contributor IV

Hi jeremyzhou‌,

can you specify which code bundle? I'm having an issue with internal oscillator. I was using external crystal oscillator. Then after removing external crystal and specifying to use internal oscillator in startup code, there is no response in UART and analog.

Can you help me with the issue? what modification should I be using? Is there any modification to be done in peripherals.

NOTE: am getting system core clock as 72MHz after PLL. 

Thanks and Regards,

Athmesh Nandakumar

0 Kudos

779 Views
jerrydurand
Contributor II

The best I've found so far is lpc_chip_8xx in the latest 8xx bungle except the cr_startup_lpc80x as generated by MCUXpresso has the wrong routine name.  When I fixed that the board hangs, it turns out the sysinit_8xx.c is trying to set the oscillator to 60MHz which is way over the data sheet speed.  Also it looks like it's trying to use the PLL which isn't used with the FRO.  

I've not found anywhere that set_fro_frequency() is defined or called other than in the user manual.  I've removed the call in cr_startup to the init since the chip IS running at that point and I'll just hand code the FRO configuration into my application startup.

A grumpy old guy who remembers when system startup libraries worked and I could spend my time on making the application.

Of course I also remember programming in microcode in the far distant past.

0 Kudos

779 Views
jerrydurand
Contributor II

Here's my code to set up the FRO.  A few notes:

  • The FRO can only be set to one of a few speeds, see the user manual for more info
  • The system clock is automatically 1/2 of the FRO rate
  • The code below sets it to the max speed for the LPC802

[code]

// set up system clock (the hard way)
asm volatile(                      // the void set_fro_frequency(uint32_t iFreq); API is missing so do this by hand
   " ldr R1, ROM_Tbl \n"    // get address of pointer to ROM Driver Table
   " ldr R1, [R1] \n"             // get pointer to ROM Driver Table
   " add R1, #0x0C \n"       // step down to the entry for the FRO table
   " ldr R1, [R1] \n"             // get address of FRO table
   " add R1, #8 \n"             // step down to third entry in table
   " ldr R1, [R1] \n"             // get address of set_fro_frequency routine
   " ldr R0, FRO_Freq \n"    // put frequency in R0
   " blx R1 \n"                      // call API
   " b Exit \n"                      // done

   " .align 4 \n"                   // fix alignment
   "FRO_Freq: .word 30000 \n" // frequency in kHz
   "ROM_Tbl: .word 0x0F001FF8 \n" // address of ROM Driver Table

   "Exit: \n"                         // end of code segment
);
SystemCoreClock = 15000000; // System clock is 1/2 of FRO

[/code]

0 Kudos